public boolean mostrarJInternalFrame(JInternalFrame internalFrame) { try { desktopPane.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); int numInternalFrames = desktopPane.getAllFrames().length; if (numInternalFrames == 0) { ClassLoader cl = this.getClass().getClassLoader(); internalFrame.setFrameIcon(new javax.swing.ImageIcon(cl.getResource("img/geopista.gif"))); desktopPane.add(internalFrame); internalFrame.setMaximum(true); internalFrame.show(); try { iFrame = (JInternalFrame) internalFrame; } catch (Exception e) { iFrame = null; } } else { logger.info("cannot open another JInternalFrame"); } desktopPane.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } catch (Exception ex) { logger.warn("Exception: " + ex.toString()); } return true; }
/** * Creates a new JInternalFrame based on the contents of an existing JFrame * * @param f the JFrame that will be used to create the JInternalFrame * @param desktop the JDesktopPane that will receive the JInternalFrame, if null it only retunrs * the internal frame * @return a new JInternalFrame */ public JInternalFrame transformToInternalFrame(JFrame f, JDesktopPane desktop) { JInternalFrame jif = new JInternalFrame(f.getTitle(), true, true, true, true); if (f.getIconImage() != null) jif.setFrameIcon(new ImageIcon(f.getIconImage())); if (desktop != null) desktop.add(jif); jif.setSize(f.getSize()); jif.setContentPane(f.getContentPane()); if (desktop != null) SwingUtilities.convertPointFromScreen(f.getLocation(), desktop); jif.setLocation(new Point(0, 0)); jif.setBounds(f.getBounds()); f.dispose(); jif.setVisible(true); return (jif); }
private void configureMyJInternalFrame() { ImageIcon icon = new ImageIcon(GuiMain.getJBossIcon()); Component component = jconsolePanel; while (component != null) { component = component.getParent(); if (component instanceof JInternalFrame) { JInternalFrame frame = (JInternalFrame) component; frame.setFrameIcon(icon); return; } } }
public JInternalFrame employeeFrame() { JInternalFrame f = new JInternalFrame(); f = new JInternalFrame( "Employee Database", false, // Resizable true, // Closable true, // Maximizable true); // Iconifiable f.setLayout(new BorderLayout()); JScrollPane sp = new JScrollPane(employeeTable()); sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); sp.setBorder(BorderFactory.createTitledBorder("Employees")); f.add(buttonPanel(false), BorderLayout.NORTH); f.add(sp); // f.setLocation(loc); f.setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE); f.setFrameIcon(images.loadImage("Images/menubar/database_icon.png")); f.addInternalFrameListener(this); if (osp.isLowResolution()) f.setSize(550, 282); else if (osp.isMidResolution()) f.setSize(550, 282); else f.setSize(850, 500); // Width, Height f.setVisible(true); try { f.setSelected(true); } catch (PropertyVetoException e1) { e1.printStackTrace(); } return f; }
public static void init( JInternalFrame comp, Thing thing, Container parent, ActionContext actionContext) { JComponentCreator.init(comp, thing, parent, actionContext); String title = JavaCreator.createText(thing, "title", actionContext); if (title != null) { comp.setTitle(title); } Boolean closable = JavaCreator.createBoolean(thing, "closable"); if (closable != null) { comp.setClosable(closable); } Boolean closed = JavaCreator.createBoolean(thing, "closed"); if (closed != null) { try { comp.setClosed(closed); } catch (PropertyVetoException e) { e.printStackTrace(); } } Cursor cursor = AwtCreator.createCursor(thing, "cursor", actionContext); if (cursor != null) { comp.setCursor(cursor); } Integer defaultCloseOperation = null; String d = thing.getString("defaultCloseOperation"); if ("DO_NOTHING_ON_CLOSE".equals(d)) { defaultCloseOperation = JInternalFrame.DO_NOTHING_ON_CLOSE; } else if ("HIDE_ON_CLOSE".equals(d)) { defaultCloseOperation = JInternalFrame.HIDE_ON_CLOSE; } else if ("DISPOSE_ON_CLOSE".equals(d)) { defaultCloseOperation = JInternalFrame.DISPOSE_ON_CLOSE; } if (defaultCloseOperation != null) { comp.setDefaultCloseOperation(defaultCloseOperation); } Boolean focusCycleRoot = JavaCreator.createBoolean(thing, "focusCycleRoot"); if (focusCycleRoot != null) { comp.setFocusCycleRoot(focusCycleRoot); } Icon frameIcon = SwingCreator.createIcon(thing, "frameIcon", actionContext); if (frameIcon != null) { comp.setFrameIcon(frameIcon); } Boolean setIcon = JavaCreator.createBoolean(thing, "setIcon"); if (setIcon != null) { try { comp.setIcon(setIcon); } catch (PropertyVetoException e) { e.printStackTrace(); } } Boolean iconifiable = JavaCreator.createBoolean(thing, "iconifiable"); if (iconifiable != null) { comp.setIconifiable(iconifiable); } Integer layer = JavaCreator.createInteger(thing, "layer"); if (layer != null) { comp.setLayer(layer); } Boolean maximizable = JavaCreator.createBoolean(thing, "maximizable"); if (maximizable != null) { comp.setMaximizable(maximizable); } Boolean maximum = JavaCreator.createBoolean(thing, "maximum"); if (maximum != null) { try { comp.setMaximum(maximum); } catch (PropertyVetoException e) { e.printStackTrace(); } } Boolean resizable = JavaCreator.createBoolean(thing, "resizable"); if (resizable != null) { comp.setResizable(resizable); } Boolean selected = JavaCreator.createBoolean(thing, "selected"); if (selected != null) { try { comp.setSelected(selected); } catch (PropertyVetoException e) { e.printStackTrace(); } } }
private void configureControl() { internalFrame.setTitle(getPageComponent().getTitle()); internalFrame.setFrameIcon(getPageComponent().getIcon()); }
// REVISAR: No parece necesario evitar el JInternalFrame // public void addInternalFrame(final TaskComponent internalFrame, public void addInternalFrame( final JInternalFrame internalFrame, boolean alwaysOnTop, boolean autoUpdateToolBar) { if (internalFrame instanceof LayerManagerProxy) { setClosingBehaviour((LayerManagerProxy) internalFrame); installTitleBarModifiedIndicator((LayerManagerProxy) internalFrame); } // <<TODO:IMPROVE>> Listen for when the frame closes, and when it does, // activate the topmost frame. Because Swing does not seem to do this // automatically. [Jon Aquino] internalFrame.setFrameIcon(icon); // Call JInternalFrame#setVisible before JDesktopPane#add; otherwise, // the // TreeLayerNamePanel starts too narrow (100 pixels or so) for some // reason. // <<TODO>>Investigate. [Jon Aquino] internalFrame.setVisible(true); desktopPane.add( (Component) internalFrame, alwaysOnTop ? JLayeredPane.PALETTE_LAYER : JLayeredPane.DEFAULT_LAYER); if (autoUpdateToolBar) { internalFrame.addInternalFrameListener( new InternalFrameListener() { public void internalFrameActivated(InternalFrameEvent e) { toolBar.updateEnabledState(); // Associate current cursortool with the new frame [Jon // Aquino] toolBar.reClickSelectedCursorToolButton(); } public void internalFrameClosed(InternalFrameEvent e) { toolBar.updateEnabledState(); } public void internalFrameClosing(InternalFrameEvent e) { toolBar.updateEnabledState(); } public void internalFrameDeactivated(InternalFrameEvent e) { toolBar.updateEnabledState(); } public void internalFrameDeiconified(InternalFrameEvent e) { toolBar.updateEnabledState(); } public void internalFrameIconified(InternalFrameEvent e) { toolBar.updateEnabledState(); } public void internalFrameOpened(InternalFrameEvent e) { toolBar.updateEnabledState(); } }); // Call #activateFrame *after* adding the listener. [Jon Aquino] activateFrame(internalFrame); position(internalFrame); } }