List of utility methods to do JFrame Parent
Frame | getRootFrame() get Root Frame if (frame == null) { frame = new Frame(); frame.setSize(Toolkit.getDefaultToolkit().getScreenSize()); positionCenterScreen(frame); return frame; |
JFrame | getRootFrame(Component aComp) get Root Frame Component lParent = aComp; while (lParent != null && !(lParent instanceof JFrame)) { lParent = lParent.getParent(); if (lParent != null && lParent instanceof JFrame) { return (JFrame) lParent; return null; ... |
Frame | getRootFrame(Component c) Get the root frame of any component if (c != null) { Window window = SwingUtilities.getWindowAncestor(c); if (window instanceof Frame) { return (Frame) window; } else if (window instanceof Dialog) { Dialog dialog = (Dialog) window; return getRootFrame(dialog.getOwner()); return getPhonyFrame(); |
java.awt.Frame | getRootFrame(java.awt.Component c) get Root Frame java.awt.Component root = javax.swing.SwingUtilities.getRoot(c); if (root instanceof java.awt.Frame) { return (java.awt.Frame) root; } else { return null; |
Frame | getRootFrame(JComponent component) get Root Frame Component c = component; while (!(c instanceof Frame)) c = c.getParent(); return ((Frame) c); |
void | getSpssInstallationDirectory(Frame parent) get Spss Installation Directory JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogTitle("Set IBM SPSS directory"); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.setMultiSelectionEnabled(false); fileChooser.showOpenDialog(null); System.out.println(fileChooser.getSelectedFile().getPath()); |
void | installOperation(final RootPaneContainer frame, final int condition, final KeyStroke keyStroke, final String actionKey, Action action) Installs a keybind in the specified frame for the specified action. JRootPane root = frame.getRootPane(); root.getInputMap(condition).put(keyStroke, actionKey); root.getActionMap().put(actionKey, action); |
Boolean | isFrameModified(RootPaneContainer frame) is Frame Modified synchronized (frame) { JRootPane rootPane = frame.getRootPane(); Object obj = rootPane.getClientProperty(WINDOW_MODIFIED); if (obj == null || !(obj instanceof Boolean)) { return Boolean.FALSE; return (Boolean) obj; |
boolean | okToWriteFile(Frame parent, String fileName) ok To Write File File f = new File(fileName); if (f.isDirectory()) { JOptionPane.showMessageDialog(parent, fileName + " is a directory.", "Error!", JOptionPane.ERROR_MESSAGE); return false; } else if (f.exists()) { int saveAnswer = JOptionPane.showConfirmDialog(parent, "File " + fileName + " already exists.\nDo you want to overwrite?", "Question", ... |
void | oops(Frame parent, String s) Oops message. JOptionPane.showMessageDialog(parent, s, "Oops", JOptionPane.INFORMATION_MESSAGE);
|