Make a JFrame looks like a JDialog : RootPane « Swing JFC « Java






Make a JFrame looks like a JDialog

 

import java.awt.Dimension;

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

public class Main extends JFrame {

  public Main() {
    setTitle("like JDialog");
    setSize(new Dimension(500, 100));
    setUndecorated(true);
    setResizable(false);
    getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG);
    setLocationRelativeTo(null);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
  }

  public static void main(String[] args) {
    new Main().setVisible(true);
  }
}

   
  








Related examples in the same category

1.Interact directly with the JRootPane of a JFrame
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