Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8038998

buttons/checkboxes/menus etc have disappearing text or fail to repaint properly

XMLWordPrintable

    • 2d
    • x86_64
    • windows_7

      FULL PRODUCT VERSION :
      java version "1.8.0"
      Java(TM) SE Runtime Environment (build 1.8.0-b132)
      Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      All of the swing based
      java programs that I have tried when run with Java 8 show disappearing
      text /bad refresh problem.
      It is hard to describe but text on buttons/checkboxes and in menus
      shows up when the application is first started but disappears
      when the mouse moves overthem and never refreshes.
      This makes the application almost completely unusable.
      Labels and text fields seem to be fine.

      For some of the buttons only the last character in the text disappears for others the entire component becomes blank.

      The same programs run with Java 7 on the same computer are fine.




      REGRESSION. Last worked in version 7u51

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      You need a swing program that is sufficiently complex. I tried something with just one button and nothing seemed wrong but when I added more components the problem appeared. Just move the mouse over the various components and watch the text disappear especially the last character of
      buttons/menu options etc.

      I pasted an example where I saw the problem in a later section.







      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Text to remaining to remain visible after the mouse is moved over it or at-least refreshed /repainted as necessary.
      ACTUAL -
      Some text replaced with the background color.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      No error message is reported.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class NewJFrame extends javax.swing.JFrame {

          /**
           * Creates new form NewJFrame
           */
          public NewJFrame() {
              initComponents();
          }

          /**
           * This method is called from within the constructor to initialize the form.
           * WARNING: Do NOT modify this code. The content of this method is always
           * regenerated by the Form Editor.
           */
          @SuppressWarnings("unchecked")
          // <editor-fold defaultstate="collapsed" desc="Generated Code">
          private void initComponents() {

              jMenu1 = new javax.swing.JMenu();
              jButton1 = new javax.swing.JButton();
              jLabel1 = new javax.swing.JLabel();
              jCheckBox1 = new javax.swing.JCheckBox();
              jCheckBox2 = new javax.swing.JCheckBox();
              jTextField1 = new javax.swing.JTextField();
              jTextField2 = new javax.swing.JTextField();
              jTextField3 = new javax.swing.JTextField();
              jScrollPane1 = new javax.swing.JScrollPane();
              jTable1 = new javax.swing.JTable();
              jMenuBar1 = new javax.swing.JMenuBar();
              jMenu2 = new javax.swing.JMenu();
              jMenu3 = new javax.swing.JMenu();
              jMenuItem1 = new javax.swing.JMenuItem();
              jMenuItem2 = new javax.swing.JMenuItem();
              jMenuItem3 = new javax.swing.JMenuItem();

              jMenu1.setText("jMenu1");

              setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

              jButton1.setText("reallly loooong button text ");

              jLabel1.setText("jLabel1");

              jCheckBox1.setText("jCheckBox1");

              jCheckBox2.setText("jCheckBox2");

              jTextField1.setText("jTextField1");

              jTextField2.setText("jTextField2");

              jTextField3.setText("jTextField3");

              jTable1.setModel(new javax.swing.table.DefaultTableModel(
                  new Object [][] {
                      {null, null, null, null},
                      {null, null, null, null},
                      {null, null, null, null},
                      {null, null, null, null}
                  },
                  new String [] {
                      "Title 1", "Title 2", "Title 3", "Title 4"
                  }
              ));
              jScrollPane1.setViewportView(jTable1);

              jMenu2.setText("File");
              jMenuBar1.add(jMenu2);

              jMenu3.setText("Edit");

              jMenuItem1.setText("jMenuItem1");
              jMenu3.add(jMenuItem1);

              jMenuItem2.setText("jMenuItem2");
              jMenu3.add(jMenuItem2);

              jMenuItem3.setText("really loooooooooooooong menu item");
              jMenu3.add(jMenuItem3);

              jMenuBar1.add(jMenu3);

              setJMenuBar(jMenuBar1);

              javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
              getContentPane().setLayout(layout);
              layout.setHorizontalGroup(
                  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                  .addGroup(layout.createSequentialGroup()
                      .addGap(43, 43, 43)
                      .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                          .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                          .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                          .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                          .addComponent(jLabel1))
                      .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                          .addGroup(layout.createSequentialGroup()
                              .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                              .addComponent(jCheckBox1))
                          .addGroup(layout.createSequentialGroup()
                              .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                  .addGroup(layout.createSequentialGroup()
                                      .addGap(33, 33, 33)
                                      .addComponent(jCheckBox2))
                                  .addGroup(layout.createSequentialGroup()
                                      .addGap(53, 53, 53)
                                      .addComponent(jButton1)))
                              .addGap(0, 0, Short.MAX_VALUE)))
                      .addContainerGap())
                  .addGroup(layout.createSequentialGroup()
                      .addContainerGap()
                      .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 375, javax.swing.GroupLayout.PREFERRED_SIZE)
                      .addContainerGap(15, Short.MAX_VALUE))
              );
              layout.setVerticalGroup(
                  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                  .addGroup(layout.createSequentialGroup()
                      .addGap(15, 15, 15)
                      .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                          .addComponent(jLabel1)
                          .addComponent(jCheckBox1))
                      .addGap(6, 6, 6)
                      .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                          .addComponent(jCheckBox2)
                          .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                      .addGap(18, 18, 18)
                      .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                          .addComponent(jButton1)
                          .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                      .addGap(18, 18, 18)
                      .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                      .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                      .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE)
                      .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
              );

              pack();
          }// </editor-fold>

          /**
           * @param args the command line arguments
           */
          public static void main(String args[]) {
              /* Set the Nimbus look and feel */
              //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
              /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
               * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
               */
              try {
                  for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                      if ("Nimbus".equals(info.getName())) {
                          javax.swing.UIManager.setLookAndFeel(info.getClassName());
                          break;
                      }
                  }
              } catch (ClassNotFoundException ex) {
                  java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
              } catch (InstantiationException ex) {
                  java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
              } catch (IllegalAccessException ex) {
                  java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
              } catch (javax.swing.UnsupportedLookAndFeelException ex) {
                  java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
              }
              //</editor-fold>

              /* Create and display the form */
              java.awt.EventQueue.invokeLater(new Runnable() {
                  public void run() {
                      new NewJFrame().setVisible(true);
                  }
              });
          }

          // Variables declaration - do not modify
          private javax.swing.JButton jButton1;
          private javax.swing.JCheckBox jCheckBox1;
          private javax.swing.JCheckBox jCheckBox2;
          private javax.swing.JLabel jLabel1;
          private javax.swing.JMenu jMenu1;
          private javax.swing.JMenu jMenu2;
          private javax.swing.JMenu jMenu3;
          private javax.swing.JMenuBar jMenuBar1;
          private javax.swing.JMenuItem jMenuItem1;
          private javax.swing.JMenuItem jMenuItem2;
          private javax.swing.JMenuItem jMenuItem3;
          private javax.swing.JScrollPane jScrollPane1;
          private javax.swing.JTable jTable1;
          private javax.swing.JTextField jTextField1;
          private javax.swing.JTextField jTextField2;
          private javax.swing.JTextField jTextField3;
          // End of variables declaration
      }



      ---------- END SOURCE ----------

            serb Sergey Bylokhov
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: