An example of interacting directly with the JRootPane of a JFrame : RootPane « Swing JFC « Java






An example of interacting directly with the JRootPane of a JFrame

An example of interacting directly with the JRootPane of a JFrame
 
/*
Java Swing, 2nd Edition
By Marc Loy, Robert Eckstein, Dave Wood, James Elliott, Brian Cole
ISBN: 0-596-00408-7
Publisher: O'Reilly 
*/
// RootExample.java
//An example of interacting directly with the JRootPane of a JFrame.
//

import java.awt.Container;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JRootPane;

public class RootExample {
  public static void main(String[] args) {
    JFrame f = new JFrame();
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JRootPane root = f.getRootPane(); // XXX Pay attention to these
    Container content = root.getContentPane(); // XXX lines. They get more
    content.add(new JButton("Hello")); // XXX explanation in the book.
    f.pack();
    f.setVisible(true);
  }
}

           
         
  








Related examples in the same category

1.Interact directly with the JRootPane of a JFrame
2.Make a JFrame looks like a JDialog
3.Another example of interacting with the root paneAnother example of interacting with the root pane
4.No direct interaction with JRootPaneNo direct interaction with JRootPane