javax.swing.JInternalFrame Java Examples
The following examples show how to use
javax.swing.JInternalFrame.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SeaGlassDesktopIconUI.java From seaglass with Apache License 2.0 | 6 votes |
public void propertyChange(PropertyChangeEvent evt) { if (evt.getSource() instanceof JInternalFrame.JDesktopIcon) { if (SeaGlassLookAndFeel.shouldUpdateStyle(evt)) { updateStyle((JInternalFrame.JDesktopIcon) evt.getSource()); } } else if (evt.getSource() instanceof JInternalFrame) { JInternalFrame frame = (JInternalFrame) evt.getSource(); if (iconPane instanceof JToggleButton) { JToggleButton button = (JToggleButton) iconPane; String prop = evt.getPropertyName(); if (prop == "title") { button.setText((String) evt.getNewValue()); } else if (prop == "frameIcon") { button.setIcon((Icon) evt.getNewValue()); } else if (prop == JInternalFrame.IS_ICON_PROPERTY || prop == JInternalFrame.IS_SELECTED_PROPERTY) { button.setSelected(!frame.isIcon() && frame.isSelected()); } } } }
Example #2
Source File: FrmSimulator.java From drmips with GNU General Public License v3.0 | 6 votes |
/** * Restores the specified frame's bounds from the preferences. * @param prefPrefix The prefix of the preference. * @param frame The frame. */ private void restoreFrameBounds(String prefPrefix, JInternalFrame frame) { frame.setLocation(DrMIPS.prefs.getInt(prefPrefix + "_x", 0), DrMIPS.prefs.getInt(prefPrefix + "_y", 0)); int w = DrMIPS.prefs.getInt(prefPrefix + "_w", -1); int h = DrMIPS.prefs.getInt(prefPrefix + "_h", -1); if(w > 0 && h > 0) frame.setSize(w, h); else frame.pack(); try { if(DrMIPS.prefs.getBoolean(prefPrefix + "_max", false)) frame.setMaximum(true); if(DrMIPS.prefs.getBoolean(prefPrefix + "_min", false)) frame.setIcon(true); } catch(PropertyVetoException ex) { LOG.log(Level.WARNING, "failed to maximize/minimize an internal frame"); } }
Example #3
Source File: TitlePaneMenuButtonWindowNotFocusedState.java From seaglass with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ public boolean isInState(JComponent c) { Component parent = c; while (parent.getParent() != null) { if (parent instanceof JInternalFrame) { break; } parent = parent.getParent(); } if (parent instanceof JInternalFrame) { return !(((JInternalFrame) parent).isSelected()); } return false; }
Example #4
Source File: ToolBarWindowIsActiveState.java From seaglass with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ public boolean isInState(JComponent c) { Component parent = c; while (parent.getParent() != null) { if (parent instanceof JInternalFrame || parent instanceof Window) { break; } parent = parent.getParent(); } if (parent instanceof JInternalFrame) { return ((JInternalFrame) parent).isSelected(); } else if (parent instanceof Window) { return ((Window) parent).isActive(); } // Default to true. return true; }
Example #5
Source File: WindowBuilders.java From visualvm with GNU General Public License v2.0 | 6 votes |
protected JInternalFrame createInstanceImpl() { JInternalFrame frame = new JInternalFrame(title, resizable, closable, maximizable, iconable) { protected JRootPane createRootPane() { return _rootPane == null ? null : _rootPane.createInstance(); } public void addNotify() { try { // Doesn't seem to work correctly setClosed(_isClosed); setMaximum(_isMaximum); setIcon(_isIcon); setSelected(_isSelected); } catch (PropertyVetoException ex) {} } }; return frame; }
Example #6
Source File: WindowBuilders.java From visualvm with GNU General Public License v2.0 | 6 votes |
static ComponentBuilder getBuilder(Instance instance, Heap heap) { if (DetailsUtils.isSubclassOf(instance, JRootPane.class.getName())) { return new JRootPaneBuilder(instance, heap); } else if (DetailsUtils.isSubclassOf(instance, JDesktopPane.class.getName())) { return new JDesktopPaneBuilder(instance, heap); } else if (DetailsUtils.isSubclassOf(instance, JLayeredPane.class.getName())) { return new JLayeredPaneBuilder(instance, heap); } else if (DetailsUtils.isSubclassOf(instance, Frame.class.getName())) { return new FrameBuilder(instance, heap); } else if (DetailsUtils.isSubclassOf(instance, Dialog.class.getName())) { return new DialogBuilder(instance, heap); } else if (DetailsUtils.isSubclassOf(instance, JInternalFrame.class.getName())) { return new JInternalFrameBuilder(instance, heap); } return null; }
Example #7
Source File: Test6505027.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public Test6505027(JFrame main) { Container container = main; if (INTERNAL) { JInternalFrame frame = new JInternalFrame(); frame.setBounds(OFFSET, OFFSET, WIDTH, HEIGHT); frame.setVisible(true); JDesktopPane desktop = new JDesktopPane(); desktop.add(frame, new Integer(1)); container.add(desktop); container = frame; } if (TERMINATE) { this.table.putClientProperty(KEY, Boolean.TRUE); } TableColumn column = this.table.getColumn(COLUMNS[1]); column.setCellEditor(new DefaultCellEditor(new JComboBox(ITEMS))); container.add(BorderLayout.NORTH, new JTextField()); container.add(BorderLayout.CENTER, new JScrollPane(this.table)); }
Example #8
Source File: UIUtils.java From snap-desktop with GNU General Public License v3.0 | 6 votes |
public static String getUniqueFrameTitle(final JInternalFrame[] frames, final String titleBase) { if (frames.length == 0) { return titleBase; } String[] titles = new String[frames.length]; for (int i = 0; i < frames.length; i++) { JInternalFrame frame = frames[i]; titles[i] = frame.getTitle(); } if (!ArrayUtils.isMemberOf(titleBase, titles)) { return titleBase; } for (int i = 0; i < frames.length; i++) { final String title = titleBase + " (" + (i + 2) + ")"; if (!ArrayUtils.isMemberOf(title, titles)) { return title; } } return titleBase + " (" + (frames.length + 1) + ")"; }
Example #9
Source File: InfoPanel.java From JByteMod-Beta with GNU General Public License v2.0 | 6 votes |
@Override public void setBoundsForFrame(JComponent f, int newX, int newY, int newWidth, int newHeight) { if (!(f instanceof JInternalFrame)) { return; } boolean didResize = (f.getWidth() != newWidth || f.getHeight() != newHeight); if (!inBounds((JInternalFrame) f, newX, newY, newWidth, newHeight)) { Container parent = f.getParent(); Dimension parentSize = parent.getSize(); int boundedX = (int) Math.min(Math.max(0, newX), parentSize.getWidth() - newWidth); int boundedY = (int) Math.min(Math.max(0, newY), parentSize.getHeight() - newHeight); f.setBounds(boundedX, boundedY, newWidth, newHeight); } else { f.setBounds(newX, newY, newWidth, newHeight); } if (didResize) { f.validate(); } }
Example #10
Source File: MainDesktopPane.java From mars-sim with GNU General Public License v3.0 | 6 votes |
@Override public void componentShown(ComponentEvent e) { // logger.config("componentShown()"); SwingUtilities.invokeLater(() -> { JInternalFrame[] frames = (JInternalFrame[]) this.getAllFrames(); for (JInternalFrame f : frames) { ToolWindow w = (ToolWindow) f; if (this.isVisible() || this.isShowing()) { w.update(); // f.updateUI(); // SwingUtilities.updateComponentTreeUI(f); // f.validate(); // f.repaint(); } else if (!this.isShowing() && w.getToolName().equals(NavigatorWindow.NAME)) closeToolWindow(NavigatorWindow.NAME); } }); }
Example #11
Source File: WindowsDesktopManager.java From JDKSourceCode1.8 with MIT License | 5 votes |
public void activateFrame(JInternalFrame f) { JInternalFrame currentFrame = currentFrameRef != null ? currentFrameRef.get() : null; try { super.activateFrame(f); if (currentFrame != null && f != currentFrame) { // If the current frame is maximized, transfer that // attribute to the frame being activated. if (currentFrame.isMaximum() && (f.getClientProperty("JInternalFrame.frameType") != "optionDialog") ) { //Special case. If key binding was used to select next //frame instead of minimizing the icon via the minimize //icon. if (!currentFrame.isIcon()) { currentFrame.setMaximum(false); if (f.isMaximizable()) { if (!f.isMaximum()) { f.setMaximum(true); } else if (f.isMaximum() && f.isIcon()) { f.setIcon(false); } else { f.setMaximum(false); } } } } if (currentFrame.isSelected()) { currentFrame.setSelected(false); } } if (!f.isSelected()) { f.setSelected(true); } } catch (PropertyVetoException e) {} if (f != currentFrame) { currentFrameRef = new WeakReference<JInternalFrame>(f); } }
Example #12
Source File: JInternalFrameOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code JInternalFrame.toBack()} through queue */ public void toBack() { runMapping(new MapVoidAction("toBack") { @Override public void map() { ((JInternalFrame) getSource()).toBack(); } }); }
Example #13
Source File: SeaGlassInternalFrameTitlePane.java From seaglass with Apache License 2.0 | 5 votes |
/** * Uninstall the defaults. */ public void uninstallDefaults() { SeaGlassContext context = getContext(this, ENABLED); style.uninstallDefaults(context); context.dispose(); style = null; JInternalFrame.JDesktopIcon di = frame.getDesktopIcon(); if (di != null && di.getComponentPopupMenu() == systemPopupMenu) { // Release link to systemMenu from the JInternalFrame di.setComponentPopupMenu(null); } }
Example #14
Source File: Test6657026.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { UIManager.setLookAndFeel(new MetalLookAndFeel()); ThreadGroup group = new ThreadGroup("$$$"); Thread thread = new Thread(group, new Test6657026()); thread.start(); thread.join(); new JInternalFrame().setContentPane(new JPanel()); }
Example #15
Source File: MainFrame.java From sc2gears with Apache License 2.0 | 5 votes |
/** * Selects the specified internal frame. If it is iconified, first it will be de-iconified. * @param iframe */ private void selectFrame( final JInternalFrame iframe ) { try { if ( iframe.isIcon() ) iframe.setIcon( false); iframe.setSelected( true ); } catch ( final PropertyVetoException pve) { pve.printStackTrace(); } }
Example #16
Source File: MetalworksFrame.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public void openInBox() { JInternalFrame doc = new MetalworksInBox(); desktop.add(doc, DOCLAYER); try { doc.setVisible(true); doc.setSelected(true); } catch (java.beans.PropertyVetoException e2) { } }
Example #17
Source File: JInternalFrameOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code JInternalFrame.pack()} through queue */ public void pack() { runMapping(new MapVoidAction("pack") { @Override public void map() { ((JInternalFrame) getSource()).pack(); } }); }
Example #18
Source File: MainDesktopManager.java From mars-sim with GNU General Public License v3.0 | 5 votes |
protected boolean inBounds(JInternalFrame f, int newX, int newY, int newWidth, int newHeight) { if (newX < 0 || newY < 0) return false; if (newX + newWidth > f.getDesktopPane().getWidth()) return false; if (newY + newHeight > f.getDesktopPane().getHeight()) return false; return true; }
Example #19
Source File: Test6802868.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public Test6802868(JFrame frame) { JDesktopPane desktop = new JDesktopPane(); this.frame = frame; this.frame.add(desktop); this.internal = new JInternalFrame(getClass().getName(), true, true, true, true); this.internal.setVisible(true); desktop.add(this.internal); }
Example #20
Source File: Test6657026.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { UIManager.setLookAndFeel(new MetalLookAndFeel()); ThreadGroup group = new ThreadGroup("$$$"); Thread thread = new Thread(group, new Test6657026()); thread.start(); thread.join(); new JInternalFrame().setContentPane(new JPanel()); }
Example #21
Source File: WindowsDesktopManager.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public void activateFrame(JInternalFrame f) { JInternalFrame currentFrame = currentFrameRef != null ? currentFrameRef.get() : null; try { super.activateFrame(f); if (currentFrame != null && f != currentFrame) { // If the current frame is maximized, transfer that // attribute to the frame being activated. if (currentFrame.isMaximum() && (f.getClientProperty("JInternalFrame.frameType") != "optionDialog") ) { //Special case. If key binding was used to select next //frame instead of minimizing the icon via the minimize //icon. if (!currentFrame.isIcon()) { currentFrame.setMaximum(false); if (f.isMaximizable()) { if (!f.isMaximum()) { f.setMaximum(true); } else if (f.isMaximum() && f.isIcon()) { f.setIcon(false); } else { f.setMaximum(false); } } } } if (currentFrame.isSelected()) { currentFrame.setSelected(false); } } if (!f.isSelected()) { f.setSelected(true); } } catch (PropertyVetoException e) {} if (f != currentFrame) { currentFrameRef = new WeakReference<JInternalFrame>(f); } }
Example #22
Source File: Test6802868.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public Test6802868(JFrame frame) { JDesktopPane desktop = new JDesktopPane(); this.frame = frame; this.frame.add(desktop); this.internal = new JInternalFrame(getClass().getName(), true, true, true, true); this.internal.setVisible(true); desktop.add(this.internal); }
Example #23
Source File: JInternalFrameOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps * {@code JInternalFrame.addInternalFrameListener(InternalFrameListener)} * through queue */ public void addInternalFrameListener(final InternalFrameListener internalFrameListener) { runMapping(new MapVoidAction("addInternalFrameListener") { @Override public void map() { ((JInternalFrame) getSource()).addInternalFrameListener(internalFrameListener); } }); }
Example #24
Source File: JInternalFrameOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Searches JInternalframe in container. * * @param cont Container to search component in. * @param chooser a component chooser specifying searching criteria. * @param index Ordinal component index. * @return JInternalframe instance or null if component was not found. */ public static JInternalFrame findJInternalFrame(Container cont, ComponentChooser chooser, int index) { Component res = findComponent(cont, new JInternalFrameFinder(chooser), index); if (res instanceof JInternalFrame) { return (JInternalFrame) res; } else if (res instanceof JInternalFrame.JDesktopIcon) { return ((JInternalFrame.JDesktopIcon) res).getInternalFrame(); } else { return null; } }
Example #25
Source File: Test6802868.java From hottub with GNU General Public License v2.0 | 5 votes |
public Test6802868(JFrame frame) { JDesktopPane desktop = new JDesktopPane(); this.frame = frame; this.frame.add(desktop); this.internal = new JInternalFrame(getClass().getName(), true, true, true, true); this.internal.setVisible(true); desktop.add(this.internal); }
Example #26
Source File: JavaElementPropertyAccessor.java From marathonv5 with Apache License 2.0 | 5 votes |
public String getOMapClassName() { if (component instanceof Frame || component instanceof Window || component instanceof Dialog || component instanceof JInternalFrame) { String className = component.getClass().getName(); Package pkg = component.getClass().getPackage(); if (pkg == null) { return className; } String pkgName = pkg.getName(); if (!pkgName.startsWith("javax.swing") && !pkgName.startsWith("java.awt")) { return className; } if (className.equals("javax.swing.ColorChooserDialog")) { return className; } if (component instanceof JDialog) { Component[] components = ((JDialog) component).getContentPane().getComponents(); if (components.length == 1 && components[0] instanceof JFileChooser) { return JFileChooser.class.getName() + "#Dialog"; } if (components.length == 1 && components[0] instanceof JOptionPane) { return JOptionPane.class.getName() + "#Dialog_" + ((JOptionPane) components[0]).getMessageType() + "_" + ((JOptionPane) components[0]).getOptionType(); } } return null; } return null; }
Example #27
Source File: LuckInternalFrameUI.java From littleluck with Apache License 2.0 | 5 votes |
@Override protected JComponent createNorthPane(JInternalFrame w) { titlePane = new LuckInternalFrameTitlePane(w); return titlePane; }
Example #28
Source File: JInternalFrameOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code JInternalFrame.getContentPane()} through queue */ public Container getContentPane() { return (runMapping(new MapAction<Container>("getContentPane") { @Override public Container map() { return ((JInternalFrame) getSource()).getContentPane(); } })); }
Example #29
Source File: DashBoardGUI2.java From MtgDesktopCompanion with GNU General Public License v3.0 | 5 votes |
private void initActions() { mntmSaveDisplay.addActionListener(ae -> { int i = 0; try { FileUtils.cleanDirectory(AbstractJDashlet.confdir); } catch (IOException e1) { logger.error(e1); } for (JInternalFrame jif : desktop.getAllFrames()) { i++; AbstractJDashlet dash = (AbstractJDashlet) jif; dash.setProperty("x", String.valueOf(dash.getBounds().getX())); dash.setProperty("y", String.valueOf(dash.getBounds().getY())); dash.setProperty("w", String.valueOf(dash.getBounds().getWidth())); dash.setProperty("h", String.valueOf(dash.getBounds().getHeight())); dash.setProperty("class", dash.getClass().getName()); dash.setProperty("id", String.valueOf(i)); File f = new File(AbstractJDashlet.confdir, i + ".conf"); try (FileOutputStream fos = new FileOutputStream(f)) { dash.getProperties().store(fos, ""); logger.trace("saving " + f + " :" + dash.getProperties()); } catch (IOException e) { logger.error(e); } } }); }
Example #30
Source File: JInternalFrameOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code JInternalFrame.isSelected()} through queue */ public boolean isSelected() { return (runMapping(new MapBooleanAction("isSelected") { @Override public boolean map() { return ((JInternalFrame) getSource()).isSelected(); } })); }