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

After AbstractButton.setBorderPainted(true) call button's label looks incorrectl

    XMLWordPrintable

    Details

      Description



      Name: kaC94536 Date: 01/27/2000



      After AbstractButton.setBorderPainted(true) call button's label looks incorrectly.

      Frame window of the following test contains a panel with button "change" and a JRadioButton
      component.
      By clicking on the button "change" you can invert the JButton border state.
      When the button border is painted, the border overlaps part of the button's label.

      --------------------test.java---------------------------------------------

      import javax.swing.*;
      import java.awt.*;
      import java.awt.event.*;

      public class test extends JFrame {
          public test() {
              super("JRadioButton test");
              getContentPane().add(new ButtonPanel(),BorderLayout.CENTER);
           }

          public static void main(String[] args) {
              JFrame frame = new test();
              frame.addWindowListener(new WindowAdapter() {
                  public void windowClosing(WindowEvent e) {
                      System.exit(0);
                   }
               });
              frame.pack();
              frame.setSize(new Dimension(200,100));
              frame.setVisible(true);
           }
      }

      class ButtonPanel extends JPanel implements ActionListener {
          JRadioButton jb;

          public ButtonPanel() {
              JButton b = new JButton("change");
              b.setActionCommand("check");
              b.addActionListener(this);
              add(b);
              jb = new JRadioButton();
              jb.setBorderPainted(true);
              add(jb);
           }

          public void actionPerformed(ActionEvent e) {
              if (e.getActionCommand().equals("check"))
                      jb.setBorderPainted(! jb.isBorderPainted());
           }
      }

      ======================================================================

      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              shickeysunw Shannon Hickey (Inactive)
              Reporter:
              kanisimosunw Konstantin Anisimov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: