@Override public void windowDeactivated(WindowEvent e) { // proceed only if switching to external application if (e.getOppositeWindow() == null) { synchronized (rp) { if (task != null) { task.cancel(); } else { task = rp.create(this); } LOG.fine("Window deactivated, preparing refresh task"); } if (UILOG.isLoggable(Level.FINE)) { LogRecord r = new LogRecord(Level.FINE, "LOG_WINDOW_DEACTIVATED"); // NOI18N r.setResourceBundleName("org.netbeans.core.ui.warmup.Bundle"); // NOI18N r.setResourceBundle(NbBundle.getBundle(MenuWarmUpTask.class)); // NOI18N r.setLoggerName(UILOG.getName()); UILOG.log(r); } } }
/** * Show font selection dialog. * @param parent Dialog's Parent component. * @return OK_OPTION, CANCEL_OPTION or ERROR_OPTION * * @see #OK_OPTION * @see #CANCEL_OPTION * @see #ERROR_OPTION **/ public int showDialog(Component parent) { dialogResultValue = ERROR_OPTION; JDialog dialog = createDialog(parent); dialog.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { dialogResultValue = CANCEL_OPTION; } }); dialog.setVisible(true); dialog.dispose(); dialog = null; return dialogResultValue; }
private void loadComparisonPNG( String fileName ) { try { BufferedImage image = javax.imageio.ImageIO.read(new File(fileName)); JFrame f = new JFrame( "Comparison PNG" ); ImagePanel ip = new ImagePanel( image ); f.setResizable( false ); f.getContentPane().add( ip ); f.addWindowListener( new WindowAdapter() { public void windowClosing( WindowEvent e ) { ( (JFrame) e.getSource() ).dispose(); } }); f.pack(); f.show(); } catch ( Exception ex ) { fireChangeStatus( "ERROR: Failed to Load PNG File; See Stack Trace", true ); ex.printStackTrace(); } }
/** * Creates new form Submission_Login */ public VerifyEmail() { client = new Client(); boolean conCheck = client.connectServer(); if(!conCheck) { dispose(); } else { this.setVisible(true); } addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { client.closeConnection(); } }); initComponents(); confirmVerifCodeButton.setEnabled(false); }
public void mostrarPantallaModificacionEmpresa(Object object,String cuitEmpresa){ DTOTipoImpuesto dtoTi = obtenerTipoImpuesto((int) object); if (dtoTi != null) { IUGestionarTipoImpuestoModificarEmpresa pantallaModificarEmpresa = new IUGestionarTipoImpuestoModificarEmpresa(cuitEmpresa); pantallaModificarEmpresa.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); // Evito que se cierre al presionar x pantallaModificarEmpresa.setVisible(true); // La hago visible // Modifico la operación de cierre para volver a la pantalla principal pantallaModificarEmpresa.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); pantallaModificarEmpresa.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent ev) { iniciar(); } }); pantallaModificarEmpresa.setNombre_actual(dtoTi.getNombreDTOTipoImpuesto()); pantallaModificarEmpresa.setTextfield_nombre(dtoTi.getNombreDTOTipoImpuesto()); pantallaModificarEmpresa.setCheckbox_esEditable(dtoTi.isEsMontoEditableDTOTipoImpuesto()); if (dtoTi.getFechaHoraInhabilitacionDTOTipoImpuesto() == null) { pantallaModificarEmpresa.setCheckbox_Habilitar(true); } else { pantallaModificarEmpresa.setCheckbox_Habilitar(false); } } }
/** * Processes window events occurring on this component. * Hides the window or disposes of it, as specified by the setting * of the <code>defaultCloseOperation</code> property. * * @param e the window event * @see #setDefaultCloseOperation * @see java.awt.Window#processWindowEvent */ protected void processWindowEvent(final WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { switch (defaultCloseOperation) { case HIDE_ON_CLOSE: setVisible(false); break; case DISPOSE_ON_CLOSE: dispose(); break; case EXIT_ON_CLOSE: // This needs to match the checkExit call in // setDefaultCloseOperation System.exit(0); break; case DO_NOTHING_ON_CLOSE: default: } } }
/** * Creates a modal dialog that will interrupt this thread, when the * cancel button is pressed. */ private JDialog createCancelDialog() { JDialog result; // create message dialog JOptionPane message = new JOptionPane( isAnimated() ? getAnimationPanel() : new Object[] {getStateCountLabel(), getTransitionCountLabel()}, JOptionPane.PLAIN_MESSAGE); message.setOptions(new Object[] {getCancelButton()}); result = message.createDialog(getFrame(), "Exploring state space"); result.pack(); result.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); result.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { ExploreThread.this.interrupt(); } }); result.setAlwaysOnTop(true); return result; }
@Override public void addNotify () { super.addNotify (); //show progress for initialize method final Window w = findWindowParent (); if (w != null) { w.addWindowListener (new WindowAdapter (){ @Override public void windowOpened (WindowEvent e) { final WindowAdapter waa = this; setWaitingState (true); Utilities.startAsWorkerThread (PluginManagerUI.this, new Runnable () { @Override public void run () { try { initTask.waitFinished (); w.removeWindowListener (waa); } finally { setWaitingState (false); } } }, NbBundle.getMessage (PluginManagerUI.class, "UnitTab_InitAndCheckingForUpdates"), Utilities.getTimeOfInitialization ()); } }); } HelpCtx.setHelpIDString (this, PluginManagerUI.class.getName ()); tpTabs.addChangeListener (new ChangeListener () { @Override public void stateChanged (ChangeEvent evt) { HelpCtx.setHelpIDString (PluginManagerUI.this, getHelpCtx ().getHelpID ()); } }); }
public final void init() { frame = new Frame(); frame.add(this); frame.setMenuBar(null); frame.setPreferredSize(new Dimension(400, 400)); frame.setVisible(true); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); frame.pack(); onStart(); thread = new Thread(this); thread.start(); imageBuffer = createImage(getWidth(), getHeight()); }
public MainFrame() { setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); setPreferredSize(new Dimension(640, 480)); cap = new VideoCapture(0); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { super.windowClosing(e); cap.release(); System.exit(0); } }); p = new DrawPanel(); add(p); pack(); setVisible(true); }
/** * Create the frame. */ public MainFrame() { addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { exitApp(); } }); instance = this; projectData = new ProjectData(); chooser.setFileFilter(filter); UpdateChecker.checkForUpdate(); initialize(); }
public static void main(String[] args) { JFrame frame = new JFrame("Assignment 1 visualiser"); Visualiser vis = new Visualiser(frame); if (args.length > 0) { vis.loadProblem(new File(args[0])); if (vis.hasProblem() && args.length >= 2) { vis.loadSolution(new File(args[1])); } } frame.setSize(700, 766); frame.setLocation(300, 100); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); frame.setVisible(true); }
/** * @param args */ public static void main(String[] args) { final BitNymWallet bitwallet = new BitNymWallet(); BitNymGui gui = new BitNymGui(bitwallet); gui.loadWalletListener(); gui.setMinimumSize(new Dimension(800, 450)); gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); gui.setVisible(true); gui.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { bitwallet.exit(); } }); }
public static void main(String[] args) { // just test this panel. CopyJob copyJob = new CopyJob(); copyJob.setListFile(new File("/home/bioakimidis/ibm/readme.txt")); InitialImportFilePanel p = new InitialImportFilePanel(copyJob); JFrame f = new JFrame(); f.add(p); f.pack(); f.setLocation(100, 800); f.setSize(new Dimension(700, 500)); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); f.setVisible(true); }
public void showJFreeChart(int coordX, int coordY){ //Mostrar el chart ChartPanel chartPanel = new ChartPanel(chart1); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(chartPanel); this.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); addWindowListener( new WindowAdapter(){ public void WindowClosing (WindowEvent e){ System.out.println("No quiero cerrar la ventana !!!\n"); } } ); this.pack(); // RefineryUtilities.centerFrameOnScreen(this); this.setLocation(coordX, coordY); this.setVisible(true); }
private void mainProgram() { this.setTitle("Walkie-Talkie"); this.setIconImage(new ImageIcon(References.LOGO_IMAGE).getImage()); this.setContentPane(mainWindow()); this.setPreferredSize(new Dimension(References.WIDTH_WINDOW, References.HEIGHT_WINDOW)); this.setResizable(false); this.pack(); this.setLocationRelativeTo(null); this.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { closeApplication(); } }); this.setVisible(true); }
/** * Invoked when the window gets iconified. * * @param event The event that has information on the action. */ @Override public void windowIconified(WindowEvent event) { // Counter Java misbehaviour of minimizing JFrame when opening JDialog, // causing bug #2729. Sadly, it may take a split second. // See https://bugs.openjdk.java.net/browse/JDK-6770428 // TODO: Don't just hide the symptom, prevent hitting the trigger. // TODO: Minimize side effect of also undoing Alt+Tab and similar, // if there are complaints. Maybe remember number of open dialogs // and/or time since using one, then test for it here. frame.setExtendedState(JFrame.NORMAL); }
public void init() { robot = Util.createRobot(); kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager(); Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() { public void eventDispatched(AWTEvent event) { System.out.println("--> " + event); } }, FocusEvent.FOCUS_EVENT_MASK | WindowEvent.WINDOW_FOCUS_EVENT_MASK); }
private void setSaveWindowPositionOnClosing() { this.addWindowListener(new WindowAdapter() { @Override public void windowDeactivated(WindowEvent e) { WindowPosition windowPosition = ConfigSaver.getLoadedInstance().getFindWindowPosition(); windowPosition.readPositionFromDialog(FindAllBox.this); } }); }
private boolean checkForParentWindowEvent(WindowEvent e) { if (e.getSource()==getParent()) { uninstallAndHide(); return true; } return false; }
/** * Method declaration * * * @param ev */ public void windowClosing(WindowEvent ev) { try { if (cConn != null) { cConn.close(); } } catch (Exception e) {} fMain.dispose(); if (bMustExit) { System.exit(0); } }
private void setSaveWindowPositionOnClosing() { this.addWindowListener(new WindowAdapter() { @Override public void windowDeactivated(WindowEvent e) { WindowPosition windowPosition = ConfigSaver.getLoadedInstance().getFindWindowPosition(); windowPosition.readPositionFromDialog(FindBox.this); } }); }
TestCaseDialog(Frame parent, TestCase testCase) { super(parent, true); this.testCase = testCase; setTitle("Test case " + testCase.getName()); setContentPane(rootPanel); setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { confirmAndClose(); } }); inputTextArea.setText(testCase.getInput()); expectedOutputTextArea.setText(testCase.getExpectedOutput()); programOutputTextArea.setText(testCase.getProgramOutput()); inputTextArea.getDocument().addDocumentListener(inputListener); expectedOutputTextArea.getDocument().addDocumentListener(answerListener); saveButton.addActionListener(event -> saveAndClose()); discardButton.addActionListener(event -> confirmAndClose()); solvedCheckBox.addActionListener(event -> { boolean solved = solvedCheckBox.isSelected(); saveButton.setEnabled(somethingChanged()); expectedOutputTextArea.setText(solved ? testCase.getProgramOutput() : testCase.getExpectedOutput()); expectedOutputTextArea.setEnabled(!solved); }); setupShortcuts(); pack(); setLocationRelativeTo(parent); }
/** * If there isn't one bring up a terminal running vi and have it * go to the given file and lineno. */ static void showInEditor(String file, int lineno) { if (file == null) return; if (editorTerminal == null) { Program program = new Command("vi"); editorTerminal = new Terminal(executor(), termType, program, false, rows, cols); editorTerminal.addWindowListener(new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { editorTerminal = null; currentFile = ""; } }); injector = new Injector(); editorTerminal.term().pushStream(injector); Thread thread = new Thread(editorTerminal); thread.start(); // Give it some time to come up otherwise it's not receptive try { Thread.sleep(1000); } catch (InterruptedException ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } } if (!file.equals(currentFile)) { injector.inject("" + (char) 27 + ":e " + file + "\r\n"); currentFile = file; } injector.inject("" + (char) 27 + lineno + "G"); }
public PrivateChatter getChatterFor(final Player sender) { if (banned.contains(sender)) { return null; } PrivateChatter chat = null; int index = chatters.indexOf(new Entry(sender, null)); if (index >= 0) { chat = chatters.get(index).chatter; } if (chat == null) { chat = new PrivateChatter(sender, client); chatters.add(new Entry(sender, chat)); final JFrame f = new JFrame(); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { promptToBan(sender); } }); f.setTitle(Resources.getString("Chat.private_channel", sender.getName())); //$NON-NLS-1$ f.setJMenuBar(MenuManager.getInstance().getMenuBarFor(f)); f.getContentPane().add(chat); f.pack(); f.setLocation(Toolkit.getDefaultToolkit().getScreenSize().width / 2 - f.getSize().width / 2, 0); } return chat; }
public void windowOpened(WindowEvent e) { shown = true; synchronized(this) { //System.err.println("window opened"); notifyAll(); ((JFrame) e.getSource()).removeWindowListener(this); } }
protected void initLayerManager() { JFrame d = new JFrame(); d.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { ((JCheckBoxMenuItem)(XML_Menu.commandToMenuItemHash.get("layer_manager_cmd"))).setSelected(false); } }); LayerManager lm; //use existing layer manager if it already exists if (layerManager != null) { lm = layerManager; } else { lm = new LayerManager(); } lm.setLayerList( toLayerList(map.overlays) ); lm.setMap(map); lm.setDialog(d); JScrollPane sp = new JScrollPane(lm); sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); d.setTitle("Layer Manager"); d.setContentPane(sp); // d.getContentPane().add(sp); d.pack(); d.setSize(new Dimension(lm.getPreferredSize().width+20,lm.getPreferredSize().height+55)); d.setMaximumSize(new Dimension(400,300)); d.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); d.setLocationRelativeTo(frame); d.setState(Frame.NORMAL); d.setAlwaysOnTop(true); this.layerManager = lm; this.layerManagerDialog = d; }
public void windowClosing(WindowEvent ev) { try { if (cConn != null) { cConn.close(); } } catch (Exception e) {} fMain.dispose(); if (bMustExit) { System.exit(0); } }
public void windowActivated(WindowEvent e) { logger.entering(getClass().getName(), "windowActivated"); WeakReference<RootPaneContainer> ww = getWeak((RootPaneContainer)e.getWindow()); if (ww != null) { // place as last item in zOrder list zOrder.remove(ww); zOrder.add(ww); } else { throw new IllegalArgumentException("Window not attached: " + e.getWindow()); //NOI18N } }
/** * Initialize "page setup" dialog */ void initPageDialog(int x, int y, PrintService ps, DocFlavor flavor, PrintRequestAttributeSet attributes) { this.psCurrent = ps; this.docFlavor = flavor; this.asOriginal = attributes; this.asCurrent = new HashPrintRequestAttributeSet(attributes); Container c = getContentPane(); c.setLayout(new BorderLayout()); pnlPageSetup = new PageSetupPanel(); c.add(pnlPageSetup, BorderLayout.CENTER); pnlPageSetup.updateInfo(); JPanel pnlSouth = new JPanel(new FlowLayout(FlowLayout.TRAILING)); btnApprove = createExitButton("button.ok", this); pnlSouth.add(btnApprove); getRootPane().setDefaultButton(btnApprove); btnCancel = createExitButton("button.cancel", this); handleEscKey(btnCancel); pnlSouth.add(btnCancel); c.add(pnlSouth, BorderLayout.SOUTH); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent event) { dispose(CANCEL); } }); getAccessibleContext().setAccessibleDescription(getMsg("dialog.pstitle")); setResizable(false); setLocation(x, y); pack(); }
@Override protected void processWindowEvent(WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WINDOW_CLOSING) { open = false; } }
/** Creates new form HyperTerminal */ public HyperTerminal() { initComponents(); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { super.windowClosing(e); HyperTerminal.this.close(); } }); openPort(); }
@Override public void windowDeiconified(final WindowEvent event) { // Nothing to do yet }
public void handleStateChange(int oldState, int newState) { postEvent(new WindowEvent((Window)target, WindowEvent.WINDOW_STATE_CHANGED, oldState, newState)); }
@Override public void windowLostFocus(WindowEvent e) { if (actionsWindow != null && e.getOppositeWindow() == null) { shutdown(); } }
@Override public void windowIconified(WindowEvent e) { }
public void windowDeactivated(WindowEvent e) { }
public void windowClosing( WindowEvent e ) { CANCELLED = true; this.dispose(); }
@Override public void windowActivated(WindowEvent arg0) { }