List of utility methods to do JFrame Create
void | createAndShowDemoFrame(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);
});
|
JFrame | createApplicationFrame(String title) create Application Frame JFrame frm = new JFrame(); configToApplicationFrame(frm, title); return frm; |
JFrame | createDemoFrame(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; |
JFrame | createFrame() create Frame JFrame frame = new JFrame(); frame.setSize(400, 400); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.setTitle("Example"); return frame; |
JFrame | createFrame(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; |
JFrame | createFrame(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; |
JFrame | createFrame(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; |
JFrame | createFrame(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; ... |
JInternalFrame | createIFrame(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; |
JFrame | createImageFrame(Image image) create Image Frame JFrame ret = new JFrame(); ret.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); ret.add(createImagePanel(image, null)); ret.pack(); return ret; |