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

Swing Disabled JButton(s)

    XMLWordPrintable

    Details

      Description

      A DESCRIPTION OF THE REGRESSION :
      Swing JButton(s) when setEnabled(false) under Windows XP with the Royale theme don't render correctly.

      REPRODUCIBLE TESTCASE OR STEPS TO REPRODUCE:
      /*
       * RegressionFrame.java
       *
       * Created on February 18, 2006, 5:35 PM
       */

      package regressiontest;

      /**
       *
       * @author Daniel Spiewak
       */
      public class RegressionFrame extends javax.swing.JFrame {

      /** Creates new form RegressionFrame */
      public RegressionFrame() {
      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.
      */
          // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
          private void initComponents() {
              jLabel1 = new javax.swing.JLabel();
              jButton1 = new javax.swing.JButton();
              jLabel2 = new javax.swing.JLabel();
              jButton2 = new javax.swing.JButton();

              setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
              jLabel1.setText("This button works just fine:");

              jButton1.setText("Working Button");

              jLabel2.setText("This button doesn't work right:");

              jButton2.setText("Nonworking Button");
              jButton2.setEnabled(false);

              org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
              getContentPane().setLayout(layout);
              layout.setHorizontalGroup(
                  layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                  .add(layout.createSequentialGroup()
                      .addContainerGap()
                      .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                          .add(jLabel1)
                          .add(jLabel2))
                      .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 101, Short.MAX_VALUE)
                      .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                          .add(jButton2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                          .add(jButton1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                      .addContainerGap())
              );
              layout.setVerticalGroup(
                  layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                  .add(layout.createSequentialGroup()
                      .addContainerGap()
                      .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                          .add(jLabel1)
                          .add(jButton1))
                      .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                      .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                          .add(jLabel2)
                          .add(jButton2))
                      .addContainerGap(40, Short.MAX_VALUE))
              );
              pack();
          }// </editor-fold>

      /**
      * @param args the command line arguments
      */
      public static void main(String args[]) {
      java.awt.EventQueue.invokeLater(new Runnable() {
      public void run() {
      new RegressionFrame().setVisible(true);
      }
      });
      }

          // Variables declaration - do not modify
          private javax.swing.JButton jButton1;
          private javax.swing.JButton jButton2;
          private javax.swing.JLabel jLabel1;
          private javax.swing.JLabel jLabel2;
          // End of variables declaration

      }

      RELEASE LAST WORKED:
      5.0

      RELEASE TEST FAILS:
      mustang-b70

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The JButton should have been grayed out just as native buttons do or JButton(s) did in 5.0.
      ACTUAL -
      The JButton was whited out with a black, rectangular border.

      APPLICATION NAME: Any swing app APPLICATION VERSION: any

      OBSERVED APPLICATION IMPACT:
      Swing applications depend on fidelity to the platform, especially on Windows. This is a breach in the fidelity and really anyone who codes in Swing would be effected.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jmarinacsunw Joshua Marinacci (Inactive)
              Reporter:
              ttzhang Tao Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: