List of usage examples for javax.swing WindowConstants DO_NOTHING_ON_CLOSE
int DO_NOTHING_ON_CLOSE
To view the source code for javax.swing WindowConstants DO_NOTHING_ON_CLOSE.
Click Source Link
From source file:Main.java
public static WindowAdapter createConfirmOnExitAdapter(final JFrame frame, final String title, final String message) { frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); return new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent ev) { int result = JOptionPane.showConfirmDialog(frame, message, title, JOptionPane.YES_OPTION); if (result == JOptionPane.OK_OPTION) { frame.getContentPane().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); System.exit(0);/*from w w w . j a v a 2 s . c om*/ } } }; }
From source file:analisis_proyecto1.Ventana_principal.java
/** * Creates new form Ventana_principal/*from w w w . ja v a 2 s.c o m*/ */ public Ventana_principal() { initComponents(); this.pack(); this.setSize(785, 381); this.HeapSort.pack(); this.HeapSort.setSize(674, 220); this.par_cercano.setSize(736, 279); this.heap.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); this.puntos_cercanos.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); }
From source file:ru.codemine.pos.ui.MainWindow.java
public MainWindow() { setTitle("? ?? v0.1alpha "); setSize(1024, 768);/*from w ww. jav a 2s . c o m*/ setLocationRelativeTo(null); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); inputBlocked = true; tabs = new WebTabbedPane(WebTabbedPane.BOTTOM); statusBar = new WebStatusBar(); statusBar.add(new WebStatusLabel("?: ")); statusBar.add(new WebMemoryBar(), ToolbarLayout.END); TableLayout layout = new TableLayout( new double[][] { { TableLayout.FILL }, { TableLayout.FILL, 15, TableLayout.PREFERRED } }); setLayout(layout); add(tabs, "0, 0"); add(statusBar, "0, 2"); }
From source file:labr_client.GUI.forms.EhealthSearch.java
/** * Creates new form EhealthSearch//from w w w . j a v a2 s .c o m */ public EhealthSearch() { initComponents(); this.setVisible(true); this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); }
From source file:com.jidesoft.spring.richclient.docking.JideApplicationWindowFactory.java
@Override public ApplicationWindow createApplicationWindow() { DefaultDockableHolder dockableHolder = new DefaultDockableHolder(); configureDockingManager(dockableHolder.getDockingManager()); dockableHolder.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); Lm.setParent(dockableHolder);/*from w w w .ja va 2s .c o m*/ JideApplicationWindow window = new JideApplicationWindow(dockableHolder) { @Override protected ApplicationWindowConfigurer initWindowConfigurer() { DefaultApplicationWindowConfigurer configurer = new DefaultApplicationWindowConfigurer(this); configurer.setShowMenuBar(JideApplicationWindowFactory.this.showMenuBar); configurer.setShowToolBar(JideApplicationWindowFactory.this.showToolBar); configurer.setShowStatusBar(JideApplicationWindowFactory.this.showStatusBar); return configurer; } }; JideApplicationWindowCloseListener closeListener = new JideApplicationWindowCloseListener(window, dockableHolder.getDockingManager(), this.saveLayoutOnClose); dockableHolder.addWindowListener(closeListener); return window; }
From source file:edu.ku.brc.specify.config.init.SpecifyDBSetupWizardFrame.java
/** * @throws HeadlessException/* w w w . j a va 2 s . c om*/ */ public SpecifyDBSetupWizardFrame() throws HeadlessException { super(); UIRegistry.loadAndPushResourceBundle("specifydbsetupwiz"); new MacOSAppHandler(this); UIRegistry.setTopWindow(this); // Now initialize AppPreferences localPrefs = AppPreferences.getLocalPrefs(); localPrefs.setDirPath(UIRegistry.getAppDataDir()); AppPrefsCache.setUseLocalOnly(true); SpecifyAppPrefs.setSkipRemotePrefs(true); SpecifyAppPrefs.initialPrefs(); Specify.adjustLocaleFromPrefs(); ImageIcon helpIcon = IconManager.getIcon(SpecifyDBSetupWizard.getIconName(), IconSize.Std32); //$NON-NLS-1$ HelpMgr.initializeHelp("SpecifyHelp", helpIcon.getImage()); //$NON-NLS-1$ JMenuBar menuBar = createMenus(); if (menuBar != null) { setJMenuBar(menuBar); } UIRegistry.register(UIRegistry.MENUBAR, menuBar); setIconImage( IconManager.getIcon(SpecifyDBSetupWizard.getIconName(), IconManager.IconSize.NonStd).getImage()); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); SpecifyDBSetupWizard wizPanel = new SpecifyDBSetupWizard(SpecifyDBSetupWizard.WizardType.Institution, new SpecifyDBSetupWizard.WizardListener() { @Override public void cancelled() { setVisible(false); //dispose(); doExit(true); } @Override public void hide() { setVisible(false); } @Override public void finished() { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { dispose(); doExit(true); } }); } @Override public void panelChanged(String title) { setTitle(getAppTitle(title)); } @Override public void helpContextChanged(String helpTarget) { if (getHelpMenuItem() != null) { HelpMgr.registerComponent(getHelpMenuItem(), helpTarget); } } }); setTitle(getAppTitle(getResourceString("MAIN_TITLE"))); setContentPane(wizPanel); pack(); }
From source file:edu.ku.brc.ui.ProgressFrame.java
/** * Pack and then sets the width to 500px. *//*from w w w . j a v a2 s . c o m*/ public void adjustProgressFrame() { setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); pack(); Dimension size = getSize(); size.width = Math.max(size.width + 100, 600); size.height += 20; setSize(size); }
From source file:Main_Window.java
public Main_Window() { super("Google Places Application"); //First call Constructor of JFrame this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); //We do not want our application to terminate when a JFrame is closed this.addWindowListener(new java.awt.event.WindowAdapter() { @Override//w ww.j a v a 2 s .com public void windowClosing(java.awt.event.WindowEvent windowEvent) { int Answer = JOptionPane.showConfirmDialog(null, "Exit Application ? ", "Exit ? ", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (Answer == JOptionPane.YES_OPTION) { if (POI_List.isEmpty()) { POI_List.clear(); } if (Distances_List.isEmpty()) { Distances_List.clear(); } if (Temp_List.isEmpty()) { Temp_List.clear(); } if (Distances_List_2.isEmpty()) { Distances_List_2.clear(); } System.exit(1); } else { setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); } } }); //The listener object created from that class is then registered with a Window using the window's addWindowListener method. // this.setSize(1100, 700); // Size of Window this.setLocationRelativeTo(null); // Display Window in center of Screen this.setVisible(true); this.getContentPane().setBackground(Color.LIGHT_GRAY); // //Initialization of J Components POIS_Label = new JLabel("Points of Interest:"); POIS_Label.setForeground(Color.black); POIS_Label.setFont(new Font("Courier New", Font.BOLD, 25)); POIS_Label.setBounds(600, 30, 350, 150); Retrieve_POIs_Button = new JButton("Retrieve POIs"); Retrieve_POIs_Button.setForeground(Color.black); Retrieve_POIs_Button.setFont(new Font("Courier New", Font.BOLD, 35)); Retrieve_POIs_Button.setBounds(25, 450, 350, 150); Open_Status = new JRadioButton(" Open Now?"); Open_Status.setForeground(Color.black); Open_Status.setBackground(Color.LIGHT_GRAY); Open_Status.setBounds(20, 380, 100, 30); Welcome_Label = new JLabel("Welcome to Google Places"); Welcome_Label.setForeground(Color.BLUE); Welcome_Label.setFont(new Font("Courier New", Font.BOLD, 35)); Welcome_Label.setBounds(240, 20, 600, 60); Latitude_Label = new JLabel("Latitude:"); Latitude_Label.setForeground(Color.BLACK); Latitude_Label.setFont(new Font("Courier New", Font.PLAIN, 25)); Latitude_Label.setBounds(15, 80, 200, 100); Longitude_Label = new JLabel("Longitude:"); Longitude_Label.setForeground(Color.BLACK); Longitude_Label.setFont(new Font("Courier New", Font.PLAIN, 25)); Longitude_Label.setBounds(15, 130, 250, 100); Radius_Label = new JLabel("Radius:"); Radius_Label.setForeground(Color.BLACK); Radius_Label.setFont(new Font("Courier New", Font.PLAIN, 25)); Radius_Label.setBounds(15, 180, 250, 100); Category_Label = new JLabel("Category:"); Category_Label.setForeground(Color.BLACK); Category_Label.setFont(new Font("Courier New", Font.PLAIN, 25)); Category_Label.setBounds(15, 250, 250, 100); Latitude_TextField = new JTextField(7); Latitude_TextField.setForeground(Color.BLACK); Latitude_TextField.setBounds(165, 116, 180, 30); Longitude_TextField = new JTextField(7); Longitude_TextField.setForeground(Color.BLACK); Longitude_TextField.setBounds(170, 168, 180, 30); Radius_TextField = new JTextField(7); Radius_TextField.setForeground(Color.BLACK); Radius_TextField.setBounds(125, 215, 180, 30); Categories = new JComboBox(Categories_Names); Categories.setForeground(Color.BLACK); Categories.setBackground(Color.white); Categories.setBounds(15, 320, 180, 30); POI_List = new ArrayList(); pane = getContentPane(); //Manager pane.setLayout(null); // Deactivate Manager Layout //JPANEL P = new JPanel(); P.setBackground(Color.GRAY); P.setBounds(600, 120, 450, 180); P.setBackground(Color.GRAY); pane.add(P); pane.add(POIS_Label); pane.add(Retrieve_POIs_Button); pane.add(Welcome_Label); pane.add(Longitude_Label); pane.add(Latitude_Label); pane.add(Radius_Label); pane.add(Category_Label); pane.add(Latitude_TextField); pane.add(Longitude_TextField); pane.add(Radius_TextField); pane.add(Categories); pane.add(Open_Status); Retrieve_POIs_Button.addActionListener(this); setContentPane(pane); }
From source file:MyJava3D.java
public MyJava3D() { // load the object file Scene scene = null;/*from ww w . j a va2 s. co m*/ Shape3D shape = null; // read in the geometry information from the data file ObjectFile objFileloader = new ObjectFile(ObjectFile.RESIZE); try { scene = objFileloader.load("hand1.obj"); } catch (Exception e) { scene = null; System.err.println(e); } if (scene == null) System.exit(1); // retrieve the Shape3D object from the scene BranchGroup branchGroup = scene.getSceneGroup(); shape = (Shape3D) branchGroup.getChild(0); GeometryArray geometryArray = (GeometryArray) shape.getGeometry(); // add the geometry to the rendering engine... renderingEngine.addGeometry(geometryArray); // create a rendering surface and bind the rendering engine renderingSurface = new RenderingSurface(renderingEngine, geometryUpdater); // start the rendering surface and add it to the content panel renderingSurface.start(); getContentPane().add(renderingSurface); // disable automatic close support for Swing frame. setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); // adds the window listener addWindowListener(new WindowAdapter() { // handles the system exit window message public void windowClosing(WindowEvent e) { System.exit(0); } }); }
From source file:burlov.ultracipher.swing.SwingGuiApplication.java
protected void startup() { initLAF();//w w w .ja v a 2 s. c o m mainFrame = new JFrame(getFrameTitle()); mainFrame.setIconImage(getAppIcon().getImage()); mainFrame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); instance = this; mainFrame.addWindowListener(new WindowListener() { @Override public void windowOpened(WindowEvent e) { } @Override public void windowIconified(WindowEvent e) { } @Override public void windowDeiconified(WindowEvent e) { } @Override public void windowDeactivated(WindowEvent e) { } @Override public void windowClosing(WindowEvent e) { if (canExit()) { exit(); } mainFrame.setVisible(true); } @Override public void windowClosed(WindowEvent e) { } @Override public void windowActivated(WindowEvent e) { } }); getMainFrame().setJMenuBar(createMenuBar()); getMainFrame().add(mainPanel); restoreWindowState(); mainFrame.setVisible(true); mainPanel.getEditDataPanel().setEditable(false); loadLocalData(); downloadAndMergeData(); mainPanel.init(); }