-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.2.2
-
x86
-
linux
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());
}
}
======================================================================
======================================================================
- duplicates
-
JDK-4380543 setMargin() does not work for AbstractButton
- Closed
- relates to
-
JDK-4337226 JTextArea preferredSize function causes rendering problems
- Closed