|
How to interact directly with the JRootPane of a JFrame |
|
|
This Java Swing tip illustrates a method of interacting directly with the
JRootPane of a JFrame. JRootPane is a lightweight container used behind
the scenes by JFrame, JDialog, JWindow, JApplet, and JInternalFrame.
import java.awt.*;
import javax.swing.*;
public class RootExample {
public static void main(String[] args) {
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JRootPane root = f.getRootPane();
Container content = root.getContentPane();
content.add(new JButton("Hello"));
f.pack();
f.setVisible(true);
}
}
|
Related Tips
|
Page 1 of 0 ( 0 comments )
You can share your information about this topic using the form below!
Please do not post your questions with this form! Thanks.