Name: skT88420 Date: 06/04/99
If BorderFactory.createTitledBorder() is used to create a border under JDK1.2.2 and the DEFAULT_JUSTIFICATION and DEFAULT_POSITION constants are used to specify the location of the title, the border is drawn underneath the label. There should not be a border under the label text.
The following code demonstrates the problem. This worked properly in 1.2.1.
import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
public class BorderTest extends JPanel
{
public BorderTest()
{
setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createTitledBorder(
BorderFactory.createEtchedBorder(), "There Should Not Be a Border Underneath This Text!",
TitledBorder.DEFAULT_JUSTIFICATION,
TitledBorder.DEFAULT_POSITION,
new Font("Helvetica", Font.PLAIN, 12)),
BorderFactory.createEmptyBorder(5, 5, 5, 5)));
}
public static void main(String[] args)
{
JFrame f = new JFrame("Border Test");
Container c = f.getContentPane();
c.setLayout(new BorderLayout());
c.add(new BorderTest(), "Center");
f.setBounds(20, 20, 500, 400);
f.setVisible(true);
}
}
(Review ID: 83961)
======================================================================