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(); } } ); }
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; }
/** * 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 addGame(String title,GameData gameData) { if (editor!=null) { closeGame(); } editor = new RealmGameEditor(this,title,gameData); editor.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); editor.addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameClosing(InternalFrameEvent e) { closeGame(); } }); desktop.add(editor); editor.setVisible(true); try { editor.setSelected(true); editor.setMaximum(true); } catch(PropertyVetoException ex) { ex.printStackTrace(); } }
/** * 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() { 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); } }
/** * Creates new form InnerWindow */ public InnerWindowImpl() { initComponents(); this.setVisible(true); this.setMaximizable(true); this.setResizable(true); this.setClosable(true); this.setFocusable(true); this.setTitle("New File"); TextLineNumber tln = new TextLineNumber(textPane); scrollPane.setRowHeaderView(tln); this.addInternalFrameListener(new InternalFrameAdapter(){ @Override public void internalFrameActivated(InternalFrameEvent e){ textPane.requestFocusInWindow(); } }); }
public void testPostClosingEvent() { class MyInternalFrameAdapter extends InternalFrameAdapter { boolean ok = false; @Override public void internalFrameClosing(final InternalFrameEvent e) { ok = true; } } MyInternalFrameAdapter listener = new MyInternalFrameAdapter(); frame.addInternalFrameListener(listener); pane.postClosingEvent(frame); if (isHarmony()) { assertTrue("event ok", listener.ok); } }
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(); }
/** * 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); }
/** * ToDo: This is ugly as fuck. The plot shouldn't create internal frames. */ @Override public void init() { internalFrame = new JEFrame("Plot: " + plotName); BasicResourceLoader loader = BasicResourceLoader.getInstance(); byte[] bytes = loader.getBytesFromResourceLocation(EvAInfo.iconLocation, true); buttonPanel = new JPanel(); plotArea = new FunctionArea(xAxisText, yAxisText); buttonPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10)); installButtons(buttonPanel); internalFrame.add(buttonPanel, BorderLayout.PAGE_END); internalFrame.add(plotArea, BorderLayout.CENTER); // north was not so nice internalFrame.addInternalFrameListener(new InternalFrameAdapter() { @Override public void internalFrameClosing(InternalFrameEvent e) { super.internalFrameClosing(e); plotArea.clearAll(); // this was a memory leak plotArea = null; internalFrame.dispose(); } }); internalFrame.pack(); internalFrame.setVisible(true); }
public void setPrimeiroFoco(final JComponent comp) { addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameActivated(InternalFrameEvent ievt) { comp.requestFocusInWindow(); } }); }
public LobbyFrame(ArcanistCCGFrame f, ServerThread st) { super("Lobby", true, //resizable true, //closable false, //maximizable false); //iconifiable this.setFrameIcon(null); frame = f; serverThread = st; int width = 440, height = 200; listenPanel = new ServerListenPanel(serverThread); listenPanel.addActionListener(this); serverThread.addServerProtocolListener(listenPanel); ServerPlayerInfo[] spsArray = st.getPlayerStates(); listenPanel.setPlayers(spsArray); this.addInternalFrameListener(new InternalFrameAdapter() { @Override public void internalFrameClosing(InternalFrameEvent e) { if (serverThread.getConnectionManager().isRunning()) { serverThread.getConnectionManager().enqueueAction(ServerConnectionManager.ACTION_STOP_ACCEPTING, null); } } }); this.setContentPane(listenPanel); frame.getDesktop().add(this); this.reshape(frame.getDesktop().getSize().width/2-width/2, frame.getDesktop().getSize().height/2-height/2, width, height); this.show(); }
/** * Constructs and shows the window. * The global ChatPanel will be removed from the JumboView, and added here. */ public ChatFrame(ArcanistCCGFrame f) { super("Chat", true, //resizable true, //closable true, //maximizable false); //iconifiable this.setFrameIcon(null); if (Prefs.usePaletteFrames) this.putClientProperty("JInternalFrame.isPalette", Boolean.TRUE); frame = f; int width = 325, height = 300; if (frame.getChatPanel() == null) return; if (frame.getJumboFrame() != null) { //if for some reason, it's not docked there, nothing bad will happen frame.getJumboFrame().removeDockableChild(frame.getChatPanel()); } addDockableChild(frame.getChatPanel()); this.addInternalFrameListener(new InternalFrameAdapter() { @Override public void internalFrameClosing(InternalFrameEvent e) { removeDockableChild(frame.getChatPanel()); if (frame.getJumboFrame() != null) { frame.getJumboFrame().addDockableChild(frame.getChatPanel()); } } }); this.setContentPane(pane); frame.getDesktop().add(this); if (frame.getDesktop().getSize().width/2-width/2 > 0 && frame.getDesktop().getSize().height/2-height/2 > 0) this.reshape(frame.getDesktop().getSize().width/2-width/2, frame.getDesktop().getSize().height/2-height/2, width, height); else this.reshape(0, 0, width, height); this.show(); }
/** * This method initializes */ public LogViewer() { super(); initialize(); this.addInternalFrameListener(new InternalFrameAdapter() { @Override public void internalFrameClosing(InternalFrameEvent e) { LogViewer.this.logPanel.cancel(); } }); }
protected void initialize() { addInternalFrameListener(new InternalFrameAdapter() { @Override public void internalFrameClosing(InternalFrameEvent e) { setDefaultCloseOperation(HIDE_ON_CLOSE); } }); }
protected IFrame() { super("iframe",true,true,true,true); JPanel content=new JPanel(new BorderLayout(2,2)); content.setBorder(new EmptyBorder(2, 2, 2, 2)); setContentPane(content); this.addInternalFrameListener(new InternalFrameAdapter() { @Override public void internalFrameOpened(InternalFrameEvent e) { IFrame.this.removeInternalFrameListener(this); onOpen(); } }); }
private void editar() { if ( ( tab.getLinhaSel() >= 0 ) & ( validaPeriodo() ) ) { if ( ( tab.getValor( tab.getLinhaSel(), enum_tab_lanca.ORIGSUBLANCA.ordinal() ).equals( "N" ) ) && ( tab.getValor( tab.getLinhaSel(), enum_tab_lanca.TRANSFLANCA.ordinal() ).equals( "S" ) ) ) { Funcoes.mensagemInforma( this, "Este lançamento é uma transferência!\nDeve ser alterado na conta de origem: \"" + tab.getValor( tab.getLinhaSel(), enum_tab_lanca.NUMCONTA.ordinal() ).toString().trim() + "\"" ); } /*else if ( ( tab.getValor( tab.getLinhaSel(), enum_tab_lanca.ORIGSUBLANCA.ordinal() ).equals( "S" ) ) && ( tab.getValor( tab.getLinhaSel(), enum_tab_lanca.TRANSFLANCA.ordinal() ).equals( "S" ) ) ) { DLDataTransf dl = new DLDataTransf( this ); dl.setVisible( true ); if ( !dl.OK ) { dl.dispose(); return; } Date dDtNova = dl.getValor(); dl.dispose(); String sSQL = "UPDATE FNSUBLANCA SET DATASUBLANCA=? WHERE CODLANCA = ? AND CODEMP=? AND CODFILIAL=? AND CODSUBLANCA > 0"; try { PreparedStatement ps = con.prepareStatement( sSQL ); ps.setDate( 1, Funcoes.dateToSQLDate( dDtNova ) ); ps.setInt( 2, Integer.parseInt( (String) tab.getValor( tab.getLinhaSel(), enum_tab_lanca.CODLANCA.ordinal() ) ) ); ps.setInt( 3, Aplicativo.iCodEmp ); ps.setInt( 4, ListaCampos.getMasterFilial( "FNSUBLANCA" ) ); ps.executeUpdate(); ps.close(); con.commit(); } catch ( SQLException err ) { Funcoes.mensagemErro( this, "Erro ao atualizar a data da transferência!\n" + err.getMessage(), true, con, err ); } tab.setValor( Funcoes.dateToStrDate( dDtNova ), tab.getLinhaSel(), enum_tab_lanca.DATASUBLANCA.ordinal() ); }*/ else { Container cont = getContentPane(); while ( true ) { if ( cont instanceof FPrincipal ) break; cont = cont.getParent(); } if ( ! ( (FPrincipal) cont ).temTela( "FSubLanca" ) ) { FSubLanca form = new FSubLanca( (String) tab.getValor( tab.getLinhaSel(), enum_tab_lanca.CODLANCA.ordinal() ), sCodPlan, dIniLanca, dFimLanca ); ( (FPrincipal) cont ).criatela( "FSubLanca", form, con ); form.addInternalFrameListener( new InternalFrameAdapter() { public void internalFrameClosed( InternalFrameEvent ievt ) { altLanca( ( (FSubLanca) ievt.getSource() ).getValores() ); } } ); } } } }
/** * This method creates an internal window and encapsulates it into a * JInternalFrame. * This window is then added to the internal desktop for display * purposes. * * @param win the ViewWindow to make into a JInternalFrame * @return the created window */ private synchronized JInternalFrame createWindow(final ViewWindow win, final int width, final int height) { int offset = numWins / 4 * 24; JDesktopPane desktop = viewMain.getDesktop(); JInternalFrame frame = new JInternalFrame( null, //title true, //resizable true, //closable false, //maximizable true); //iconifiable frame.setContentPane(win); frame.pack(); frame.setSize(width, height); switch (numWins % 4) { //set the upper left corner's position case 0: frame.setLocation(offset, offset); break; case 1: frame.setLocation(desktop.getWidth() - width - offset, desktop.getHeight() - height - offset); break; case 2: frame.setLocation(desktop.getWidth() - width - offset, offset); break; case 3: frame.setLocation(offset, desktop.getHeight() - height - offset); break; } win.addFocusListener(new FocusAdapter() { @Override public void focusGained(final FocusEvent fe) { vrp.setSelection(win.getType()); } }); frame.addInternalFrameListener(new InternalFrameAdapter() { @Override public void internalFrameClosing(InternalFrameEvent ife) { wm.removeWindow(win); } }); frame.setVisible(true); desktop.add(frame); frame.toFront(); try { frame.setSelected(true); } catch (PropertyVetoException pve) { System.out.println(pve.toString()); } return frame; }