Interact directly with the JRootPane of a JFrame : RootPane « Swing JFC « Java






Interact 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 Main {

  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.Make a JFrame looks like a JDialog
2.An example of interacting directly with the JRootPane of a JFrameAn example of interacting directly with the JRootPane of a JFrame
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