-
Bug
-
Resolution: Duplicate
-
P3
-
7
-
None
-
generic
-
generic
When an instance of JLayer is created with help of JLayer(Component) constructor,
it doesn't have a ui delegate by default and so cannot be painted on screen.
import javax.swing.*;
public class LayerTest {
private static void createGui() {
final JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// JButton is not painted
frame.add(new JLayer(new JButton("Hello")));
frame.setSize(200, 200);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
public static void main(String[] args) throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
LayerTest.createGui();
}
});
}
}
it doesn't have a ui delegate by default and so cannot be painted on screen.
import javax.swing.*;
public class LayerTest {
private static void createGui() {
final JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// JButton is not painted
frame.add(new JLayer(new JButton("Hello")));
frame.setSize(200, 200);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
public static void main(String[] args) throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
LayerTest.createGui();
}
});
}
}
- duplicates
-
JDK-6982661 Complete JLayer component
-
- Closed
-