-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.1.4
-
x86
-
windows_nt
Name: rm29839 Date: 11/06/97
1. Write the following program:
2.
package weblogic.buildmonkey;
/**
* @author Copyright (c) 1997 by WebLogic, Inc. All Rights Reserved.
*/
import com.sun.java.swing.*;
import com.sun.java.swing.border.EmptyBorder;
import java.awt.*;
import java.awt.event.*;
public class BuildMonkeyClient {
JFrame frame;
public BuildMonkeyClient() {
frame = new JFrame("TEST");
JPanel p = new JPanel(new BorderLayout());
JLabel bms = new JLabel("BuildMonkey sez ...");
bms.setForeground(Color.red);
bms.setFont(new Font("Courier", Font.BOLD, 18));
bms.setBorder(new EmptyBorder(20, 20, 20, 20));
// *** These lines are the workaround. ***
//Dimension d = bms.getPreferredSize();
//Insets ins = bms.getInsets();
//d.width += ins.left + ins.right;
//d.height += ins.top + ins.bottom;
//bms.setPreferredSize(d);
p.add("North", bms);
JPanel infoPanel = new JPanel(new GridLayout(2,2));
infoPanel.add(new JLabel("Last good build:"));
infoPanel.add(new JLabel("<unknown>"));
infoPanel.add(new JLabel("Last change:"));
infoPanel.add(new JLabel("<unknown>"));
p.add("Center", infoPanel);
frame.getContentPane().add(p);
frame.pack();
frame.pack();
frame.show();
System.out.println("size = " + bms.getBounds());
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent evt) {
frame.dispose();
}
public void windowClosed(WindowEvent evt) {
System.exit(0);
}
});
}
public static void main(String[] argv) {
new BuildMonkeyClient();
}
}
3 & 4. No error message; no trace. But when you
run this program the label "BuildMonkey sez ..."
gets squashed so that the "sez" doesn't show up.
If you don't setBorder() and the label it works
fine. Or, if you uncomment the workaround code
it works. But that doesn't seem like something
one should have to do by hand.
(Review ID: 19050)
======================================================================
- duplicates
-
JDK-4092928 border property fails on JLabel
-
- Closed
-