JRootPane: getContentPane() : JRootPane « javax.swing « Java by API






JRootPane: getContentPane()

 
import java.awt.Container;

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

public class MainClass {
  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 examples in the same category

1.JRootPane.FRAME
2.JRootPane: addAncestorListener(AncestorListener listener)
3.JRootPane: getAccessibleContext()
4.JRootPane: setDefaultButton(JButton defaultButton)
5.JRootPane: setWindowDecorationStyle(int style)