List of utility methods to do JFrame Show
boolean | isShowing(JFrame f) Is the frame showing if (f == null) { return false; return f.isShowing() && (f.getState() != Frame.ICONIFIED); |
File | open(JFrame view) Creates "Open file" dialog. int fileChosen = chooser.showDialog(view, "Open file"); if (fileChosen == JFileChooser.APPROVE_OPTION) { chooser.requestFocus(); file = chooser.getSelectedFile(); return file; |
void | show(JFrame frame) Shows a frame. frame.setVisible(true); |
void | showAndSaveReportFile(JFrame frmParent, File defaultReportFile, String data) show And Save Report File JFileChooser fc = createReportFileChooser(defaultReportFile); int returnVal = fc.showSaveDialog(frmParent); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); try { FileWriter writer = new FileWriter(file); writer.write(data); writer.flush(); ... |
void | showDemoFrame(JFrame frame) Method for demo purposes. Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); frame.setSize((int) (screenSize.width / 1.5), (int) (screenSize.height / 1.5)); center(frame); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); }); ... |
void | showFrame(JFrame frame) show Frame frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); |
void | showFrame(JFrame frame, JFrame parent) show Frame frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); frame.pack(); frame.setLocation(parent.getX() + (parent.getWidth() - frame.getWidth()) / 2, parent.getY() + (parent.getHeight() - frame.getHeight()) / 2); frame.setVisible(true); |
void | showHelp(JFrame frame, String path) show Help File docRoot = new File("iTopologyManager/topologyViewer/src/main/resources/helpdocs"); File docFile = new File(docRoot, path); URI docURI = docFile.toURI(); if (!java.awt.Desktop.isDesktopSupported()) { JOptionPane.showConfirmDialog(frame, "Can not open default browser. See the documentation in: " + docURI); java.awt.Desktop desktop = java.awt.Desktop.getDesktop(); ... |
void | showModalFrame(final JFrame newFrame, final JFrame owner) show Modal Frame addToQue(owner); newFrame.setLocationRelativeTo(owner); owner.setVisible(false); owner.setEnabled(false); newFrame.setVisible(true); newFrame.toFront(); Thread t = new Thread(new Runnable() { public void run() { ... |
void | showOnScreen(int screen, JFrame frame) show On Screen GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice[] gs = ge.getScreenDevices(); if (screen >= 0 && screen < gs.length) { } else if (gs.length > 0) { } else { throw new RuntimeException("No Screens Found"); |