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

widgets with beveled border don't get highlighted with a red line around then

    XMLWordPrintable

    Details

      Description

      The test case describes the problem in detail. It consists of a
       simple JFrame that holds a JPanel and on the JPanel are 3 JTextFields, 2
       JButtons, and 2 JComboBoxes.
       
       2 of the 3 JTextFields have no specific border set, the 3rd JTextField
       (jTextField3) has a lowered beveled border set on it.
       1 of the 2 JButtons has no specific border set, the second JButton
       (jButton2) has a raised beveled border set on it.
       1 of the 2 JComboBoxes has no specific border set, the second JComboBox
       has a raised beveled border set on it.

       When you navigate through the widgets using the "TAB" key, notice how
       jTextField1 and jTextField2 have a red line box around them. When you tab
       to the 3rd textfield (jTextField3) the red line box disappears. The same
      behavior exists for jButton2 and the second (rightmost) jComboBox. My
       belief here is that this is caused because the border of those widgets is
       set to beveled.

       To compile testCase.java:
       
       javac testCase.java

       To run testCase
       
       java -cp . testCase //using the "-cp ." to indicate that the classpath to
       the .class file is the current directory. This may be an option provided
       to the java interpreter that is necessary only for me and not you because
      of the way our environment is setup here. Not sure if you will need the
       -cp switch.

      testCase.java
      ==============
      import java.awt.*;
      import javax.swing.*;

      import javax.swing.border.*;
      import com.sun.java.swing.plaf.motif.*;

      public class testCase extends JFrame
      {
        JPanel jPanel1 = new JPanel();
        JTextField jTextField1 = new JTextField();
        JTextField jTextField3 = new JTextField();
        JButton jButton1 = new JButton();
        JButton jButton2 = new JButton();
        JComboBox jComboBox1 = new JComboBox();
        JComboBox jComboBox2 = new JComboBox();
        Border border1;
        Border border2;
        Border border3;
        JTextField jTextField2 = new JTextField();
        GridBagLayout gridBagLayout1 = new GridBagLayout();
        BorderLayout borderLayout1 = new BorderLayout();

        public testCase()
        {
          try
          {
            jbInit();
          }
          catch(Exception e)
          {
            e.printStackTrace();
          }
        }
        public static void main(String[] args)
        {
          try
          {
            UIManager.setLookAndFeel(new MotifLookAndFeel());
          }
          catch(Exception e)
          {}

          testCase tc = new testCase();
          tc.pack();
          tc.setVisible(true);
        }
        private void jbInit() throws Exception
        {
          border1 = BorderFactory.createBevelBorder(BevelBorder.LOWERED,new Color(248, 254, 255),Color.white,new Color(121, 124, 136),new Color(84, 86, 95));
          border2 = BorderFactory.createBevelBorder(BevelBorder.RAISED,Color.white,new Color(248, 254, 255),new Color(84, 86, 95),new Color(121, 124, 136));
          border3 = BorderFactory.createBevelBorder(BevelBorder.RAISED,Color.white,new Color(248, 254, 255),new Color(84, 86, 95),new Color(121, 124, 136));
          jPanel1.setLayout(gridBagLayout1);
          jTextField1.setText("jTextField1");
          jTextField3.setBorder(border1);
          jTextField3.setText("jTextField3");
          jButton1.setText("jButton1");
          jButton2.setBorder(border2);
          jButton2.setText("jButton2");
          jComboBox2.setBorder(border3);
          jTextField2.setText("jTextField2");
          this.getContentPane().setLayout(borderLayout1);
          this.getContentPane().add(jPanel1, BorderLayout.CENTER);
          jPanel1.add(jTextField1, new GridBagConstraints(0, 0, 3, 1, 1.0, 0.0
                  ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(32, 76, 0, 114), 137, 9));
          jPanel1.add(jTextField3, new GridBagConstraints(0, 2, 3, 1, 1.0, 0.0
                  ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(16, 82, 0, 111), 134, 16));
          jPanel1.add(jButton1, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0
                  ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(16, 25, 0, 0), 33, 12));
          jPanel1.add(jButton2, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0
                  ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(18, 0, 0, 0), 62, 27));
          jPanel1.add(jComboBox1, new GridBagConstraints(0, 4, 2, 1, 1.0, 0.0
                  ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 121, 19, 18), -18, 12));
          jPanel1.add(jComboBox2, new GridBagConstraints(2, 4, 1, 1, 1.0, 0.0
                  ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(9, 0, 19, 57), -36, 13));
          jPanel1.add(jTextField2, new GridBagConstraints(0, 1, 3, 1, 1.0, 0.0
                  ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(12, 75, 0, 104), 148, 23));
        }
      }

      I am not sure if this is a bug. But since the widgets with the beveled
      borders do not get highlighted when selected , this could be changed to
      a RFE if everything is working the way it is supposed to.
       

        Attachments

          Activity

            People

            Assignee:
            shickeysunw Shannon Hickey (Inactive)
            Reporter:
            duke J. Duke (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: