Java Utililty Methods JFrame Create

List of utility methods to do JFrame Create

Description

The list of methods to do JFrame Create are organized into topic(s).

Method

voidcreateAndShowDemoFrame(final String demoTitle, final Container demoContainer)
create And Show Demo Frame
SwingUtilities.invokeLater(() -> {
    JFrame frame = new JFrame(demoTitle);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setContentPane(demoContainer);
    frame.pack();
    frame.setVisible(true);
});
JFramecreateApplicationFrame(String title)
create Application Frame
JFrame frm = new JFrame();
configToApplicationFrame(frm, title);
return frm;
JFramecreateDemoFrame(String title)
create Demo Frame
JFrame frame = new JFrame(title);
frame.setSize(400, 320);
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation((d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2);
return frame;
JFramecreateFrame()
create Frame
JFrame frame = new JFrame();
frame.setSize(400, 400);
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setTitle("Example");
return frame;
JFramecreateFrame(Container content)
create Frame
JFrame jf = new JFrame();
jf.setContentPane(content);
jf.pack();
if (DEFAULT_FRAME_ICON != null) {
    jf.setIconImage(DEFAULT_FRAME_ICON.getImage());
return jf;
JFramecreateFrame(String str, int height, int width)
create Frame
JFrame frame = new JFrame();
frame.setSize(width, height);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setTitle(str);
return frame;
JFramecreateFrame(String title)
creates a new JFrame
JFrame frame = new JFrame(title + " (" + FRAME_ID++ + ")");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocationRelativeTo(null);
frame.setSize(500, 400);
return frame;
JFramecreateFrame(String title, JPanel panel)
create Frame
JFrame frame = new JFrame();
frame.setCursor(java.awt.Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setTitle(title);
frame.getContentPane().add(panel);
frame.pack();
frame.setVisible(true);
return frame;
...
JInternalFramecreateIFrame(String name)
create I Frame
JInternalFrame iFrame = new JInternalFrame(name, true, true, true, true);
iFrame.setBounds(0, 0, 400, 400);
iFrame.setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE);
try {
    iFrame.setSelected(true);
} catch (PropertyVetoException e1) {
    e1.printStackTrace();
iFrame.setVisible(true);
return iFrame;
JFramecreateImageFrame(Image image)
create Image Frame
JFrame ret = new JFrame();
ret.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
ret.add(createImagePanel(image, null));
ret.pack();
return ret;