public JMFrame(Player player, String title) { super(title, true, true, true, true); getContentPane().setLayout( new BorderLayout() ); setSize(320, 10); setLocation(50, 50); setVisible(true); mplayer = player; mplayer.addControllerListener((ControllerListener) this); mplayer.realize(); addInternalFrameListener( new InternalFrameAdapter() { public void internalFrameClosing(InternalFrameEvent ife) { mplayer.close(); } } ); }
/** * constructs a new internal frame that knows about its parent. * * @param parent the parent frame * @param title the title of the frame */ public ChildFrameMDI(Main parent, String title) { super(title, true, true, true, true); m_Parent = parent; addInternalFrameListener(new InternalFrameAdapter() { @Override public void internalFrameActivated(InternalFrameEvent e) { // update title of parent if (getParentFrame() != null) { getParentFrame().createTitle(getTitle()); } } }); // add to parent if (getParentFrame() != null) { getParentFrame().addChildFrame(this); getParentFrame().jDesktopPane.add(this); } }
private void initialize() { this.setSize(new Dimension(780, 530)); //this.setPreferredSize(new Dimension(780, 550)); this.setName("mframe"); //$NON-NLS-1$ this.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); this.addInternalFrameListener(new InternalFrameAdapter(){ public void internalFrameClosing(InternalFrameEvent e){ handleClose(); } }); this.setContentPane(getJContentPane()); Dimension screen = getToolkit().getScreenSize(); this.setLocation((screen.width - getSize().width) / 2, (screen.height - getSize().height) / 2); this.pack(); panelStack = new Stack<String>(); showPanel("blankPanel"); //$NON-NLS-1$ }
private void novo() { if ( validaPeriodo() ) { Container cont = getContentPane(); while ( true ) { if ( cont instanceof FPrincipal ) break; cont = cont.getParent(); } if ( ! ( (FPrincipal) cont ).temTela( "FSubLanca" ) ) { FSubLanca form = new FSubLanca( null, sCodPlan, dIniLanca, dFimLanca ); ( (FPrincipal) cont ).criatela( "FSubLanca", form, con ); form.addInternalFrameListener( new InternalFrameAdapter() { public void internalFrameClosed( InternalFrameEvent ievt ) { adicLanca( ( (FSubLanca) ievt.getSource() ).getValores() ); } } ); } } }
private void novoLanca() { String planejamento = getPlanejamentoVendedor(); if ( planejamento == null ) { Funcoes.mensagemInforma( this, "Não foi encontrado planejamento do vendedor." ); return; } if ( !Aplicativo.telaPrincipal.temTela( FSubLanca.class.getName() ) ) { FSubLanca form = new FSubLanca( null, planejamento, txtDataIniRedeber.getVlrDate(), txtDataFimReceber.getVlrDate() ); Aplicativo.telaPrincipal.criatela( "FSubLanca", form, con ); form.addInternalFrameListener( new InternalFrameAdapter() { public void internalFrameClosed( InternalFrameEvent ievt ) { carregaFechamento(); } } ); } }
private void abreRma() { Container cont = getContentPane(); while ( true ) { if ( cont instanceof FPrincipal ) break; cont = cont.getParent(); } int iRma = ( (Integer) tabRMA.getValor( tabRMA.getLinhaSel(), 1 ) ).intValue(); if ( !((FPrincipal) cont ).temTela( "Requisição de material" ) ) { FRma tela = new FRma(); fPrim.criatela( "Requisição de material", tela, con ); tela.exec( iRma ); tela.addInternalFrameListener( new InternalFrameAdapter() { public void internalFrameClosed( InternalFrameEvent ievt ) { lcCampos.carregaDados(); desabilitaBtFinaliza(); } } ); } }
/** Create a new internal frame */ private JInternalFrame createFrame(final AbstractForm form) { final JInternalFrame frame = new JInternalFrame(); frame.setTitle(form.getTitle()); frame.setClosable(true); frame.setIconifiable(true); frame.setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE); frame.addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameClosed(InternalFrameEvent e) { smartDesktopRequestFocus(); // see note form.dispose(); } }); frame.setContentPane(form); return frame; }
public QueryBuilderInternalFrame(QueryBuilderTableModel queryBuilderTableModel, QueryBuilder queryBuilder) { _dragObject = null; // Set some private variables _queryBuilderTableModel = queryBuilderTableModel; _queryBuilder = queryBuilder; // Create the node that will be used for the property sheet _node = new TableNode(queryBuilderTableModel.getFullTableName(), queryBuilderTableModel.getCorrName(), _queryBuilder); setResizable(true); setFrameIcon(null); setIconifiable(false); // Add an anonymous listener for the internalFrameOpened event addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameOpened(InternalFrameEvent e) { // As soon as a frame is opened select it. // This doesn't seem to work. try { QueryBuilderInternalFrame.this.setSelected(true); } catch(PropertyVetoException pve) { } }}); this.setBackground(Color.white); }
/** * Initialize. */ private void initialize() { this.setClosable(true); this.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)); this.setVisible(true); this.registerEscapeKeyStroke(); this.addInternalFrameListener(new InternalFrameAdapter() { /* (non-Javadoc) * @see javax.swing.event.InternalFrameAdapter#internalFrameClosing(javax.swing.event.InternalFrameEvent) */ @Override public void internalFrameClosing(InternalFrameEvent ife) { projectWindow.tabRestore(); super.internalFrameClosing(ife); } /* (non-Javadoc) * @see javax.swing.event.InternalFrameAdapter#internalFrameDeactivated(javax.swing.event.InternalFrameEvent) */ @Override public void internalFrameDeactivated(InternalFrameEvent e) { // projectWindow.tabRestore(); super.internalFrameDeactivated(e); } }); ((BasicInternalFrameUI) this.getUI()).setNorthPane(null); // --- Add ComponentListener to MainWindow -------- this.addComponentListenerOfMainWindow(); }
/** * This method initializes this * @return void */ private void initialize() { this.setAutoscrolls(true); this.setMaximizable(true); this.setResizable(true); this.setIconifiable(true); this.setClosable(true); this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); this.setTitle("Component"); // --- Remove Frame menu ---------------- BasicInternalFrameUI ui = (BasicInternalFrameUI)this.getUI(); ui.getNorthPane().remove(0); this.addInternalFrameListener(new InternalFrameAdapter() { @Override public void internalFrameClosing(InternalFrameEvent ife) { doClose(); } }); this.configureForGraphObject(); this.setContentPane(this.getJContentPane()); this.setSize(this.defaultWidth, this.defaultHeight); this.setInitialSizeAndPosition(); // --- Call to the super-class ---------- this.registerAtDesktopAndSetVisible(); }
/** * Iconifies or de-iconifies this internal frame, * if the look and feel supports iconification. * If the internal frame's state changes to iconified, * this method fires an <code>INTERNAL_FRAME_ICONIFIED</code> event. * If the state changes to de-iconified, * an <code>INTERNAL_FRAME_DEICONIFIED</code> event is fired. * * @param b a boolean, where <code>true</code> means to iconify this internal frame and * <code>false</code> means to de-iconify it * @exception PropertyVetoException when the attempt to set the * property is vetoed by the <code>JInternalFrame</code> * * @see InternalFrameEvent#INTERNAL_FRAME_ICONIFIED * @see InternalFrameEvent#INTERNAL_FRAME_DEICONIFIED * * @beaninfo * bound: true * constrained: true * description: The image displayed when this internal frame is minimized. */ public void setIcon(boolean b) throws PropertyVetoException { if (isIcon == b) { return; } /* If an internal frame is being iconified before it has a parent, (e.g., client wants it to start iconic), create the parent if possible so that we can place the icon in its proper place on the desktop. I am not sure the call to validate() is necessary, since we are not going to display this frame yet */ firePropertyChange("ancestor", null, getParent()); Boolean oldValue = isIcon ? Boolean.TRUE : Boolean.FALSE; Boolean newValue = b ? Boolean.TRUE : Boolean.FALSE; fireVetoableChange(IS_ICON_PROPERTY, oldValue, newValue); isIcon = b; firePropertyChange(IS_ICON_PROPERTY, oldValue, newValue); if (b) fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_ICONIFIED); else fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_DEICONIFIED); }
/** * Iconifies or de-iconifies this internal frame, * if the look and feel supports iconification. * If the internal frame's state changes to iconified, * this method fires an <code>INTERNAL_FRAME_ICONIFIED</code> event. * If the state changes to de-iconified, * an <code>INTERNAL_FRAME_DEICONIFIED</code> event is fired. * * @param b a boolean, where <code>true</code> means to iconify this internal frame and * <code>false</code> means to de-iconify it * @exception PropertyVetoException when the attempt to set the * property is vetoed by the <code>JInternalFrame</code> * * @see InternalFrameEvent#INTERNAL_FRAME_ICONIFIED * @see InternalFrameEvent#INTERNAL_FRAME_DEICONIFIED */ @BeanProperty(description = "The image displayed when this internal frame is minimized.") public void setIcon(boolean b) throws PropertyVetoException { if (isIcon == b) { return; } /* If an internal frame is being iconified before it has a parent, (e.g., client wants it to start iconic), create the parent if possible so that we can place the icon in its proper place on the desktop. I am not sure the call to validate() is necessary, since we are not going to display this frame yet */ firePropertyChange("ancestor", null, getParent()); Boolean oldValue = isIcon ? Boolean.TRUE : Boolean.FALSE; Boolean newValue = b ? Boolean.TRUE : Boolean.FALSE; fireVetoableChange(IS_ICON_PROPERTY, oldValue, newValue); isIcon = b; firePropertyChange(IS_ICON_PROPERTY, oldValue, newValue); if (b) fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_ICONIFIED); else fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_DEICONIFIED); }
/** * Creates new form FrequenciesByYearInternalFrame * * @param dtp */ public FrequenciesByYearInternalFrame(JDesktopPane dtp) { this.dtp = dtp; dictionary = CanRegClientApp.getApplication().getDictionary(); initComponents(); initOtherComponents(); localSettings = CanRegClientApp.getApplication().getLocalSettings(); addInternalFrameListener(new InternalFrameAdapter() { @Override public void internalFrameClosing(InternalFrameEvent e) { close(); } }); }
private void initialize() { this.setSize(new java.awt.Dimension(780,550)); this.setContentPane(getJContentPane()); this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); this.addInternalFrameListener(new InternalFrameAdapter(){ public void internalFrameClosing(InternalFrameEvent e){ handleClose(); } }); Dimension screen = getToolkit().getScreenSize(); this.setLocation((screen.width - getSize().width) / 2, (screen.height - getSize().height) / 2); }
public void setPrimeiroFoco(final JComponent comp) { addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameActivated(InternalFrameEvent ievt) { comp.requestFocusInWindow(); } }); }
public void show() { if (isVisible()) { return; } if (!opened) { fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_OPENED); opened = true; } getDesktopIcon().setVisible(true); toFront(); super.show(); }
/** * This method makes this JInternalFrame invisible, unselected and closed. * If this JInternalFrame is not closed already, it will fire an * INTERNAL_FRAME_CLoSED event. This method is similar to setClosed but it * doesn't give vetoable listeners a chance to veto and it will not fire an * INTERNAL_FRAME_CLOSING event. */ public void dispose() { if (isVisible()) setVisible(false); if (isSelected()) { try { setSelected(false); } catch (PropertyVetoException e) { // Do nothing if they don't want to be unselected. } } if (! isClosed) { firePropertyChange(IS_CLOSED_PROPERTY, Boolean.FALSE, Boolean.TRUE); isClosed = true; } fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_CLOSED); }
/** * This method sets whether this JInternalFrame is the selected frame in the * JDesktopPane (or other container). When selected, a JInternalFrame will * have focus and paint its TitlePane differently (usually a different * colour). If this method selects the frame, this JInternalFrame will fire * an INTERNAL_FRAME_ACTIVATED event. If it deselects this frame, it will * fire an INTERNAL_FRAME_DEACTIVATED event. * * @param selected Whether this JInternalFrame will become selected or * deselected. * * @throws PropertyVetoException If a VetoableChangeListener vetoes the change. */ public void setSelected(boolean selected) throws PropertyVetoException { if (selected != isSelected && (! selected || (isIcon ? desktopIcon.isShowing() : isShowing()))) { fireVetoableChange(IS_SELECTED_PROPERTY, isSelected, selected); if (! selected) defaultFocus = getMostRecentFocusOwner(); isSelected = selected; firePropertyChange(IS_SELECTED_PROPERTY, ! isSelected, isSelected); if (isSelected) fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_ACTIVATED); else fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_DEACTIVATED); if (selected) restoreSubcomponentFocus(); repaint(); } }
public void internalFrameActivated(InternalFrameEvent ife) { Object source = (Object)(ife.getSource()); // When any internal frame is activated, enable these two listeners? // _apifa.setEnabled(true); // _acifa.setEnabled(true); // Finally, bring up property sheet. Ignore event, just check which frame is selected. QueryBuilderInternalFrame currentSelectedFrame = (QueryBuilderInternalFrame)_desktopPane.getSelectedFrame(); setActivatedNode( currentSelectedFrame ) ; }
public void internalFrameActivated(InternalFrameEvent e) { super.internalFrameActivated(e); initTimeField(); initGysField(); initPiaoHao(); initSpBox(); }
public void internalFrameActivated(InternalFrameEvent e) { super.internalFrameActivated(e); initTimeField(); initKehuField(); initPiaoHao(); initSpBox(); }
/** * If the internal frame is not visible, * brings the internal frame to the front, * makes it visible, * and attempts to select it. * The first time the internal frame is made visible, * this method also fires an <code>INTERNAL_FRAME_OPENED</code> event. * This method does nothing if the internal frame is already visible. * Invoking this method * has the same result as invoking * <code>setVisible(true)</code>. * * @see #moveToFront * @see #setSelected * @see InternalFrameEvent#INTERNAL_FRAME_OPENED * @see #setVisible */ public void show() { // bug 4312922 if (isVisible()) { //match the behavior of setVisible(true): do nothing return; } // bug 4149505 if (!opened) { fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_OPENED); opened = true; } /* icon default visibility is false; set it to true so that it shows up when user iconifies frame */ getDesktopIcon().setVisible(true); toFront(); super.show(); if (isIcon) { return; } if (!isSelected()) { try { setSelected(true); } catch (PropertyVetoException pve) {} } }
/** * Post a WINDOW_CLOSING-like event to the frame, so that it can * be treated like a regular Frame. */ protected void postClosingEvent(JInternalFrame frame) { InternalFrameEvent e = new InternalFrameEvent( frame, InternalFrameEvent.INTERNAL_FRAME_CLOSING); // Try posting event, unless there's a SecurityManager. try { Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(e); } catch (SecurityException se) { frame.dispatchEvent(e); } }
/** * If the internal frame is not visible, * brings the internal frame to the front, * makes it visible, * and attempts to select it. * The first time the internal frame is made visible, * this method also fires an <code>INTERNAL_FRAME_OPENED</code> event. * This method does nothing if the internal frame is already visible. * Invoking this method * has the same result as invoking * <code>setVisible(true)</code>. * * @see #moveToFront * @see #setSelected * @see InternalFrameEvent#INTERNAL_FRAME_OPENED * @see #setVisible */ @SuppressWarnings("deprecation") public void show() { // bug 4312922 if (isVisible()) { //match the behavior of setVisible(true): do nothing return; } // bug 4149505 if (!opened) { fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_OPENED); opened = true; } /* icon default visibility is false; set it to true so that it shows up when user iconifies frame */ getDesktopIcon().setVisible(true); toFront(); super.show(); if (isIcon) { return; } if (!isSelected()) { try { setSelected(true); } catch (PropertyVetoException pve) {} } }
/** * Post a WINDOW_CLOSING-like event to the frame, so that it can * be treated like a regular {@code Frame}. * * @param frame an instance of {@code JInternalFrame} */ protected void postClosingEvent(JInternalFrame frame) { InternalFrameEvent e = new InternalFrameEvent( frame, InternalFrameEvent.INTERNAL_FRAME_CLOSING); // Try posting event, unless there's a SecurityManager. try { Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(e); } catch (SecurityException se) { frame.dispatchEvent(e); } }
@Override public void internalFrameActivated( InternalFrameEvent e ) { jtb.removeAll(); if ( e.getInternalFrame() instanceof PlaySheetFrame ) { PlaySheetFrame.class.cast( e.getInternalFrame() ).populateToolbar( jtb ); } jtb.revalidate(); }
@Override public void stateChanged( ChangeEvent e ) { JDesktopPane desktop = DIHelper.getInstance().getDesktop(); JInternalFrame jif = desktop.getSelectedFrame(); if ( null != jif ) { internalFrameActivated( new InternalFrameEvent( jif, 0 ) ); } }