Java Code Examples for java.awt.event.WindowAdapter
The following code examples are extracted from open source projects. You can click to
vote up the examples that are useful to you.
Example 1
/** * Displays this wizard in the specified {@link Window} that is positioned relative to thespecified component. * @param window the window that will contain the wizard. * @param relativeTo the component used to position the window. If the component is <tt>null</tt>,the window will be centered on the desktop as per {@link JWindow#setLocationRelativeTo(java.awt.Component)}. */ private void showInWindow(Window window,Component relativeTo){ ((RootPaneContainer)window).getContentPane().add(this); window.addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent e){ cancel(); } } ); WizardFrameCloser.bind(this,window); window.pack(); window.setLocationRelativeTo(relativeTo); window.setVisible(true); window.toFront(); }
Example 2
From project Valkyrie-RCP, under directory /valkyrie-rcp-core/src/main/java/org/valkyriercp/application/support/.
Source file: AbstractApplicationWindow.java

protected JXFrame createNewWindowControl(){ JXFrame frame=new JXFrame(); frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); WindowAdapter windowCloseHandler=new WindowAdapter(){ public void windowClosing( WindowEvent e){ close(); } } ; frame.addWindowListener(windowCloseHandler); new DefaultButtonFocusListener(); return frame; }
Example 3
From project BDSup2Sub, under directory /src/main/java/bdsup2sub/gui/support/.
Source file: Progress.java

private void initialize(){ setMinimumSize(new Dimension(224,139)); setResizable(false); setBounds(new Rectangle(0,0,224,139)); setMaximumSize(new Dimension(224,139)); setContentPane(getJContentPane()); addWindowListener(new WindowAdapter(){ @Override public void windowClosing( WindowEvent e){ Core.cancel(); } } ); }
Example 4
From project BMach, under directory /src/jsyntaxpane/actions/gui/.
Source file: QuickFindDialog.java

public void showFor(final JTextComponent target){ oldCaretPosition=target.getCaretPosition(); Container view=target.getParent(); Dimension wd=getSize(); wd.width=target.getVisibleRect().width; Point loc=new Point(0,view.getHeight()); setSize(wd); setLocationRelativeTo(view); SwingUtilities.convertPointToScreen(loc,view); setLocation(loc); jTxtFind.setFont(target.getFont()); jTxtFind.getDocument().addDocumentListener(this); WindowAdapter closeListener=new WindowAdapter(){ @Override public void windowDeactivated( WindowEvent e){ target.getDocument().removeDocumentListener(QuickFindDialog.this); Markers.removeMarkers(target,marker); if (escaped) { Rectangle aRect; try { aRect=target.modelToView(oldCaretPosition); target.setCaretPosition(oldCaretPosition); target.scrollRectToVisible(aRect); } catch ( BadLocationException ex) { } } dispose(); } } ; addWindowListener(closeListener); this.target=new WeakReference<JTextComponent>(target); Pattern p=dsd.get().getPattern(); if (p != null) { jTxtFind.setText(p.pattern()); } jChkWrap.setSelected(dsd.get().isWrap()); setVisible(true); }
Example 5
From project dawn-isencia, under directory /com.isencia.passerelle.commons/src/main/java/com/isencia/util/swing/calendar/.
Source file: TimeSelector.java

/** * Creates a JFrame with a JSpinField inside and can be used for testing. */ static public void main(String[] s){ WindowListener l=new WindowAdapter(){ public void windowClosing( WindowEvent e){ System.exit(0); } } ; JFrame frame=new JFrame("JSpinField"); frame.addWindowListener(l); frame.getContentPane().add(new TimeSelector()); frame.pack(); frame.setVisible(true); }
Example 6
From project drools-planner, under directory /drools-planner-examples/src/main/java/org/drools/planner/examples/common/swingui/.
Source file: SolverAndPersistenceFrame.java

private void registerListeners(){ solutionBusiness.registerForBestSolutionChanges(this); addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent e){ solutionBusiness.terminateSolvingEarly(); } } ); }
Example 7
From project flyingsaucer, under directory /flying-saucer-examples/src/main/java/.
Source file: AddNodeToDocument.java

private void initFrame(){ frame=new JFrame("XHTMLPanel"); frame.addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent e){ System.exit(0); } } ); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
Example 8
From project freemind, under directory /freemind/accessories/plugins/dialogs/.
Source file: EnterPasswordDialog.java

/** * This method initializes this * @return void */ private void initialize(){ this.setTitle(controller.getText("accessories/plugins/EncryptNode.properties_0")); this.setSize(300,200); this.setContentPane(getJContentPane()); setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent we){ cancelPressed(); } } ); }
Example 9
From project JavaOSC, under directory /modules/ui/src/main/java/com/illposed/osc/ui/.
Source file: Main.java

public Main(){ super("OSC"); addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent e){ myUi.doSendGlobalOff(1000,1001,1002); System.exit(0); } } ); addOscUI(); setVisible(true); }
Example 10
From project jSite, under directory /src/main/java/de/todesbaum/jsite/gui/.
Source file: KeyDialog.java

/** * Creates a new key dialog. * @param freenetInterface Interface to the freenet node * @param parent The parent frame */ public KeyDialog(Freenet7Interface freenetInterface,JFrame parent){ super(parent,I18n.getMessage("jsite.key-dialog.title"),true); this.freenetInterface=freenetInterface; addWindowListener(new WindowAdapter(){ @Override @SuppressWarnings("synthetic-access") public void windowClosing( WindowEvent windowEvent){ actionCancel(); } } ); initDialog(); }
Example 11
From project jsmaa, under directory /main/src/main/java/fi/smaa/jsmaa/.
Source file: JSMAAMain.java

private void start(){ GUIHelper.initializeLookAndFeel(); app=new JSMAAMainFrame(DefaultModels.getSMAA2Model()); app.addWindowListener(new WindowAdapter(){ @Override public void windowClosing( WindowEvent evt){ quitApplication(); } } ); app.setVisible(true); }
Example 12
From project lilith, under directory /lilith/src/main/java/de/huxhorn/lilith/swing/.
Source file: LicenseAgreementDialog.java

public LicenseAgreementDialog(){ super((Frame)null,"License Agreement",true); setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent we){ decline(); } } ); licenseAgreed=false; initUI(); }
Example 13
From project medsavant, under directory /medsavant/MedSavantClient/src/org/ut/biolab/medsavant/view/dialog/.
Source file: DownloadDialog.java

public DownloadDialog(Window parent,boolean modal){ super(parent,modal ? Dialog.ModalityType.APPLICATION_MODAL : Dialog.ModalityType.MODELESS); initComponents(); setLocationRelativeTo(parent); setAlwaysOnTop(true); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter(){ @Override public void windowClosing( WindowEvent e){ askToDispose(); } } ); }
Example 14
From project movsim, under directory /viewer/src/main/java/org/movsim/viewer/util/.
Source file: SwingHelper.java

public static void activateWindowClosingAndSystemExitButton(JFrame frame){ frame.addWindowListener(new WindowAdapter(){ @Override public void windowClosing( WindowEvent evnt){ evnt.getWindow().setVisible(false); evnt.getWindow().dispose(); System.exit(0); } } ); }
Example 15
From project PenguinCMS, under directory /PenguinCMS/tests/vendor/sahi/src/net/sf/sahi/ui/.
Source file: Dashboard.java

private void addOnExit(){ addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent we){ stopProxy(); ProxySwitcher.revertSystemProxy(true); System.exit(0); } } ); }
Example 16
From project RegionalTransitArchitecture, under directory /Desktop_App/Source_Code/edu/usf/cutr/fdot7/gui/.
Source file: SessionForm.java

/** * Creates new form OSMSessionForm */ public SessionForm(){ factory=new XmlBeanFactory(new FileSystemResource(System.getProperty("user.dir") + System.getProperty("file.separator") + "data-source.xml")); initComponents(); this.setLocationRelativeTo(null); this.addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent we){ Test.mutex.release(); } } ); }
Example 17
From project SMC, under directory /plugin-testing/src/main/java/example_5/.
Source file: TaskDialog.java

private void createDialog(){ _frame=new JFrame(_title); Component contents=createComponents(); _frame.getContentPane().add(contents,BorderLayout.CENTER); _frame.addWindowListener(new WindowAdapter(){ @Override public void windowClosing( WindowEvent e){ deactivate(); } } ); _frame.pack(); _frame.setVisible(false); return; }
Example 18
private void createDialog(){ _frame=new JFrame(_title); Component contents=createComponents(); _frame.getContentPane().add(contents,BorderLayout.CENTER); _frame.addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent e){ deactivate(); } } ); _frame.pack(); _frame.setVisible(false); return; }
Example 19
From project twistDemo, under directory /twist-libs/com.thoughtworks.webdriver.recorder_1.0.0.11288/sahi/src/net/sf/sahi/ui/.
Source file: Dashboard.java

private void addOnExit(){ addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent we){ stopProxy(); ProxySwitcher.revertSystemProxy(true); System.exit(0); } } ); }
Example 20
From project Twister, under directory /src/client/userinterface/java/src/.
Source file: DatabaseFrame.java

public DatabaseFrame(DefPanel userDefinition){ setTitle(userDefinition.getDescription()); Repository.window.setEnabled(false); addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent e){ Repository.window.setEnabled(true); dispose(); } } ); initComponents(); setAlwaysOnTop(true); this.userDefinition=userDefinition; }
Example 21
From project uniquery, under directory /src/org/uniquery/gui/dialog/.
Source file: DialogFrame.java

protected void init(){ buildDialogFrame(); addActionListeners(); addWindowListener(new WindowAdapter(){ @Override public void windowClosing( WindowEvent e){ closeFrame(); } } ); pack(); setLocationRelativeTo(owner); setVisible(true); }
Example 22
From project vlcj, under directory /src/test/java/uk/co/caprica/vlcj/test/drawable/.
Source file: SetDrawableTest.java

private VideoFrame(String title,EmbeddedMediaPlayer mediaPlayer){ super(title); this.mediaPlayer=mediaPlayer; setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); setSize(320,180); pack(); addWindowListener(new WindowAdapter(){ @Override public void windowClosing( WindowEvent e){ } } ); }
Example 23
From project addis, under directory /application/src/main/java/org/drugis/addis/gui/.
Source file: AddisWindow.java

public AddisWindow(final Main main,final Domain domain){ super(DEFAULT_TITLE); d_domain=domain; d_pmf=new PresentationModelFactory(d_domain); d_main=main; d_main.getDomainChangedModel().addValueChangeListener(new PropertyChangeListener(){ public void propertyChange( final PropertyChangeEvent evt){ updateTitle(); } } ); d_main.addPropertyChangeListener(new PropertyChangeListener(){ public void propertyChange( final PropertyChangeEvent evt){ if (evt.getPropertyName().equals(Main.PROPERTY_DISPLAY_NAME)) { updateTitle(); } } } ); setIconImage(Main.IMAGELOADER.getImage(FileNames.ICON_ADDIS_APP)); setPreferredSize(fitDimensionToScreen(960,800)); setMinimumSize(new Dimension(750,550)); addWindowListener(new WindowAdapter(){ @Override public void windowClosing( final WindowEvent evt){ main.quitApplication(); } } ); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); initComponents(); Main.bindPrintScreen(super.getContentPane()); updateTitle(); selectDefaultPath(); }
Example 24
/** * @param args * @throws Exception */ public static void main(String[] args) throws Exception { new LogInitiator().init(); Node node=new Node(); if (args[0].equals("joiner1")) { node.init("127.0.0.2","127.0.0.1"); node.sendJoin(args[1]); } else if (args[0].equals("joiner2")) { node.init("127.0.0.3","127.0.0.1"); node.sendJoin(args[1]); } else { node.init("127.0.0.1",null); node.sendJoin(args[1]); } node.gameFrame.addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent e){ System.exit(0); } } ); JScrollPane jscrollPane=new JScrollPane(new MainPanel(node)); jscrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); node.gameFrame.getContentPane().add(jscrollPane); node.gameFrame.pack(); node.gameFrame.setVisible(true); }
Example 25
From project autopsy, under directory /Core/src/org/sleuthkit/autopsy/ingest/.
Source file: IngestDialogPanel.java

private void advancedButtonActionPerformed(java.awt.event.ActionEvent evt){ final AdvancedConfigurationDialog dialog=new AdvancedConfigurationDialog(); dialog.addApplyButtonListener(new ActionListener(){ @Override public void actionPerformed( ActionEvent e){ dialog.close(); currentModule.saveAdvancedConfiguration(); reload(); } } ); dialog.addWindowListener(new WindowAdapter(){ @Override public void windowClosing( WindowEvent e){ dialog.close(); reload(); } } ); save(); dialog.display(currentModule.getAdvancedConfiguration()); }
Example 26
From project Calendar-Application, under directory /com/toedter/calendar/demo/.
Source file: JCalendarDemo.java

/** * Creates a JFrame with a JCalendarDemo inside and can be used for testing. * @param s The command line arguments */ public static void main(String[] s){ WindowListener l=new WindowAdapter(){ public void windowClosing( WindowEvent e){ System.exit(0); } } ; JFrame frame=new JFrame("JCalendar Demo"); frame.addWindowListener(l); JCalendarDemo demo=new JCalendarDemo(); demo.init(); frame.getContentPane().add(demo); frame.pack(); frame.setBounds(200,200,(int)frame.getPreferredSize().getWidth() + 40,(int)frame.getPreferredSize().getHeight() + 250); frame.setVisible(true); }
Example 27
From project ceres, under directory /ceres-ui/src/main/java/com/bc/ceres/swing/demo/.
Source file: MultiSelectionSourceApp.java

public MyPageComponent(Window window,String[] listContent){ this.listContent=listContent; window.setFocusable(true); window.addWindowListener(new WindowAdapter(){ @Override public void windowActivated( WindowEvent e){ MyPageComponent.this.windowActivated(); } @Override public void windowDeactivated( WindowEvent e){ MyPageComponent.this.windowDeactivated(); } @Override public void windowGainedFocus( WindowEvent e){ System.out.println("e = " + e); MyPageComponent.this.windowActivated(); } @Override public void windowLostFocus( WindowEvent e){ System.out.println("e = " + e); MyPageComponent.this.windowDeactivated(); } } ); }
Example 28
From project codjo-control, under directory /codjo-control-gui/src/test/java/net/codjo/control/gui/plugin/.
Source file: DefaultQuarantineDetailWindowTest.java

public static void main(String[] args) throws Exception { DetailDataSource dataSourceChiotte=getDataSourceChiotte(0); DefaultQuarantineDetailWindow window=new DefaultQuarantineDetailWindow(dataSourceChiotte); assertEquals("Quarantaine des benchs",window.getTitle()); JFrame frame=new JFrame("Test Renderer"); frame.getContentPane().add(window.getMainTabbedPane()); frame.pack(); frame.setVisible(true); frame.addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent evt){ System.exit(0); } } ); }
Example 29
From project codjo-data-process, under directory /codjo-data-process-gui/src/main/java/net/codjo/dataprocess/gui/launcher/configuration/.
Source file: ConfigurationDialog.java

private void initGui(){ setSize(900,500); initTopPanel(); initLeftPanel(); initRightPanel(); initBottomPanel(); initMainPanel(); getContentPane().setLayout(borderLayout); getContentPane().add(mainPanel,BorderLayout.CENTER); InputMap inputMap=mainPanel.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); inputMap.put(KeyStroke.getKeyStroke("ESCAPE"),"cancel"); mainPanel.getActionMap().put("cancel",new AbstractAction(){ public void actionPerformed( ActionEvent evt){ quitCommand(); } } ); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter(){ @Override public void windowClosing( WindowEvent evt){ quitCommand(); } } ); if (guiTreatmentList.getModel().getSize() != 0) { guiTreatmentList.setSelectedIndex(0); } trtConfigurationTable.getModel().addTableModelListener(new TableModelListener(){ public void tableChanged( TableModelEvent evt){ modified=true; } } ); }
Example 30
public MainFrame(Coord isz){ super(TITLE); JarSignersHardLinker.go(); instance=this; Coord sz; if (isz == null) { sz=Utils.getprefc("wndsz",new Coord(800,600)); if (sz.x < 640) sz.x=640; if (sz.y < 480) sz.y=480; } else { sz=isz; } this.g=new ThreadGroup(HackThread.tg(),"Haven client"); this.mt=new HackThread(this.g,this,"Haven main thread"); p=new HavenPanel(sz.x,sz.y); if (fsmode == null) { Coord pfm=Utils.getprefc("fsmode",null); if (pfm != null) fsmode=findmode(pfm.x,pfm.y); } if (fsmode == null) { DisplayMode cm=getGraphicsConfiguration().getDevice().getDisplayMode(); fsmode=findmode(cm.getWidth(),cm.getHeight()); } if (fsmode == null) fsmode=findmode(800,600); add(p); pack(); setResizable(!Utils.getprefb("wndlock",false)); p.requestFocus(); seticon(); setVisible(true); p.init(); addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent e){ g.interrupt(); } } ); if ((isz == null) && Utils.getprefb("wndmax",false)) setExtendedState(getExtendedState() | MAXIMIZED_BOTH); }
Example 31
From project droolsjbpm-integration, under directory /droolsjbpm-integration-examples/src/main/java/org/drools/examples/conway/.
Source file: AbstractRunConway.java

public void start(final int executionControl,boolean exitOnClose){ final ConwayGUI gui=new ConwayGUI(executionControl); final String appTitle=ConwayApplicationProperties.getProperty("app.title"); final JFrame f=new JFrame(appTitle); f.setResizable(false); f.setDefaultCloseOperation(exitOnClose ? JFrame.EXIT_ON_CLOSE : JFrame.DISPOSE_ON_CLOSE); f.getContentPane().add(BorderLayout.CENTER,gui); f.addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent we){ gui.dispose(); } } ); f.pack(); f.setLocationRelativeTo(null); f.setVisible(true); }
Example 32
From project e4-rendering, under directory /com.toedter.e4.ui.workbench.renderers.swing/src/com/toedter/e4/ui/workbench/renderers/swing/.
Source file: WorkbenchWindowRenderer.java

@Override public void hookControllerLogic(final MUIElement element){ if (element instanceof MWindow) { final MWindow mWindow=(MWindow)element; JFrame jFrame=(JFrame)mWindow.getWidget(); jFrame.addWindowListener(new WindowAdapter(){ @Override public void windowClosing( WindowEvent evt){ if ((MUIElement)element.getParent() instanceof MApplication) { MApplication application=(MApplication)(MUIElement)element.getParent(); synchronized (application) { application.notifyAll(); } } } } ); jFrame.getContentPane().addHierarchyBoundsListener(new HierarchyBoundsListener(){ @Override public void ancestorMoved( HierarchyEvent e){ mWindow.setX(e.getChanged().getX()); mWindow.setY(e.getChanged().getY()); } @Override public void ancestorResized( HierarchyEvent e){ mWindow.setWidth(e.getChanged().getWidth()); mWindow.setHeight(e.getChanged().getHeight()); } } ); } }
Example 33
From project FBReaderJ, under directory /obsolete/swing/src/org/geometerplus/zlibrary/ui/swing/dialogs/.
Source file: ZLSwingDialog.java

public void run(){ myDialog.addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent e){ myWidthOption.setValue(myDialog.getWidth()); myHeightOption.setValue(myDialog.getHeight()); } } ); myDialog.setLayout(new BorderLayout()); myDialog.add(((ZLSwingDialogContent)myTab).getContentPanel(),BorderLayout.PAGE_START); JPanel panel=new JPanel(new BorderLayout()); panel.add(buttonPanel,BorderLayout.EAST); myDialog.add(panel,BorderLayout.PAGE_END); myDialog.pack(); myDialog.setSize(myWidthOption.getValue(),myHeightOption.getValue()); myDialog.setLocationRelativeTo(myDialog.getParent()); myDialog.setModal(true); myDialog.setVisible(true); }
Example 34
public JDialog makeDialog(){ setMessageType(JOptionPane.INFORMATION_MESSAGE); setMessage(makeProgressPanel()); setOptions(new Object[]{"Stop"}); addPropertyChangeListener(new PropertyChangeListener(){ @Override public void propertyChange( PropertyChangeEvent evt){ if (evt.getSource() == Downloader.this && evt.getPropertyName() == VALUE_PROPERTY) { requestClose("This will stop minecraft from launching\nAre you sure you want to do this?"); } } } ); container=new JDialog(null,"Hello",ModalityType.MODELESS); container.setResizable(false); container.setLocationRelativeTo(null); container.add(this); this.updateUI(); container.pack(); container.setMinimumSize(container.getPreferredSize()); container.setVisible(true); container.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); container.addWindowListener(new WindowAdapter(){ @Override public void windowClosing( WindowEvent e){ requestClose("Closing this window will stop minecraft from launching\nAre you sure you wish to do this?"); } } ); return container; }
Example 35
private void initialize(){ setContentPane(getCenterPanel()); setIconImage(new ImageIcon(getClass().getResource("/gitblt-favicon.png")).getImage()); setTitle("Gitblit Manager v" + Constants.VERSION + " ("+ Constants.VERSION_DATE+ ")"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); addWindowListener(new WindowAdapter(){ @Override public void windowClosing( WindowEvent event){ saveSizeAndPosition(); } @Override public void windowOpened( WindowEvent event){ manageRegistrations(); } } ); setSizeAndPosition(); loadRegistrations(); rebuildRecentMenu(); }
Example 36
From project Haven-and-Hearth-client-modified-by-Ender, under directory /src/haven/.
Source file: MainFrame.java

public void run(){ addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent e){ g.interrupt(); } } ); addComponentListener(new ComponentAdapter(){ public void componentResized( ComponentEvent evt){ innerSize.setSize(getWidth() - insetsSize.width,getHeight() - insetsSize.height); centerPoint.setLocation(innerSize.width / 2,innerSize.height / 2); } } ); Thread ui=new HackThread(p,"Haven UI thread"); p.setfsm(this); ui.start(); try { while (true) { Bootstrap bill=new Bootstrap(); if (Config.defserv != null) bill.setaddr(Config.defserv); if ((Config.authuser != null) && (Config.authck != null)) { bill.setinitcookie(Config.authuser,Config.authck); Config.authck=null; } Session sess=bill.run(p); RemoteUI rui=new RemoteUI(sess); rui.run(p.newui(sess)); } } catch ( InterruptedException e) { } finally { ui.interrupt(); dispose(); } }
Example 37
protected void start(Object[] res,boolean rep){ dateBegin=gp.holoEditRef.counterPanel.getDate(1); dateEnd=gp.holoEditRef.counterPanel.getDate(2); results=res; setVals(res); replace=rep; prog=new ProgressBar(title + "..."); prog.setValue(0); prog.addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent e){ if (runner != null) { runner.interrupt(); cancel(); } } } ); prog.open(); runner=new Thread(this); runner.setPriority(Thread.MAX_PRIORITY); runner.setName(name + "-Thread"); runner.start(); }
Example 38
From project ib-ruby, under directory /misc/IBJts-965/java/TestJavaClient/.
Source file: MktDepthDlg.java

public MktDepthDlg(String title,JFrame parent){ super(parent,title,false); JScrollPane bidPane=new JScrollPane(new JTable(m_bidModel)); JScrollPane askPane=new JScrollPane(new JTable(m_askModel)); bidPane.setBorder(BorderFactory.createTitledBorder("Bid")); askPane.setBorder(BorderFactory.createTitledBorder("Ask")); JSplitPane splitPane=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,bidPane,askPane); splitPane.setOneTouchExpandable(true); splitPane.setDividerLocation(300); splitPane.setPreferredSize(new Dimension(600,380)); JPanel closePanel=new JPanel(); closePanel.add(m_close); m_close.addActionListener(new ActionListener(){ public void actionPerformed( ActionEvent e){ onClose(); } } ); this.addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent e){ onClose(); } } ); getContentPane().add(splitPane,BorderLayout.CENTER); getContentPane().add(closePanel,BorderLayout.SOUTH); setLocation(20,20); pack(); reset(); }
Example 39
From project jASM_16, under directory /src/main/java/de/codesourcery/jasm16/ide/ui/viewcontainers/.
Source file: ViewFrame.java

public ViewFrame(String title,final IView component){ super(title); if (component == null) { throw new IllegalArgumentException("component must not be NULL."); } this.component=component; addWindowListener(new WindowAdapter(){ @Override public void windowClosing( WindowEvent e){ disposeView(component); helper.fireViewContainerClosed(ViewFrame.this); } } ); setDefaultCloseOperation(DISPOSE_ON_CLOSE); final JPanel panel=new JPanel(); panel.setLayout(new GridBagLayout()); final GridBagConstraints cnstrs=new GridBagConstraints(); cnstrs.weightx=1.0d; cnstrs.weighty=1.0d; cnstrs.fill=GridBagConstraints.BOTH; cnstrs.gridheight=GridBagConstraints.REMAINDER; cnstrs.gridwidth=GridBagConstraints.REMAINDER; cnstrs.gridx=0; cnstrs.gridy=0; panel.add(component.getPanel(this),cnstrs); getContentPane().add(panel); pack(); }
Example 40
public static void main(String[] args){ JFrame frame=new JFrame("3D GUI"); frame.setSize(150,230); frame.addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent e){ new Thread(){ public void run(){ System.exit(0); } } .start(); } } ); JPanel panel=new JPanel(); frame.add(panel); new CurrentShapesPanel(panel); frame.setVisible(true); }
Example 41
From project JGit, under directory /org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/.
Source file: Glog.java

Glog(){ frame=new JFrame(); frame.addWindowListener(new WindowAdapter(){ @Override public void windowClosing( final WindowEvent e){ frame.dispose(); } } ); graphPane=new CommitGraphPane(); final JScrollPane graphScroll=new JScrollPane(graphPane); final JPanel buttons=new JPanel(new FlowLayout()); final JButton repaint=new JButton(); repaint.setText("Repaint"); repaint.addActionListener(new ActionListener(){ public void actionPerformed( ActionEvent e){ graphPane.repaint(); } } ); buttons.add(repaint); final JPanel world=new JPanel(new BorderLayout()); world.add(buttons,BorderLayout.SOUTH); world.add(graphScroll,BorderLayout.CENTER); frame.getContentPane().add(world); }
Example 42
public EscapableFrame(){ getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE,0),"Cancel"); getRootPane().getActionMap().put("Cancel",new AbstractAction(){ public void actionPerformed( ActionEvent e){ close(); } } ); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter(){ public void windowClosing( java.awt.event.WindowEvent evt){ close(); } } ); }
Example 43
public PasswordDialog(String message,boolean confirm){ super((Frame)null,"Enter password",true); pwdField1=new JPasswordField(); Object[] array; if (confirm) { pwdField2=new JPasswordField(); array=new Object[]{new JLabel(message),pwdField1,new JLabel("confirm:"),pwdField2}; } else { array=new Object[]{new JLabel(message),pwdField1}; } optionPane=new JOptionPane(array,JOptionPane.QUESTION_MESSAGE,JOptionPane.OK_CANCEL_OPTION); optionPane.addPropertyChangeListener(this); setContentPane(optionPane); pack(); setLocationRelativeTo(null); addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent we){ optionPane.setValue(new Integer(JOptionPane.CLOSED_OPTION)); } } ); }
Example 44
From project jreversepro, under directory /src/main/java/org/jreversepro/gui/.
Source file: GUIMain.java

/** * Method to add property listeners to MenuItems and the MainFrame. */ private void addListeners(){ mMbrGen.onFileOpen.addActionListener(this); mMbrGen.onFileSave.addActionListener(this); mMbrGen.onFileExit.addActionListener(this); mMbrGen.onEditCut.addActionListener(this); mMbrGen.onEditCopy.addActionListener(this); mMbrGen.onViewCPool.addActionListener(this); mMbrGen.onOptFont.addActionListener(this); mMbrGen.onHelpAbout.addActionListener(this); addWindowListener(new WindowAdapter(){ /** * WindowClosing event handler. * @param aEvent Event generated. */ @Override public void windowClosing( WindowEvent aEvent){ appClose(); super.windowClosing(aEvent); } } ); }
Example 45
From project jsecurity, under directory /samples/spring/src/main/java/org/apache/ki/samples/spring/ui/.
Source file: WebStartView.java

public void afterPropertiesSet() throws Exception { ClassPathResource resource=new ClassPathResource("logo.png"); ImageIcon icon=new ImageIcon(resource.getURL()); JLabel logo=new JLabel(icon); valueField=new JTextField(20); updateValueLabel(); saveButton=new JButton("Save Value"); saveButton.addActionListener(this); refreshButton=new JButton("Refresh Value"); refreshButton.addActionListener(this); JPanel valuePanel=new JPanel(new FlowLayout(FlowLayout.CENTER)); valuePanel.add(valueField); valuePanel.add(saveButton); valuePanel.add(refreshButton); secureMethod1Button=new JButton("Method #1"); secureMethod1Button.addActionListener(this); secureMethod2Button=new JButton("Method #2"); secureMethod2Button.addActionListener(this); secureMethod3Button=new JButton("Method #3"); secureMethod3Button.addActionListener(this); JPanel methodPanel=new JPanel(new FlowLayout(FlowLayout.CENTER)); methodPanel.add(secureMethod1Button); methodPanel.add(secureMethod2Button); methodPanel.add(secureMethod3Button); frame=new JFrame("Apache Ki Sample Application"); frame.setSize(500,200); Container panel=frame.getContentPane(); panel.setLayout(new BorderLayout()); panel.add(logo,BorderLayout.NORTH); panel.add(valuePanel,BorderLayout.CENTER); panel.add(methodPanel,BorderLayout.SOUTH); frame.setVisible(true); frame.addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent e){ System.exit(0); } } ); }
Example 46
From project jumpnevolve, under directory /lib/slick/src/org/newdawn/slick/tests/.
Source file: CanvasContainerTest.java

/** * Entry point to our test * @param argv The arguments to pass into the test */ public static void main(String[] argv){ try { CanvasGameContainer container=new CanvasGameContainer(new CanvasContainerTest()); Frame frame=new Frame("Test"); frame.setLayout(new GridLayout(1,2)); frame.setSize(500,500); frame.add(container); frame.addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent e){ System.exit(0); } } ); frame.setVisible(true); container.start(); } catch ( Exception e) { e.printStackTrace(); } }
Example 47
From project kabeja, under directory /blocks/svg/src/main/java/org/kabeja/processing/scripting/impl/.
Source file: JavaScriptShell.java

protected void init(){ frame=new JFrame(getTitle()); frame.setJMenuBar(this.createMenuBar()); frame.getContentPane().setLayout(new BorderLayout()); frame.addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent e){ dispose(); } } ); frame.getContentPane().add(getView(),BorderLayout.CENTER); JPanel p=new JPanel(new FlowLayout(FlowLayout.RIGHT,2,2)); JButton button=new JButton((Action)actions.get("close")); p.add(button); frame.getContentPane().add(p,BorderLayout.SOUTH); frame.setSize(new Dimension(640,480)); frame.setVisible(true); newShellLine(); }
Example 48
public AwtMain(String title){ configLog(); this.log=Logger.getLogger(AwtMain.class.getName()); log.debug("Log started"); root=new Frame(title); root.setSize(800,600); root.addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent e){ System.exit(0); } } ); Panel panel=new Panel(); Button b1=new Button("Does nothing"); panel.add(b1); this.session=new AwtSshSession(); AwtTerminal term=new AwtTerminal(session.getEmulation(),session); RemoteKbdReceiver rk=new RemoteKbdReceiver(3333,term,term); rk.start(); root.add(term,BorderLayout.CENTER); session.connect("localhost",22,"user","pass"); term.setFocusable(true); term.setFocusTraversalKeysEnabled(false); term.setPreferredSize(new Dimension(1200,950)); root.pack(); root.setVisible(true); }
Example 49
private ControlWindow(final Laserschein theSchein,int theWidth,int theHeight){ _myWidth=theWidth; _myHeight=theHeight; _myFrame=new Frame("Simulacrum"); _myFrame.setFont(new Font(Font.DIALOG,Font.PLAIN,5)); _myFrame.setResizable(false); _myFrame.setLayout(new BorderLayout()); _myFrame.setFocusTraversalKeysEnabled(true); _myFrame.setFocusable(true); _mySchein=theSchein; final JTabbedPane myPane=new JTabbedPane(); myPane.setPreferredSize(new Dimension(250,0)); myPane.addTab("Output",initSimulationPanel()); myPane.addTab("Optimizer",initOptimizerPanel()); myPane.addTab("Geometry",initGeometryPanel()); _myFrame.add(myPane,BorderLayout.WEST); this.setPreferredSize(new Dimension(_myWidth,_myHeight)); this.setSize(_myWidth,_myHeight); _myFrame.add(this); _myFrame.setSize(_myWidth + 250,_myHeight); _myFrame.setVisible(true); _myFrame.addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent evt){ unopen(); } } ); _mySimulator=new Simulator(); _myFrame.pack(); }
Example 50
From project LUScheduling, under directory /src/org/learningu/scheduling/.
Source file: LookupApplication.java

public static void main(String[] args) throws IOException, InterruptedException, ExecutionException { Logger logger=Logger.getLogger("Autoscheduling"); logger.fine("Initializing injector with flags"); Injector injector=Flags.bootstrapFlagInjector(args,new AutoschedulingBaseModule()); logger.fine("Injecting data source provider"); AutoschedulerDataSource dataSource=injector.getInstance(AutoschedulerDataSource.class); logger.fine("Reading input files"); Module dataModule=dataSource.buildModule(); logger.fine("Bootstrapping into completely initialized injector"); Injector dataInjector=injector.createChildInjector(dataModule,new AutoschedulingConfigModule()); logger.fine("Initializing GUI"); LookupFrame frame=dataInjector.getInstance(LookupFrame.class); frame.addWindowListener(new WindowAdapter(){ @Override public void windowClosing( WindowEvent e){ System.exit(0); } } ); frame.setVisible(true); }
Example 51
From project Maimonides, under directory /src/com/codeko/apps/maimonides/.
Source file: MaimonidesApp.java

@Action public void editarConexion(){ final JFrame f=new JFrame("Editor de configuraci?n de conexi?n"); f.setName("FrameEditorConexion"); f.addWindowListener(new WindowAdapter(){ @Override public void windowClosing( WindowEvent we){ if (reiniciarTrasEditarConfig) { exit(); } } } ); PanelConfiguracionAccesoBD panel=new PanelConfiguracionAccesoBD(); panel.addPropertyChangeListener("guardar",new PropertyChangeListener(){ @Override public void propertyChange( PropertyChangeEvent pce){ if (pce.getNewValue() instanceof Boolean && ((Boolean)pce.getNewValue())) { f.dispose(); if (reiniciarTrasEditarConfig) { reiniciarTrasEditarConfig=false; MaimonidesUtil.ejecutarTask(MaimonidesApp.getApplication(),"conectar"); } } } } ); f.add(panel); f.setAlwaysOnTop(true); f.validate(); f.pack(); show(f); }
Example 52
From project maple-ide, under directory /build/windows/launcher/launch4j/demo/SimpleApp/src/net/sf/launch4j/example/.
Source file: SimpleApp.java

public SimpleApp(String[] args){ super("Java Application"); final int inset=100; Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize(); setBounds(inset,inset,screenSize.width - inset * 2,screenSize.height - inset * 2); JMenu menu=new JMenu("File"); menu.add(new JMenuItem("Open")); menu.add(new JMenuItem("Save")); JMenuBar mb=new JMenuBar(); mb.setOpaque(true); mb.add(menu); setJMenuBar(mb); this.addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent e){ System.exit(123); } } ); setVisible(true); StringBuffer sb=new StringBuffer("Java version: "); sb.append(System.getProperty("java.version")); sb.append("\nJava home: "); sb.append(System.getProperty("java.home")); sb.append("\nCurrent dir: "); sb.append(System.getProperty("user.dir")); if (args.length > 0) { sb.append("\nArgs: "); for (int i=0; i < args.length; i++) { sb.append(args[i]); sb.append(' '); } } JOptionPane.showMessageDialog(this,sb.toString(),"Info",JOptionPane.INFORMATION_MESSAGE); }
Example 53
From project multibit, under directory /src/main/java/org/multibit/viewsystem/swing/.
Source file: MultiBitFrame.java

@SuppressWarnings("deprecation") public MultiBitFrame(MultiBitController controller){ this.controller=controller; this.model=controller.getModel(); this.localiser=controller.getLocaliser(); this.thisFrame=this; setCursor(Cursor.WAIT_CURSOR); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setTitle(localiser.getString("multiBitFrame.title")); ToolTipManager.sharedInstance().setDismissDelay(TOOLTIP_DISMISSAL_DELAY); final MultiBitController finalController=controller; this.addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent arg0){ org.multibit.action.ExitAction exitAction=new org.multibit.action.ExitAction(finalController); exitAction.execute(null); } } ); application=new DefaultApplication(); getContentPane().setBackground(MultiBitFrame.BACKGROUND_COLOR); sizeAndCenter(); normalBorder=BorderFactory.createEmptyBorder(0,4,7,4); underlineBorder=BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0,4,3,4),BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0,0,1,0,SELECTION_BACKGROUND_COLOR),BorderFactory.createEmptyBorder(0,0,3,0))); initUI(); applyComponentOrientation(ComponentOrientation.getOrientation(controller.getLocaliser().getLocale())); recreateAllViews(false); nowOffline(); updateStatusLabel(""); estimatedBalanceTextLabel.setText(controller.getLocaliser().bitcoinValueToString4(model.getActiveWalletEstimatedBalance(),true,false)); availableBalanceTextLabel.setText(controller.getLocaliser().getString("multiBitFrame.availableToSpend",new Object[]{controller.getLocaliser().bitcoinValueToString4(model.getActiveWalletAvailableBalance(),true,false)})); estimatedBalanceTextLabel.setFocusable(true); estimatedBalanceTextLabel.requestFocusInWindow(); pack(); setVisible(true); fileChangeTimer=new Timer(); fileChangeTimer.schedule(new FileChangeTimerTask(controller,this),0,60000); }
Example 54
From project narya, under directory /core/src/test/java/com/threerings/crowd/client/.
Source file: JabberClient.java

/** * Initializes a new client and provides it with a frame in which to display everything. */ public void init(JFrame frame) throws IOException { _ctx=createContextImpl(); createContextServices(); _client.setServer("localhost",Client.DEFAULT_SERVER_PORTS); _client.addClientObserver(this); _frame=frame; _frame.addWindowListener(new WindowAdapter(){ @Override public void windowClosing( WindowEvent evt){ if (_client.isLoggedOn()) { _client.logoff(true); } else { System.exit(0); } } } ); }
Example 55
From project niravCS2103, under directory /CS2103/src/gui/mainWindow/.
Source file: MainJFrame.java

/** * add Frame actions : (1) making other components hide/show according to the Frame (2) making it and its extended components movable */ private void setJFrameAction(){ addWindowListener(new WindowAdapter(){ @Override public void windowActivated( WindowEvent arg0){ if (HelpFrame.isShown()) HelpFrame.showHelp(); } @Override public void windowDeactivated( WindowEvent arg0){ if (HelpFrame.isShown() && !UIController.isLoginOn()) { HelpFrame.hideHelpTempolarily(); } } } ); addMouseListener(new MouseAdapter(){ public void mousePressed( MouseEvent e){ point.x=e.getX(); point.y=e.getY(); } @Override public void mouseReleased( MouseEvent e){ currentLocation=MainJFrame.this.getLocation(); } } ); addMouseMotionListener(new MouseMotionAdapter(){ public void mouseDragged( MouseEvent e){ Point p=getLocation(); setLocation(p.x + e.getX() - point.x,p.y + e.getY() - point.y); Point popupP=TopPopUp.jFrame.getLocation(); TopPopUp.setPosition(popupP.x + e.getX() - point.x,popupP.y + e.getY() - point.y); Point helpP=HelpFrame.getPosition(); HelpFrame.setPosition(helpP.x + e.getX() - point.x,helpP.y + e.getY() - point.y); } } ); }
Example 56
From project OlympicPhoneBox, under directory /src/olympic/screens/.
Source file: ScreenManager.java

public ScreenManager(){ setUndecorated(true); screens=new Hashtable<Integer,Screen>(); setPreferredSize(new Dimension(GlobalConfiguration.config().width,GlobalConfiguration.config().height)); setLayout((layout=new GridLayout(1,GlobalConfiguration.config().screen_count))); setVisible(true); setAlwaysOnTop(true); addWindowListener(new WindowAdapter(){ @Override public void windowClosing( WindowEvent e){ for ( Screen screen : screens.values()) { for ( Camera camera : screen.getCameras()) camera.dispose(); } ScreenManager.this.dispose(); System.exit(0); } } ); }
Example 57
public static JFrame create(File[] csv) throws Exception { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); final PEditor p=new PEditor(csv); JFrame f=new JFrame(); f.getContentPane().add(p); f.setTitle("Parameter Editor v3.0"); f.setIconImage(new ImageIcon(PEditor.class.getResource("/ngmf/ui/table.png")).getImage()); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setSize(800,600); f.setLocation(500,200); f.setVisible(true); f.toFront(); f.addWindowListener(new WindowAdapter(){ @Override public void windowOpened( WindowEvent e){ p.cp.requestFocus(); } } ); return f; }
Example 58
From project OpenSettlers, under directory /src/java/soc/client/.
Source file: NewGameOptionsFrame.java

/** * Creates a new NewGameOptionsFrame. Once created, reset the mouse cursor from hourglass to normal, and clear main panel's status text. * @param cli Player client interface * @param gaName Requested name of game (can change in this frame),or null for blank or (forPractice) to use {@link PlayerClient#DEFAULT_PRACTICE_GAMENAME}. * @param opts Set of {@link GameOption}s; its values will be changed when "New Game" button is pressed, so the next OptionsFrame will default to the values the user has chosen. To preserve them, call {@link GameOption#cloneOptions(Hashtable)} beforehand.Null if server doesn't support game options. Unknown options ( {@link GameOption#OTYPE_UNKNOWN}) will be removed. * @param forPractice Will this game be on local practice server, vs remote tcp server? * @param readOnly Is this display-only (for use during a game), or can it be changed? */ public NewGameOptionsFrame(PlayerClient cli,String gaName,Hashtable opts,boolean forPractice,boolean readOnly){ super(readOnly ? ("Current game options: " + gaName) : (forPractice ? "New Game options: Practice game" : "New Game options")); setLayout(new BorderLayout()); this.cl=cli; this.opts=opts; this.forPractice=forPractice; this.readOnly=readOnly; controlsOpts=new Hashtable(); if (!readOnly) boolOptCheckboxes=new Hashtable(); if ((gaName == null) && forPractice) { if (cli.numPracticeGames == 0) gaName=PlayerClient.DEFAULT_PRACTICE_GAMENAME; else gaName=PlayerClient.DEFAULT_PRACTICE_GAMENAME + " " + (1 + cli.numPracticeGames); } setBackground(NGOF_BG); setForeground(Color.black); addKeyListener(this); initInterfaceElements(gaName); addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent e){ clickCancel(); } } ); cli.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); cli.status.setText(""); }
Example 59
From project openwebbeans, under directory /samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/.
Source file: Boot.java

public static void main(String[] args) throws Exception { boot(null); frame=new JFrame(); BeanManager beanManager=lifecycle.getBeanManager(); Bean<?> bean=beanManager.getBeans("loginWindow").iterator().next(); LoginWindow loginWindow=(LoginWindow)lifecycle.getBeanManager().getReference(bean,LoginWindow.class,beanManager.createCreationalContext(bean)); frame.setTitle("OWB @ Java-SE"); frame.add(loginWindow,BorderLayout.CENTER); frame.setLocation(400,300); frame.addWindowListener(new WindowAdapter(){ @Override public void windowClosed( WindowEvent e){ try { Boot.shutdown(e); } catch ( Exception e1) { e1.printStackTrace(); } } } ); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.pack(); frame.setVisible(true); }
Example 60
From project org.openscada.external, under directory /org.eclipse.albireo/src/org/eclipse/albireo/core/.
Source file: AwtEnvironment.java

/** * Creates an AWT frame suitable as a parent for AWT/Swing dialogs. <p> This method must be called from the SWT event thread. There must be an active shell associated with the environment's display. <p> The created frame is a non-visible child of the given shell and will be disposed when that shell is disposed. <p> This method is useful for creating a frame to parent any AWT/Swing dialogs created for use inside a SWT application. A modal AWT/Swing dialogs will behave better if its parent is set to the returned frame rather than to null or to an independently created {@link java.awt.Frame}. <p> The frame is positioned such that its child AWT dialogs are centered over the given parent shell's position <i>when this method is called</i>. If the parent frame is later moved, the child will no longer be properly positioned. For best results, create a new frame with this method immediately before creating and displaying each child AWT/Swing dialog. <p> As with any AWT window, the returned frame must be explicitly disposed. * @param parent - the SWT parent shell of the shell that will contain the returned frame * @return a {@link java.awt.Frame} to be used for parenting dialogs * @exception SWTException <ul> <li>ERROR_THREAD_INVALID_ACCESS - if not called from the SWT event thread </ul> * @exception IllegalStateException if the current display has no shells */ public Frame createDialogParentFrame(final Shell parent){ if (parent == null) { SWT.error(SWT.ERROR_NULL_ARGUMENT); } if (!this.display.equals(Display.getCurrent())) { SWT.error(SWT.ERROR_THREAD_INVALID_ACCESS); } final Shell shell=new Shell(parent,SWT.NO_TRIM | SWT.APPLICATION_MODAL); final Composite composite=new Composite(shell,SWT.EMBEDDED); final Frame frame=SWT_AWT.new_Frame(composite); shell.setLocation(parent.getLocation()); if (Platform.isGtk()) { shell.setSize(0,0); shell.setVisible(true); shell.setVisible(false); } shell.setSize(parent.getSize()); shell.setLayout(new FillLayout()); shell.layout(); frame.addWindowListener(new WindowAdapter(){ @Override public void windowClosed( final WindowEvent e){ if (!AwtEnvironment.this.display.isDisposed()) { ThreadingHandler.getInstance().asyncExec(AwtEnvironment.this.display,new Runnable(){ public void run(){ shell.dispose(); } } ); } } } ); return frame; }
Example 61
From project OWASP-WebScarab, under directory /src/org/owasp/webscarab/ui/swing/editors/.
Source file: SearchDialog.java

/** * Creates new form SearchDialog */ public SearchDialog(java.awt.Frame parent,JTextComponent textComponent){ super(parent); if (textComponent == null) { throw new NullPointerException("Can't search a null text component!"); } _textComponent=textComponent; initComponents(); if (!_textComponent.isEditable()) { replaceButton.setVisible(false); replaceTextField.setVisible(false); replaceLabel.setVisible(false); pack(); } String selection=_textComponent.getSelectedText(); if (selection != null) { findTextField.setText(selection); } addWindowListener(new WindowAdapter(){ public void windowActivated( WindowEvent evt){ findTextField.requestFocus(); } } ); KeyStroke escapeKeyStroke=KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE,0,false); Action escapeAction=new AbstractAction(){ /** */ private static final long serialVersionUID=482285775389739514L; public void actionPerformed( ActionEvent e){ setVisible(false); } } ; getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(escapeKeyStroke,"ESCAPE"); getRootPane().getActionMap().put("ESCAPE",escapeAction); getRootPane().setDefaultButton(searchButton); }
Example 62
From project pegadi, under directory /client/src/main/java/org/pegadi/client/.
Source file: ApplicationLauncher.java

void listerButton_actionPerformed(ActionEvent e){ if (lis == null) { this.setCursor(new Cursor(Cursor.WAIT_CURSOR)); lis=new Lister(); lis.addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent e){ lis=null; } public void windowClosed( WindowEvent e){ lis=null; } } ); Dimension size=Toolkit.getDefaultToolkit().getScreenSize(); int x=Math.min(((size.width / 5) * 4),810); int y=Math.min(((size.height / 5) * 4),600); lis.setSize(x,y); lis.setLocation((size.width - x) / 2,(size.height - y) / 2); this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); lis.setLocationRelativeTo(this); } lis.setVisible(true); }
Example 63
From project replication-benchmarker, under directory /src/main/java/jbenchmarker/.
Source file: TraceViewer.java

public TraceViewer(String file){ windows++; text=new JTextArea(5,20); this.setTitle("TraceViwer " + (file == null ? "" : " [" + file + "]")); this.setBounds(0,0,500,500); JScrollPane bar=new JScrollPane(text); this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); this.addWindowListener(new WindowAdapter(){ @Override public void windowClosing( WindowEvent e){ windows--; if (windows == 0) { System.exit(0); } } } ); this.add(bar); if (file != null) { this.open(file); } this.setVisible(true); }
Example 64
From project RomRaider, under directory /3rdparty/launch4j/demo/SimpleApp/src/net/sf/launch4j/example/.
Source file: SimpleApp.java

public SimpleApp(String[] args){ super("Java Application"); final int inset=100; Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize(); setBounds(inset,inset,screenSize.width - inset * 2,screenSize.height - inset * 2); JMenu menu=new JMenu("File"); menu.add(new JMenuItem("Open")); menu.add(new JMenuItem("Save")); JMenuBar mb=new JMenuBar(); mb.setOpaque(true); mb.add(menu); setJMenuBar(mb); this.addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent e){ System.exit(123); } } ); setVisible(true); StringBuffer sb=new StringBuffer("Java version: "); sb.append(System.getProperty("java.version")); sb.append("\nJava home: "); sb.append(System.getProperty("java.home")); sb.append("\nCurrent dir: "); sb.append(System.getProperty("user.dir")); if (args.length > 0) { sb.append("\nArgs: "); for (int i=0; i < args.length; i++) { sb.append(args[i]); sb.append(' '); } } JOptionPane.showMessageDialog(this,sb.toString(),"Info",JOptionPane.INFORMATION_MESSAGE); }
Example 65
@Override protected void startup(){ planControl=new POSController(); loadFromXML(); RubyEnvironment.getInstance().setCourseDatabase(courseDatabase); planControl.setCourseDatabase(courseDatabase); mainFrame=new MainFrame(); planControl.setView(mainFrame.getPlanCard()); mainFrame.setController(planControl); mainFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); mainFrame.addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent e){ mainFrame.setVisible(false); exit(); } } ); initializeMenuBar(); try { initializeOSXExtensions(); } catch ( ClassNotFoundException e) { } catch ( NullPointerException e) { } mainFrame.setVisible(true); if (newPlan) { mainFrame.gettingStarted(); } planControl.validatePlan(); }
Example 66
public MainFrame(Coord isz){ super("BD SaleM 3.5"); Coord sz; if (isz == null) { sz=Utils.getprefc("wndsz",new Coord(800,600)); if (sz.x < 640) sz.x=640; if (sz.y < 480) sz.y=480; } else { sz=isz; } this.g=new ThreadGroup(HackThread.tg(),"Haven client"); this.mt=new HackThread(this.g,this,"Haven main thread"); p=new HavenPanel(sz.x,sz.y); if (fsmode == null) { Coord pfm=Utils.getprefc("fsmode",null); if (pfm != null) fsmode=findmode(pfm.x,pfm.y); } if (fsmode == null) { DisplayMode cm=getGraphicsConfiguration().getDevice().getDisplayMode(); fsmode=findmode(cm.getWidth(),cm.getHeight()); } if (fsmode == null) fsmode=findmode(800,600); add(p); pack(); setResizable(!Utils.getprefb("wndlock",false)); p.requestFocus(); seticon(); setVisible(true); p.init(); addWindowListener(new WindowAdapter(){ @Override public void windowClosing( WindowEvent e){ g.interrupt(); } } ); if ((isz == null) && Utils.getprefb("wndmax",false)) setExtendedState(getExtendedState() | MAXIMIZED_BOTH); }
Example 67
From project ScissLib, under directory /src/main/java/de/sciss/app/.
Source file: DynamicAncestorAdapter.java

/** * Constructs a new <code>DynamicAncestorAdapter</code> which will inform the <code>DynamicListening</code> about changes in visibility of the ancestor window of the component to which this adapter is added. * @param listener a <code>DynamicListening</code>whose <code>startListening</code> method is called when this adapter's host component's ancestor is shown or added to another component. the listener's <code>stopListening</code> method is called likewise when this adapter's host component's ancestor is hidden or removed from its parent. */ public DynamicAncestorAdapter(DynamicListening listener){ dynL=listener; winL=new WindowAdapter(){ public void windowOpened( WindowEvent e){ if (EventManager.DEBUG_EVENTS) { System.err.println("windowOpened() : " + e.getWindow().getClass().getName()); } if (!listening) startListening(); } public void windowClosed( WindowEvent e){ if (EventManager.DEBUG_EVENTS) { System.err.println("windowClosed() : " + e.getWindow().getClass().getName()); } if (listening) stopListening(); } } ; cmpL=new ComponentAdapter(){ public void componentShown( ComponentEvent e){ if (EventManager.DEBUG_EVENTS) { System.err.println("componentShown() : " + e.getComponent().getClass().getName()); } if (!listening) startListening(); } public void componentHidden( ComponentEvent e){ if (EventManager.DEBUG_EVENTS) { System.err.println("componentHidden() : " + e.getComponent().getClass().getName()); } if (listening) stopListening(); } } ; }
Example 68
From project Shepherd-Project, under directory /src/main/java/org/ecocean/interconnect/.
Source file: AboutInterconnect.java

public AboutInterconnect(){ if (frame != null) frame.dispose(); frame=new JFrame("About ECOCEAN Interconnect"); frame.setContentPane(this); frame.addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent e){ frame.dispose(); frame=null; } } ); frame.setSize(new Dimension(600,425)); frame.setResizable(false); frame.setLocation(200,200); ImageIcon imageIcon=new ImageIcon(this.getClass().getResource("/images/interconnect.gif")); frame.setIconImage(imageIcon.getImage()); frame.setVisible(true); }
Example 69
From project shiro, under directory /samples/spring-client/src/main/java/org/apache/shiro/samples/spring/ui/.
Source file: WebStartView.java

public void afterPropertiesSet() throws Exception { ClassPathResource resource=new ClassPathResource("logo.png"); ImageIcon icon=new ImageIcon(resource.getURL()); JLabel logo=new JLabel(icon); valueField=new JTextField(20); updateValueLabel(); saveButton=new JButton("Save Value"); saveButton.addActionListener(this); refreshButton=new JButton("Refresh Value"); refreshButton.addActionListener(this); JPanel valuePanel=new JPanel(new FlowLayout(FlowLayout.CENTER)); valuePanel.add(valueField); valuePanel.add(saveButton); valuePanel.add(refreshButton); secureMethod1Button=new JButton("Method #1"); secureMethod1Button.addActionListener(this); secureMethod2Button=new JButton("Method #2"); secureMethod2Button.addActionListener(this); secureMethod3Button=new JButton("Method #3"); secureMethod3Button.addActionListener(this); JPanel methodPanel=new JPanel(new FlowLayout(FlowLayout.CENTER)); methodPanel.add(secureMethod1Button); methodPanel.add(secureMethod2Button); methodPanel.add(secureMethod3Button); frame=new JFrame("Apache Shiro Sample Application"); frame.setSize(500,200); Container panel=frame.getContentPane(); panel.setLayout(new BorderLayout()); panel.add(logo,BorderLayout.NORTH); panel.add(valuePanel,BorderLayout.CENTER); panel.add(methodPanel,BorderLayout.SOUTH); frame.setVisible(true); frame.addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent e){ System.exit(0); } } ); }
Example 70
From project Sidecraft, under directory /src/com/freedsuniverse/sidecraft/.
Source file: Sidecraft.java

public static void main(String[] args){ final Frame mainFrame=new Frame(); mainFrame.setSize(800,400); final Sidecraft sideCraft=new Sidecraft(); mainFrame.add(sideCraft); mainFrame.setVisible(true); mainFrame.addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent event){ mainFrame.dispose(); } public void windowClosed( WindowEvent event){ sideCraft.stop(); System.exit(0); } } ); mainFrame.setTitle("Sidecraft"); mainFrame.setResizable(false); sideCraft.init(); sideCraft.start(); }
Example 71
From project sikuli, under directory /extensions/guide/src/main/java/org/sikuli/guide/.
Source file: BlobWindow.java

public BlobWindow(SikuliGuide guide){ this.guide=guide; setLayout(null); setBounds(guide.getBounds()); setAlwaysOnTop(true); mouseTracker=GlobalMouseMotionTracker.getInstance(); mouseTracker.addListener(this); Container panel=this.getContentPane(); panel.setBackground(null); setBackground(null); Env.getOSUtil().setWindowOpaque(this,false); getRootPane().setFocusable(false); addMouseListener(this); addWindowListener(new WindowAdapter(){ public void windowClosed( WindowEvent e){ mouseTracker.stop(); } } ); }
Example 72
From project skmclauncher, under directory /src/main/java/com/sk89q/mclauncher/launch/.
Source file: GameFrame.java

GameFrame(Dimension dim){ setTitle("Minecraft"); setBackground(Color.BLACK); try { InputStream in=Launcher.class.getResourceAsStream("/resources/icon.png"); if (in != null) { setIconImage(ImageIO.read(in)); } } catch ( IOException e) { } wrapper=new JPanel(); wrapper.setOpaque(false); wrapper.setPreferredSize(dim != null ? dim : new Dimension(854,480)); wrapper.setLayout(new BorderLayout()); add(wrapper,BorderLayout.CENTER); pack(); setLocationRelativeTo(null); addWindowListener(new WindowAdapter(){ @Override public void windowClosing( WindowEvent arg0){ if (applet != null) { applet.stop(); applet.destroy(); } System.exit(0); } } ); }
Example 73
From project SpoutcraftLauncher, under directory /src/main/java/org/spoutcraft/launcher/skin/.
Source file: ConsoleFrame.java

/** * Construct the frame. * @param numLines number of lines to show at a time * @param colorEnabled true to enable a colored console * @param trackProc process to track * @param killProcess true to kill the process on console close */ public ConsoleFrame(int numLines,boolean colorEnabled,final Process trackProc,final boolean killProcess){ super("Console"); this.numLines=numLines; this.colorEnabled=colorEnabled; this.trackProc=trackProc; this.highlightedAttributes=new SimpleAttributeSet(); StyleConstants.setForeground(highlightedAttributes,Color.BLACK); StyleConstants.setBackground(highlightedAttributes,Color.YELLOW); this.errorAttributes=new SimpleAttributeSet(); StyleConstants.setForeground(errorAttributes,new Color(200,0,0)); this.infoAttributes=new SimpleAttributeSet(); StyleConstants.setForeground(infoAttributes,new Color(200,0,0)); this.debugAttributes=new SimpleAttributeSet(); StyleConstants.setForeground(debugAttributes,Color.DARK_GRAY); setSize(new Dimension(650,400)); buildUI(); Compatibility.setIconImage(this,Toolkit.getDefaultToolkit().getImage(LoginFrame.spoutcraftIcon)); if (trackProc != null) { track(trackProc); } addMouseListener(this); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter(){ @Override public void windowClosing( WindowEvent event){ if (trackProc != null && killProcess) { trackProc.destroy(); if (loggerHandler != null) { rootLogger.removeHandler(loggerHandler); } event.getWindow().dispose(); } } } ); }
Example 74
From project SPREAD, under directory /release/tools/launch4j/demo/SimpleApp/src/net/sf/launch4j/example/.
Source file: SimpleApp.java

public SimpleApp(String[] args){ super("Java Application"); final int inset=100; Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize(); setBounds(inset,inset,screenSize.width - inset * 2,screenSize.height - inset * 2); JMenu menu=new JMenu("File"); menu.add(new JMenuItem("Open")); menu.add(new JMenuItem("Save")); JMenuBar mb=new JMenuBar(); mb.setOpaque(true); mb.add(menu); setJMenuBar(mb); this.addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent e){ System.exit(123); } } ); setVisible(true); StringBuffer sb=new StringBuffer("Java version: "); sb.append(System.getProperty("java.version")); sb.append("\nJava home: "); sb.append(System.getProperty("java.home")); sb.append("\nCurrent dir: "); sb.append(System.getProperty("user.dir")); if (args.length > 0) { sb.append("\nArgs: "); for (int i=0; i < args.length; i++) { sb.append(args[i]); sb.append(' '); } } JOptionPane.showMessageDialog(this,sb.toString(),"Info",JOptionPane.INFORMATION_MESSAGE); }
Example 75
From project syncany, under directory /syncany/src/org/syncany/gui/settings/.
Source file: SettingsDialog.java

private void initDialog(){ setResizable(false); setLocationRelativeTo(null); getRootPane().setDefaultButton(btnOkay); lblTopImage.setText(""); lblTopImage.setIcon(new ImageIcon(config.getResDir() + File.separator + "settings-top.png")); lblDonate.setText(""); lblDonate.setIcon(new ImageIcon(config.getResDir() + File.separator + "paypal-donate.png")); addWindowListener(new WindowAdapter(){ @Override public void windowClosing( WindowEvent e){ btnCancelActionPerformed(null); } } ); }
Example 76
From project thinklab, under directory /plugins/org.integratedmodelling.thinklab.thinkscape/src/org/integratedmodelling/thinkscape/.
Source file: ThinkScape.java

public void showThinkscape() throws ThinklabException { RenderGrowl renderPolicy=new RenderGrowl(); final KRPolicyThinkLab krPolicy=new KRPolicyThinkLab(session); final ThinkScapeGUI guiWindow=new ThinkScapeGUI(); ApplicationFrame.createApplicationFrame(this,guiWindow,krPolicy,renderPolicy,null); guiWindow.setBrowseMenuContainer(new CustomMenuContainer()); try { ApplicationFrame.getApplicationFrame().documentBase=new File(".").toURL(); } catch ( Exception e) { } this.addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent e){ System.exit(0); } } ); this.addWindowListener(new WindowAdapter(){ public void windowActivated( WindowEvent e){ guiWindow.getDisplay().getVisualization().run("layout"); } public void windowDeactivated( WindowEvent e){ guiWindow.getDisplay().getVisualization().cancel("layout"); } } ); session.addListener(new ThinkscapeSessionListener()); this.getContentPane().setLayout(new java.awt.BorderLayout()); this.getContentPane().add(guiWindow,java.awt.BorderLayout.CENTER); this.setSize(900,600); this.setVisible(true); }
Example 77
From project tiled-java, under directory /src/tiled/mapeditor/widget/.
Source file: FloatablePanel.java

public void setFloating(boolean floating){ if (frame != null && !floating) { prefs.putInt("width",frame.getWidth()); prefs.putInt("height",frame.getHeight()); prefs.putInt("x",frame.getX()); prefs.putInt("y",frame.getY()); frame.getContentPane().remove(child); frame.dispose(); frame=null; child.setBorder(null); contentPane.add(child,BorderLayout.CENTER); contentPane.setVisible(visible); } else if (frame == null && floating) { contentPane.setVisible(false); contentPane.remove(child); child.setBorder(new EmptyBorder(5,5,5,5)); frame=new JDialog(parent,titleLabel.getText()); frame.getContentPane().add(child); frame.addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent e){ setFloating(false); } } ); final int lastFrameWidth=prefs.getInt("width",0); final int lastFrameHeight=prefs.getInt("height",0); final int lastFrameX=prefs.getInt("x",0); final int lastFrameY=prefs.getInt("y",0); if (lastFrameWidth > 0) { frame.setSize(lastFrameWidth,lastFrameHeight); frame.setLocation(lastFrameX,lastFrameY); } else { frame.pack(); frame.setLocationRelativeTo(parent); } frame.setVisible(visible); } }
Example 78
From project trademaker, under directory /src/org/lifeform/optimizer/.
Source file: OptimizerDialog.java

public OptimizerDialog(final JFrame parent) throws Exception { super(parent); preferences=PreferencesHolder.getInstance(); init(); initParams(); addWindowListener(new WindowAdapter(){ public void windowOpened( final WindowEvent e){ strategyCombo.requestFocus(); } } ); pack(); assignListeners(); setLocationRelativeTo(null); int optimizerHeight=preferences.getInt(Defaults.OptimizerHeight); int optimizerWidth=preferences.getInt(Defaults.OptimizerWidth); int optimizerX=preferences.getInt(Defaults.OptimizerX); int optimizerY=preferences.getInt(Defaults.OptimizerY); if (optimizerX >= 0 && optimizerY >= 0 && optimizerHeight > 0 && optimizerWidth > 0) setBounds(optimizerX,optimizerY,optimizerWidth,optimizerHeight); setVisible(true); limitTableResize=0; }
Example 79
From project TraVis, under directory /src/travis/view/project/tree/popup/.
Source file: TreePopupMenu.java

private boolean userConfirmedDialog(final DialogPanel dialogPanel,String title){ JOptionPane pane=new JOptionPane(dialogPanel.getPanel(),JOptionPane.PLAIN_MESSAGE,JOptionPane.OK_CANCEL_OPTION,null); JDialog dialog=pane.createDialog(UIHelper.getInstance().getMainFrame(),title); dialog.addWindowListener(new WindowAdapter(){ @Override public void windowActivated( WindowEvent ev){ Timer timer=new Timer(50,new ActionListener(){ public void actionPerformed( ActionEvent ev){ dialogPanel.focusField(); } } ); timer.setRepeats(false); timer.start(); } } ); dialog.setVisible(true); Integer status=(Integer)pane.getValue(); dialogPanel.closing(); if (status == null) return false; return status == JOptionPane.OK_OPTION; }
Example 80
From project twinkle, under directory /src/main/java/ch/swingfx/twinkle/manager/.
Source file: SequentialNotificationManager.java

/** * Shows the notification * @param window window to show */ protected static void showNotification(final JWindow window){ try { sLock.lock(); sWindows.addLast(window); window.addWindowListener(new WindowAdapter(){ @Override public void windowClosed( WindowEvent e){ window.removeWindowListener(this); sWindowOpen=false; nextWindow(); } } ); nextWindow(); } finally { sLock.unlock(); } }
Example 81
From project upm-swing, under directory /src/com/_17od/upm/gui/.
Source file: DatabaseActions.java

/** * Prompt the user to enter a password * @return The password entered by the user or null of this hit escape/cancel */ private char[] askUserForPassword(String message){ char[] password=null; final JPasswordField masterPassword=new JPasswordField(""); JOptionPane pane=new JOptionPane(new Object[]{message,masterPassword},JOptionPane.QUESTION_MESSAGE,JOptionPane.OK_CANCEL_OPTION); JDialog dialog=pane.createDialog(mainWindow,Translator.translate("masterPassword")); dialog.addWindowFocusListener(new WindowAdapter(){ public void windowGainedFocus( WindowEvent e){ masterPassword.requestFocusInWindow(); } } ); dialog.show(); if (pane.getValue() != null && pane.getValue().equals(new Integer(JOptionPane.OK_OPTION))) { password=masterPassword.getPassword(); } return password; }
Example 82
From project zk-service-registry-server, under directory /lib/zk-service-registry-server/zookeeper-3.3.3/contrib/ZooInspector/src/java/org/apache/zookeeper/inspector/.
Source file: ZooInspector.java

/** * @param args - not used. The value of these parameters will have no effect on the application */ public static void main(String[] args){ try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); JFrame frame=new JFrame("ZooInspector"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final ZooInspectorPanel zooInspectorPanel=new ZooInspectorPanel(new ZooInspectorManagerImpl()); frame.addWindowListener(new WindowAdapter(){ @Override public void windowClosed( WindowEvent e){ super.windowClosed(e); zooInspectorPanel.disconnect(true); } } ); frame.setContentPane(zooInspectorPanel); frame.setSize(1024,768); frame.setVisible(true); } catch ( Exception e) { LoggerFactory.getLogger().error("Error occurred loading ZooInspector",e); JOptionPane.showMessageDialog(null,"ZooInspector failed to start: " + e.getMessage(),"Error",JOptionPane.ERROR_MESSAGE); } }
Example 83
From project zookeeper, under directory /src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/.
Source file: ZooInspector.java

/** * @param args - not used. The value of these parameters will have no effect on the application */ public static void main(String[] args){ try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); JFrame frame=new JFrame("ZooInspector"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); final ZooInspectorPanel zooInspectorPanel=new ZooInspectorPanel(new ZooInspectorManagerImpl(),new IconResource()); frame.addWindowListener(new WindowAdapter(){ @Override public void windowClosed( WindowEvent e){ super.windowClosed(e); zooInspectorPanel.disconnect(true); } } ); frame.setContentPane(zooInspectorPanel); frame.setSize(1024,768); frame.setVisible(true); } catch ( Exception e) { LoggerFactory.getLogger().error("Error occurred loading ZooInspector",e); JOptionPane.showMessageDialog(null,"ZooInspector failed to start: " + e.getMessage(),"Error",JOptionPane.ERROR_MESSAGE); } }
Example 84
From project Zypr-Reference-Client---Java, under directory /source/net/zypr/gui/.
Source file: ApplicationFrame.java

private void jbInit() throws Exception { _mainPanel=new MainPanel(); this.setSize(new Dimension(Configuration.getInstance().getIntegerProperty("window-width",800),Configuration.getInstance().getIntegerProperty("window-height",480))); String appName=Branding.getInstance().getStringProperty("application-name","Zypr"); this.setTitle(appName); this.setResizable(false); this.setUndecorated(!Configuration.getInstance().getBooleanProperty("window-show-frame",true)); this.setBackground(Color.BLACK); setContentPane(_mainPanel); this.addWindowListener(new WindowAdapter(){ public void windowClosing( WindowEvent windowEvent){ this_windowClosing(windowEvent); } } ); }
Example 85
From project Sphero-Desktop-API, under directory /bluecove-bluez/org/freedesktop/dbus/viewer/.
Source file: DBusViewer.java

/** * Create the DBusViewer * @param connectionTypes The map of connection types */ public DBusViewer(final Map<String,Integer> connectionTypes){ connections=new ArrayList<DBusConnection>(connectionTypes.size()); SwingUtilities.invokeLater(new Runnable(){ @SuppressWarnings("synthetic-access") public void run(){ final JTabbedPane tabbedPane=new JTabbedPane(); addTabs(tabbedPane,connectionTypes); final JFrame frame=new JFrame("Dbus Viewer"); frame.setContentPane(tabbedPane); frame.setSize(600,400); frame.addWindowListener(new WindowAdapter(){ @Override public void windowClosing( WindowEvent e){ frame.dispose(); for ( DBusConnection connection : connections) { connection.disconnect(); } System.exit(0); } } ); frame.setVisible(true); } } ); }