Java Code Examples for java.awt.event.WindowEvent

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

From project srec, under directory /core/src/main/java/com/github/srec/rec/component/.

Source file: WindowActivationRecorder.java

  18 
vote

public void eventDispatched(AWTEvent event){
  if (event instanceof WindowEvent) {
    WindowEvent windowEvent=(WindowEvent)event;
    if (windowEvent.getID() == WindowEvent.WINDOW_ACTIVATED) {
      if (windowEvent.getWindow() instanceof JFrame) {
        JFrame frame=(JFrame)windowEvent.getWindow();
        recorder.record(new MethodCallEventCommand("window_activate",frame,null,createParameterMap("locator",frame.getTitle())));
      }
    }
  }
}
 

Example 2

From project ISAcreator, under directory /src/main/java/org/isatools/isacreator/effects/.

Source file: HUDTitleBar.java

  17 
vote

private void close(){
  Window w=SwingUtilities.getWindowAncestor(this);
  if (dispose) {
    w.dispatchEvent(new WindowEvent(w,WindowEvent.WINDOW_CLOSING));
    w.dispose();
  }
 else {
    w.setVisible(false);
  }
}
 

Example 3

From project jchempaint, under directory /src/main/org/openscience/jchempaint/.

Source file: JChemPaintPanel.java

  17 
vote

/** 
 * Closes all currently opened JCP instances.
 */
public static void closeAllInstances(){
  int instancesNumber=instances.size();
  for (int i=instancesNumber - 1; i >= 0; i--) {
    JFrame frame=(JFrame)instances.get(i).getTopLevelContainer();
    WindowListener[] wls=(WindowListener[])(frame.getListeners(WindowListener.class));
    wls[0].windowClosing(new WindowEvent(frame,WindowEvent.WINDOW_CLOSING));
  }
}
 

Example 4

From project Agot-Java, under directory /src/main/java/got/test/.

Source file: TestMainUI.java

  16 
vote

public TestMainUI(){
  this.setSize(960,720);
  this.addWindowStateListener(new WindowStateListener(){
    @Override public void windowStateChanged(    WindowEvent e){
      state=e.getNewState();
      System.out.println(e.getOldState());
      System.out.println(e.getNewState());
    }
  }
);
}
 

Example 5

From project addis, under directory /application/src/main/java/org/drugis/addis/gui/.

Source file: AddisWindow.java

  15 
vote

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 6

From project autopsy, under directory /Core/src/org/sleuthkit/autopsy/ingest/.

Source file: IngestDialogPanel.java

  15 
vote

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 7

From project BDSup2Sub, under directory /src/main/java/bdsup2sub/gui/support/.

Source file: Progress.java

  15 
vote

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 8

From project BMach, under directory /src/bmach/ui/gui/.

Source file: BMachHelpDialog.java

  15 
vote

/** 
 * @param args the command line arguments
 */
public static void main(String args[]){
  java.awt.EventQueue.invokeLater(new Runnable(){
    public void run(){
      BMachHelpDialog dialog=new BMachHelpDialog(new javax.swing.JFrame(),true);
      dialog.addWindowListener(new java.awt.event.WindowAdapter(){
        public void windowClosing(        java.awt.event.WindowEvent e){
          System.exit(0);
        }
      }
);
      dialog.setVisible(true);
    }
  }
);
}
 

Example 9

From project Calendar-Application, under directory /com/toedter/calendar/demo/.

Source file: JCalendarDemo.java

  15 
vote

/** 
 * 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 10

From project ceres, under directory /ceres-jai/src/test/java/com/bc/ceres/jai/operator/.

Source file: GameOfLifeTestMain.java

  15 
vote

public void run(){
  image=new BufferedImage(512,512,BufferedImage.TYPE_BYTE_GRAY);
  final byte[] bytes=((DataBufferByte)image.getRaster().getDataBuffer()).getData();
  for (int i=0; i < bytes.length; i++) {
    bytes[i]=(byte)(Math.random() < 0.5 ? 0 : 255);
  }
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      label=new JLabel(new ImageIcon(image));
      frame=new JFrame("GoL");
      frame.getContentPane().add(label);
      frame.pack();
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.addWindowListener(new WindowAdapter(){
        @Override public void windowOpened(        WindowEvent e){
          final Timer timer=new Timer();
          timer.schedule(new MyTimerTask(),1000,IMAGE_UPDATE_PERIOD);
        }
      }
);
      frame.setVisible(true);
    }
  }
);
}
 

Example 11

From project codjo-control, under directory /codjo-control-gui/src/test/java/net/codjo/control/gui/plugin/.

Source file: DefaultQuarantineDetailWindowTest.java

  15 
vote

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 12

From project codjo-data-process, under directory /codjo-data-process-gui/src/main/java/net/codjo/dataprocess/gui/launcher/configuration/.

Source file: ConfigurationDialog.java

  15 
vote

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 13

From project contribution_eevolution_smart_browser, under directory /client/src/org/compiere/apps/.

Source file: WindowManager.java

  15 
vote

public void windowClosed(WindowEvent e){
  Window w=e.getWindow();
  if (w instanceof CFrame) {
    w.removeComponentListener(this);
    w.removeWindowListener(this);
    windowManager.remove((CFrame)w);
  }
}
 

Example 14

From project Custom-Salem, under directory /src/haven/.

Source file: MainFrame.java

  15 
vote

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 15

From project dawn-isencia, under directory /com.isencia.passerelle.commons/src/main/java/com/isencia/util/swing/calendar/.

Source file: DateSelector.java

  15 
vote

static public void main(String[] s){
  WindowListener l=new WindowAdapter(){
    public void windowClosing(    WindowEvent e){
      System.exit(0);
    }
  }
;
  try {
    JFrame frame=new JFrame("JCalendar Demo");
    frame.addWindowListener(l);
    DateSelector demo=new DateSelector();
    demo.init();
    String sdate="02/02/2002";
    SimpleDateFormat sdf=new SimpleDateFormat("dd/MM/yyyy");
    Date d=sdf.parse(sdate);
    demo.setDate(d);
    frame.getContentPane().add(demo);
    frame.pack();
    frame.setVisible(true);
  }
 catch (  ParseException e) {
  }
}
 

Example 16

From project drools-planner, under directory /drools-planner-examples/src/main/java/org/drools/planner/examples/common/swingui/.

Source file: SolverAndPersistenceFrame.java

  15 
vote

private void registerListeners(){
  solutionBusiness.registerForBestSolutionChanges(this);
  addWindowListener(new WindowAdapter(){
    public void windowClosing(    WindowEvent e){
      solutionBusiness.terminateSolvingEarly();
    }
  }
);
}
 

Example 17

From project droolsjbpm-integration, under directory /droolsjbpm-integration-examples/src/main/java/org/drools/examples/conway/.

Source file: AbstractRunConway.java

  15 
vote

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 18

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

  15 
vote

@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 19

From project encog-java-workbench, under directory /src/main/java/org/encog/workbench/dialogs/.

Source file: DirChooser.java

  15 
vote

/** 
 * Handle dialog closing event.
 */
protected void processWindowEvent(WindowEvent e){
  int id=e.getID();
  if (id == WindowEvent.WINDOW_CLOSING) {
    selectedDir=null;
    dispose();
  }
 else {
    super.processWindowEvent(e);
  }
}
 

Example 20

From project engine, under directory /main/com/midtro/platform/.

Source file: FrameLauncher.java

  15 
vote

/** 
 * {@inheritDoc}
 */
@Override public void processWindowEvent(final WindowEvent w){
  super.processWindowEvent(w);
  if (w.getID() == WindowEvent.WINDOW_CLOSING) {
    engine.running.set(false);
  }
}
 

Example 21

From project FBReaderJ, under directory /obsolete/swing/src/org/geometerplus/zlibrary/ui/swing/dialogs/.

Source file: ZLSwingDialog.java

  15 
vote

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 22

From project flyingsaucer, under directory /flying-saucer-examples/src/main/java/.

Source file: AddNodeToDocument.java

  15 
vote

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 23

From project FML, under directory /common/cpw/mods/fml/relauncher/.

Source file: Downloader.java

  15 
vote

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 24

From project formic, under directory /src/java/org/formic/wizard/impl/gui/.

Source file: GuiWizard.java

  15 
vote

/** 
 * {@inheritDoc}
 * @see org.pietschy.wizard.Wizard#showInFrame(String,Image)
 */
public void showInFrame(String title,Image image){
  JFrame window=new JFrame(title);
  Dimension dimension=Installer.getDimension();
  window.setMinimumSize(dimension);
  window.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
  window.setIconImage(image);
  ((RootPaneContainer)window).getContentPane().add(this);
  window.addWindowListener(new WindowAdapter(){
    public void windowClosing(    WindowEvent e){
      getCancelAction().actionPerformed(null);
    }
  }
);
  WizardFrameCloser.bind(this,window);
  window.setLocationRelativeTo(null);
  window.setVisible(true);
  window.toFront();
  window.setSize(dimension);
  window.pack();
}
 

Example 25

From project freemind, under directory /freemind/accessories/plugins/dialogs/.

Source file: ChooseFormatPopupDialog.java

  15 
vote

/** 
 * This method initializes this
 * @return void
 */
private void initialize(String dialogTitle){
  this.setTitle(mController.getText(dialogTitle));
  JPanel contentPane=getJContentPane();
  this.setContentPane(contentPane);
  setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
  addWindowListener(new WindowAdapter(){
    public void windowClosing(    WindowEvent we){
      cancelPressed();
    }
  }
);
  addKeyListener(this);
  Action action=new AbstractAction(){
    public void actionPerformed(    ActionEvent arg0){
      cancelPressed();
    }
  }
;
  Tools.addEscapeActionToDialog(this,action);
  pack();
  mController.decorateDialog(this,WINDOW_PREFERENCE_STORAGE_PROPERTY);
}
 

Example 26

From project gitblit, under directory /src/com/gitblit/client/.

Source file: GitblitManager.java

  15 
vote

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 27

From project GraduationProject, under directory /tesseract-android-tools/external/tesseract-3.00/java/com/google/scrollview/events/.

Source file: SVEventHandler.java

  15 
vote

/** 
 * A window is closed (by the 'x') - create an SVET_DESTROY event. If it was the last open Window, also send an SVET_EXIT event (but do not exit unless the client says so).
 */
public void windowClosing(WindowEvent e){
  processEvent(new SVEvent(SVEventType.SVET_DESTROY,svWindow,lastXMove,lastYMove,0,0,null));
  e.getWindow().dispose();
  SVWindow.nrWindows--;
  if (SVWindow.nrWindows == 0) {
    processEvent(new SVEvent(SVEventType.SVET_EXIT,svWindow,lastXMove,lastYMove,0,0,null));
  }
}
 

Example 28

From project grid-goggles, under directory /Dependent Libraries/controlP5/src/controlP5/.

Source file: PAppletWindow.java

  15 
vote

public void windowActivated(WindowEvent e){
  isLoop=true;
  loop();
  try {
    controlP5.deactivateControllers();
  }
 catch (  NullPointerException nullPointer) {
  }
}
 

Example 29

From project gs-core, under directory /src/org/graphstream/ui/swingViewer/.

Source file: DefaultView.java

  15 
vote

public void windowClosing(WindowEvent e){
  graph.addAttribute("ui.viewClosed",getId());
switch (viewer.getCloseFramePolicy()) {
case CLOSE_VIEWER:
    viewer.removeView(getId());
  break;
case HIDE_ONLY:
if (frame != null) frame.setVisible(false);
break;
case EXIT:
System.exit(0);
default :
throw new RuntimeException(String.format("The %s view is not up to date, do not know %s CloseFramePolicy.",getClass().getName(),viewer.getCloseFramePolicy()));
}
}
 

Example 30

From project Haven-and-Hearth-client-modified-by-Ender, under directory /src/haven/.

Source file: MainFrame.java

  15 
vote

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 31

From project Holo-Edit, under directory /holoedit/functions/.

Source file: Algorithm.java

  15 
vote

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 32

From project HomeNet.me-App, under directory /src/homenetapp/.

Source file: HomeNetAppGui.java

  15 
vote

public void windowClosing(WindowEvent evt){
  System.out.println("Checking New Config");
  System.out.println("rebooting app with new config");
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      startHomeNetApp();
    }
  }
);
}
 

Example 33

From project hudsontrayapp-plugin, under directory /client-common/src/main/java/org/hudson/trayapp/gui/.

Source file: MainFrame.java

  15 
vote

/** 
 * This method initializes this
 * @return void
 */
private void initialize(){
  this.setSize(580,797);
  this.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/org/hudson/trayapp/gui/icons/16x16/hudson.png")));
  this.setContentPane(getJContentPane());
  this.setTitle("Hudson Tray Application");
  addWindowStateListener(new WindowStateListener(){
    public void windowStateChanged(    WindowEvent e){
      if (e.getID() == WindowEvent.WINDOW_STATE_CHANGED && e.getNewState() == Frame.ICONIFIED) {
        setVisible(false);
        setState(Frame.NORMAL);
        dispose();
      }
    }
  }
);
}
 

Example 34

From project ib-ruby, under directory /misc/IBController 2-9-0/src/ibcontroller/.

Source file: GatewayLoginFrameHandler.java

  15 
vote

public void handleWindow(final Window window,int eventID){
  if (eventID != WindowEvent.WINDOW_OPENED)   return;
  if (!setFieldsAndClick(window)) {
    System.err.println("IBController: could not login because we could not find one of the controls.");
  }
}
 

Example 35

From project imageflow, under directory /src/de/danielsenff/imageflow/models/unit/.

Source file: ImportUnitElement.java

  15 
vote

/** 
 * Displays a Popup-Window with the properties, that can be edited for this UnitElement.
 * @param point leave null to center on screen
 */
public void showProperties(Point point){
  if (this.propertiesDialog == null) {
    this.propertiesDialog=new ImportUnitPropertiesDialog(this,point);
    this.propertiesDialog.addWindowListener(new WindowListener(){
      public void windowOpened(      WindowEvent e){
      }
      public void windowIconified(      WindowEvent e){
      }
      public void windowDeiconified(      WindowEvent e){
      }
      public void windowDeactivated(      WindowEvent e){
      }
      public void windowClosing(      WindowEvent e){
      }
      public void windowClosed(      WindowEvent e){
        e.getWindow().dispose();
      }
      public void windowActivated(      WindowEvent e){
      }
    }
);
  }
 else   if (!propertiesDialog.isVisible()) {
    this.propertiesDialog.show();
  }
 else {
    this.propertiesDialog.toFront();
  }
}
 

Example 36

From project ISAvalidator-ISAconverter-BIImanager, under directory /val_conv_manager_gui/src/main/java/org/isatools/gui/.

Source file: TitlePanel.java

  15 
vote

@Override public void windowActivated(WindowEvent ev){
  if (showClose) {
    closeButton.setIcon(new ImageIcon(close));
  }
  if (showIconify) {
    iconifyButton.setIcon(new ImageIcon(minimize));
  }
  getRootPane().repaint();
}
 

Example 37

From project jASM_16, under directory /src/main/java/de/codesourcery/jasm16/ide/ui/viewcontainers/.

Source file: ViewFrame.java

  15 
vote

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 38

From project Java3DTest, under directory /Java3D/src/.

Source file: CurrentShapesPanel.java

  15 
vote

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 39

From project JavaOSC, under directory /modules/ui/src/main/java/com/illposed/osc/ui/.

Source file: Main.java

  15 
vote

public Main(){
  super("OSC");
  addWindowListener(new WindowAdapter(){
    public void windowClosing(    WindowEvent e){
      myUi.doSendGlobalOff(1000,1001,1002);
      System.exit(0);
    }
  }
);
  addOscUI();
  setVisible(true);
}
 

Example 40

From project jftp, under directory /src/main/java/com/myjavaworld/jftp/.

Source file: JFTP.java

  15 
vote

public void windowOpened(WindowEvent evt){
  if (prefs.getWindowBounds() == null) {
    setExtendedState(Frame.MAXIMIZED_BOTH);
  }
  if (prefs.getCheckForUpdates()) {
    AutoUpdater updater=new AutoUpdater(this,true,false);
    updater.start();
  }
}
 

Example 41

From project JGit, under directory /org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/.

Source file: Glog.java

  15 
vote

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

From project jmd, under directory /src/org/apache/bcel/verifier/.

Source file: VerifierAppFrame.java

  15 
vote

/** 
 * Overridden to stop the application on a closing window. 
 */
protected void processWindowEvent(WindowEvent e){
  super.processWindowEvent(e);
  if (e.getID() == WindowEvent.WINDOW_CLOSING) {
    System.exit(0);
  }
}
 

Example 43

From project jreepad, under directory /src/jreepad/ui/.

Source file: PasswordDialog.java

  15 
vote

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: DlgClose.java

  15 
vote

/** 
 * @param aEvent Window event generated.
 */
public void windowClosing(WindowEvent aEvent){
  if (aEvent.getSource() instanceof Window) {
    Window win=(Window)(aEvent.getSource());
    win.setVisible(false);
  }
}
 

Example 45

From project jsecurity, under directory /samples/spring/src/main/java/org/apache/ki/samples/spring/ui/.

Source file: WebStartView.java

  15 
vote

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 jSite, under directory /src/main/java/de/todesbaum/jsite/gui/.

Source file: KeyDialog.java

  15 
vote

/** 
 * 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 47

From project jsmaa, under directory /main/src/main/java/fi/smaa/jsmaa/.

Source file: JSMAAMain.java

  15 
vote

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 48

From project jumpnevolve, under directory /lib/slick/src/org/newdawn/slick/tests/.

Source file: CanvasContainerTest.java

  15 
vote

/** 
 * 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 49

From project kabeja, under directory /blocks/svg/src/main/java/org/kabeja/processing/scripting/impl/.

Source file: JavaScriptShell.java

  15 
vote

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 50

From project KindleTERM, under directory /src/j2me/awt/.

Source file: AwtMain.java

  15 
vote

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 51

From project Laserschein, under directory /src/laserschein/ui/.

Source file: ControlWindow.java

  15 
vote

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 52

From project LateralGM, under directory /org/lateralgm/jedit/.

Source file: CompletionMenu.java

  15 
vote

public CompletionMenu(Frame f,JEditTextArea a,int offset,int pos,int length,Completion[] c){
  super(f);
  area=a;
  wordOffset=offset;
  wordPos=pos;
  wordLength=length;
  completions=c;
  keyHandler=new KeyHandler();
  completionList=new JList();
  completionList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  completionList.addKeyListener(keyHandler);
  completionList.addMouseListener(new MouseAdapter(){
    public void mouseClicked(    MouseEvent e){
      if (apply())       e.consume();
 else       dispose();
    }
  }
);
  scroll=new JScrollPane(completionList);
  scroll.setBorder(BorderFactory.createLineBorder(Color.BLACK));
  add(scroll);
  getContentPane().setFocusTraversalKeysEnabled(false);
  addWindowFocusListener(new WindowFocusListener(){
    public void windowGainedFocus(    WindowEvent e){
      area.setCaretVisible(true);
    }
    public void windowLostFocus(    WindowEvent e){
      dispose();
    }
  }
);
  reset();
}
 

Example 53

From project leaves, under directory /libraries/controlP5/src/controlP5/.

Source file: PAppletWindow.java

  15 
vote

public void windowActivated(WindowEvent e){
  isLoop=true;
  loop();
  try {
    controlP5.deactivateControllers();
  }
 catch (  NullPointerException nullPointer) {
  }
}
 

Example 54

From project lilith, under directory /lilith/src/main/java/de/huxhorn/lilith/swing/.

Source file: AboutDialog.java

  15 
vote

public AboutDialog(Frame owner,String title,String appName){
  super(owner,title,false);
  wasScrolling=true;
  setLayout(new BorderLayout());
  InputStream is=MainFrame.class.getResourceAsStream("/about/aboutText.txt");
  String aboutText=null;
  final Logger logger=LoggerFactory.getLogger(AboutDialog.class);
  if (is != null) {
    try {
      aboutText=IOUtils.toString(is,"UTF-8");
    }
 catch (    IOException e) {
      if (logger.isErrorEnabled())       logger.error("Exception while loading aboutText!! *grrr*");
    }
  }
  try {
    aboutPanel=new AboutPanel(MainFrame.class.getResource("/about/lilith_big.jpg"),new Rectangle(50,50,400,200),aboutText,MainFrame.class.getResource("/about/lilith.jpg"),appName,20);
    add(aboutPanel,BorderLayout.CENTER);
  }
 catch (  IOException e) {
    if (logger.isErrorEnabled())     logger.error("Exception creating about panel!!");
  }
  setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
  addWindowListener(new WindowAdapter(){
    /** 
 * Invoked when a window is in the process of being closed. The close operation can be overridden at this point.
 */
    @Override public void windowClosing(    WindowEvent e){
      setVisible(false);
    }
  }
);
}
 

Example 55

From project limelight, under directory /src/limelight/ui/model/.

Source file: AlertFrameManager.java

  15 
vote

public synchronized void windowClosed(WindowEvent e){
  StageFrame frame=((StageFrame)e.getSource());
  if (lastFrameAdded == frame)   lastFrameAdded=null;
  if (activeFrame == frame)   activeFrame=null;
  frames.remove(frame);
  if (frame.getStage().isVital() && !hasVisibleVitalFrame())   context.attemptShutdown();
}
 

Example 56

From project LUScheduling, under directory /src/org/learningu/scheduling/.

Source file: LookupApplication.java

  15 
vote

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 57

From project Maimonides, under directory /src/com/codeko/apps/maimonides/.

Source file: MaimonidesApp.java

  15 
vote

@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 58

From project maple-ide, under directory /build/windows/launcher/launch4j/demo/SimpleApp/src/net/sf/launch4j/example/.

Source file: SimpleApp.java

  15 
vote

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 59

From project medsavant, under directory /medsavant/MedSavantClient/src/org/ut/biolab/medsavant/view/dialog/.

Source file: ConfirmDialog.java

  15 
vote

public ConfirmDialog(String title,String message){
  optionPane=new JOptionPane(message,JOptionPane.WARNING_MESSAGE,JOptionPane.YES_NO_OPTION);
  dialog=new JDialog();
  dialog.setContentPane(optionPane);
  dialog.setTitle(title);
  dialog.pack();
  dialog.setLocationRelativeTo(null);
  dialog.setModalityType(ModalityType.APPLICATION_MODAL);
  dialog.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
  dialog.addWindowListener(new WindowAdapter(){
    public void windowClosing(    WindowEvent we){
      optionPane.setValue(JOptionPane.NO_OPTION);
    }
  }
);
  optionPane.addPropertyChangeListener(new PropertyChangeListener(){
    public void propertyChange(    PropertyChangeEvent e){
      dialog.setVisible(false);
    }
  }
);
  dialog.setVisible(true);
  int value=((Integer)optionPane.getValue()).intValue();
  if (value == JOptionPane.NO_OPTION) {
    confirmed=false;
  }
 else {
    confirmed=true;
  }
}
 

Example 60

From project movsim, under directory /viewer/src/main/java/org/movsim/viewer/util/.

Source file: SwingHelper.java

  15 
vote

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 61

From project multibit, under directory /src/main/java/org/multibit/viewsystem/swing/.

Source file: MultiBitFrame.java

  15 
vote

@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 62

From project narya, under directory /core/src/test/java/com/threerings/crowd/client/.

Source file: JabberClient.java

  15 
vote

/** 
 * 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 63

From project nenya, under directory /core/src/main/java/com/threerings/util/.

Source file: KeyDispatcher.java

  15 
vote

public void windowLostFocus(WindowEvent e){
  if (!_downKeys.isEmpty()) {
    long now=System.currentTimeMillis();
    for (    KeyEvent down : _downKeys.values()) {
      KeyEvent up=new KeyEvent(down.getComponent(),KeyEvent.KEY_RELEASED,now,down.getModifiers(),down.getKeyCode(),down.getKeyChar(),down.getKeyLocation());
      for (int ii=0, nn=_listeners.size(); ii < nn; ii++) {
        _listeners.get(ii).keyReleased(up);
      }
    }
    _downKeys.clear();
  }
}
 

Example 64

From project niravCS2103, under directory /CS2103/src/gui/mainWindow/.

Source file: MainJFrame.java

  15 
vote

/** 
 * 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 65

From project OlympicPhoneBox, under directory /src/olympic/screens/.

Source file: ScreenManager.java

  15 
vote

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 66

From project OMS3, under directory /src/main/java/ngmf/ui/.

Source file: PEditor.java

  15 
vote

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 67

From project OpenLogViewer, under directory /src/main/java/org/diyefi/openlogviewer/.

Source file: OpenLogViewer.java

  15 
vote

public static void setupWindowKeyBindings(final JFrame window){
  final Action closeWindow=new AbstractAction(){
    private static final long serialVersionUID=1L;
    public void actionPerformed(    final ActionEvent e){
      final WindowEvent wev=new WindowEvent(window,WindowEvent.WINDOW_CLOSING);
      Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(wev);
    }
  }
;
  boolean isMainApp=false;
  if (window instanceof OpenLogViewer) {
    isMainApp=true;
  }
  if (IS_WINDOWS || IS_LINUX) {
    window.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(Keys.CONTROL_W),Keys.CLOSE_WINDOW);
  }
 else   if (IS_MAC_OS_X) {
    window.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(Keys.COMMAND_W),Keys.CLOSE_WINDOW);
  }
  if (IS_LINUX && isMainApp) {
    window.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(Keys.CONTROL_Q),Keys.CLOSE_WINDOW);
  }
  window.getRootPane().getActionMap().put(Keys.CLOSE_WINDOW,closeWindow);
}
 

Example 68

From project OpenSettlers, under directory /src/java/soc/client/.

Source file: NewGameOptionsFrame.java

  15 
vote

/** 
 * 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 69

From project openwebbeans, under directory /samples/standalone-sample/src/main/java/org/apache/webbeans/se/sample/.

Source file: Boot.java

  15 
vote

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 70

From project org.openscada.external, under directory /org.eclipse.albireo/src/org/eclipse/albireo/core/.

Source file: AwtEnvironment.java

  15 
vote

/** 
 * 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 71

From project OWASP-WebScarab, under directory /src/org/owasp/webscarab/ui/swing/editors/.

Source file: SearchDialog.java

  15 
vote

/** 
 * 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 72

From project pegadi, under directory /client/src/main/java/org/pegadi/client/.

Source file: ApplicationLauncher.java

  15 
vote

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 73

From project PenguinCMS, under directory /PenguinCMS/tests/vendor/sahi/src/net/sf/sahi/ui/.

Source file: Dashboard.java

  15 
vote

private void addOnExit(){
  addWindowListener(new WindowAdapter(){
    public void windowClosing(    WindowEvent we){
      stopProxy();
      ProxySwitcher.revertSystemProxy(true);
      System.exit(0);
    }
  }
);
}
 

Example 74

From project project_bpm, under directory /Processing/libraries/controlP5/src/controlP5/.

Source file: PAppletWindow.java

  15 
vote

public void windowActivated(WindowEvent e){
  isLoop=true;
  loop();
  try {
    controlP5.deactivateControllers();
  }
 catch (  NullPointerException nullPointer) {
  }
}
 

Example 75

From project QuakeInjector, under directory /src/de/haukerehfeld/quakeinjector/.

Source file: QuakeInjector.java

  15 
vote

@Override public void windowClosing(WindowEvent e){
  if (installer.working()) {
    String msg="There are maps left in the install queue. Wait until they are finished installing?";
    Object[] options={"Wait","Close immediately"};
    int optionDialog=JOptionPane.showOptionDialog(QuakeInjector.this,msg,"Maps still installing",JOptionPane.YES_NO_OPTION,JOptionPane.WARNING_MESSAGE,null,options,options[0]);
    if (optionDialog == 0) {
      setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
      return;
    }
 else {
      installer.cancelAll();
      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
  }
  windowClosed(e);
}
 

Example 76

From project RegionalTransitArchitecture, under directory /Desktop_App/Source_Code/edu/usf/cutr/fdot7/gui/.

Source file: SessionForm.java

  15 
vote

/** 
 * 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 77

From project replication-benchmarker, under directory /src/main/java/jbenchmarker/.

Source file: TraceViewer.java

  15 
vote

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 78

From project RomRaider, under directory /3rdparty/launch4j/demo/SimpleApp/src/net/sf/launch4j/example/.

Source file: SimpleApp.java

  15 
vote

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 79

From project rpiplanner, under directory /src/rpiplanner/.

Source file: Main.java

  15 
vote

@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 80

From project salem, under directory /src/haven/.

Source file: MainFrame.java

  15 
vote

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 81

From project ScissLib, under directory /src/main/java/de/sciss/app/.

Source file: DynamicAncestorAdapter.java

  15 
vote

/** 
 * 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 82

From project sgl-Editor, under directory /src/de/moonshade/osbe/gui/.

Source file: DefaultGUI.java

  15 
vote

@Override public void onClose(Main handler){
  windowClosingHandler=handler;
  mainFrame.addWindowListener(new WindowListener(){
    @Override public void windowActivated(    WindowEvent e){
    }
    @Override public void windowClosed(    WindowEvent e){
    }
    @Override public void windowClosing(    WindowEvent e){
      windowClosingHandler.onGUIClosed();
    }
    @Override public void windowDeactivated(    WindowEvent e){
    }
    @Override public void windowDeiconified(    WindowEvent e){
    }
    @Override public void windowIconified(    WindowEvent e){
    }
    @Override public void windowOpened(    WindowEvent e){
    }
  }
);
}
 

Example 83

From project Shepherd-Project, under directory /src/main/java/org/ecocean/interconnect/.

Source file: AboutInterconnect.java

  15 
vote

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 84

From project shiro, under directory /samples/spring-client/src/main/java/org/apache/shiro/samples/spring/ui/.

Source file: WebStartView.java

  15 
vote

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 85

From project Sidecraft, under directory /src/com/freedsuniverse/sidecraft/.

Source file: Sidecraft.java

  15 
vote

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 86

From project sikuli, under directory /extensions/guide/src/main/java/org/sikuli/guide/.

Source file: BlobWindow.java

  15 
vote

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 87

From project skmclauncher, under directory /src/main/java/com/sk89q/mclauncher/launch/.

Source file: GameFrame.java

  15 
vote

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 88

From project SMC, under directory /plugin-testing/src/main/java/example_4/.

Source file: ConfigDialog.java

  15 
vote

private void createDialogue(){
  _frame=new JFrame();
  Component contents=createComponents();
  _frame.getContentPane().add(contents,BorderLayout.CENTER);
  _frame.addWindowListener(new WindowAdapter(){
    @Override public void windowClosing(    WindowEvent e){
      setSliders();
      _frame.setVisible(false);
    }
  }
);
  _frame.pack();
  _frame.setVisible(false);
  setSliders();
  return;
}
 

Example 89

From project smc-fork, under directory /examples/Ant/EX5/src/.

Source file: taskdemo.java

  15 
vote

public static void main(String[] args){
  try {
    UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
  }
 catch (  Exception e) {
  }
  TaskManager taskManager=new TaskManager();
  JFrame frame=new JFrame("Task Demo");
  taskdemo app=new taskdemo();
  app.createComponents(frame.getContentPane());
  frame.addWindowListener(new WindowAdapter(){
    public void windowClosing(    WindowEvent e){
      System.exit(0);
    }
  }
);
  frame.pack();
  frame.setVisible(true);
}
 

Example 90

From project SPDX-Tools, under directory /lib-source/grddl-src/com/hp/hpl/jena/grddl/license/.

Source file: Contract.java

  15 
vote

public void windowStateChanged(WindowEvent event){
  if (event.getNewState() == WindowEvent.WINDOW_CLOSING) {
    System.err.println("closing");
    System.exit(-1);
  }
}
 

Example 91

From project Sphero-Desktop-API, under directory /bluecove-bluez/org/freedesktop/dbus/viewer/.

Source file: DBusViewer.java

  15 
vote

/** 
 * 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);
    }
  }
);
}
 

Example 92

From project SpoutcraftLauncher, under directory /src/main/java/org/spoutcraft/launcher/.

Source file: GameLauncher.java

  15 
vote

public void windowClosing(WindowEvent e){
  SpoutcraftLauncher.destroyConsole();
  if (this.minecraft != null) {
    this.minecraft.stop();
    this.minecraft.destroy();
    try {
      Thread.sleep(1000);
    }
 catch (    InterruptedException e1) {
    }
  }
  System.out.println("Exiting Spoutcraft");
  this.dispose();
  System.exit(0);
}
 

Example 93

From project SPREAD, under directory /release/tools/launch4j/demo/SimpleApp/src/net/sf/launch4j/example/.

Source file: SimpleApp.java

  15 
vote

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 94

From project syncany, under directory /syncany/src/org/syncany/gui/settings/.

Source file: FolderDialog.java

  15 
vote

/** 
 * @param args the command line arguments
 */
public static void main(String args[]) throws InitializationException {
  java.awt.EventQueue.invokeLater(new Runnable(){
    public void run(){
      FolderDialog dialog=new FolderDialog(new javax.swing.JFrame(),true);
      dialog.addWindowListener(new java.awt.event.WindowAdapter(){
        public void windowClosing(        java.awt.event.WindowEvent e){
          System.exit(0);
        }
      }
);
      dialog.setVisible(true);
    }
  }
);
}
 

Example 95

From project thinklab, under directory /plugins/org.integratedmodelling.thinklab.thinkscape/src/org/integratedmodelling/thinkscape/.

Source file: ThinkScape.java

  15 
vote

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 96

From project tiled-java, under directory /src/tiled/mapeditor/widget/.

Source file: FloatablePanel.java

  15 
vote

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 97

From project trademaker, under directory /src/org/lifeform/optimizer/.

Source file: OptimizerDialog.java

  15 
vote

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 98

From project TraVis, under directory /src/travis/view/project/tree/popup/.

Source file: TreePopupMenu.java

  15 
vote

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 99

From project twinkle, under directory /src/main/java/ch/swingfx/twinkle/manager/.

Source file: SequentialNotificationManager.java

  15 
vote

/** 
 * 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 100

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

  15 
vote

private void addOnExit(){
  addWindowListener(new WindowAdapter(){
    public void windowClosing(    WindowEvent we){
      stopProxy();
      ProxySwitcher.revertSystemProxy(true);
      System.exit(0);
    }
  }
);
}
 

Example 101

From project Twister, under directory /src/client/userinterface/java/src/.

Source file: DatabaseFrame.java

  15 
vote

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 102

From project uniquery, under directory /src/org/uniquery/gui/dialog/.

Source file: DialogFrame.java

  15 
vote

protected void init(){
  buildDialogFrame();
  addActionListeners();
  addWindowListener(new WindowAdapter(){
    @Override public void windowClosing(    WindowEvent e){
      closeFrame();
    }
  }
);
  pack();
  setLocationRelativeTo(owner);
  setVisible(true);
}
 

Example 103

From project upm-swing, under directory /src/com/_17od/upm/gui/.

Source file: DatabaseActions.java

  15 
vote

/** 
 * 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 104

From project Valkyrie-RCP, under directory /valkyrie-rcp-core/src/main/java/org/valkyriercp/application/support/.

Source file: AbstractApplicationWindow.java

  15 
vote

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 105

From project vlcj, under directory /src/test/java/uk/co/caprica/vlcj/test/direct/.

Source file: DirectTestPlayer.java

  15 
vote

public DirectTestPlayer(String media,String[] args) throws InterruptedException, InvocationTargetException {
  image=GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().createCompatibleImage(width,height);
  image.setAccelerationPriority(1.0f);
  SwingUtilities.invokeAndWait(new Runnable(){
    @Override public void run(){
      JFrame frame=new JFrame("VLCJ Direct Video Test");
      frame.setIconImage(new ImageIcon(getClass().getResource("/icons/vlcj-logo.png")).getImage());
      imagePane=new ImagePane(image);
      imagePane.setSize(width,height);
      imagePane.setMinimumSize(new Dimension(width,height));
      imagePane.setPreferredSize(new Dimension(width,height));
      frame.getContentPane().setLayout(new BorderLayout());
      frame.getContentPane().add(imagePane,BorderLayout.CENTER);
      frame.pack();
      frame.setResizable(false);
      frame.setVisible(true);
      frame.addWindowListener(new WindowAdapter(){
        @Override public void windowClosing(        WindowEvent evt){
          mediaPlayer.release();
          factory.release();
          System.exit(0);
        }
      }
);
    }
  }
);
  factory=new MediaPlayerFactory(args);
  mediaPlayer=factory.newDirectMediaPlayer(width,height,new TestRenderCallback());
  mediaPlayer.playMedia(media);
  Thread.sleep(5000);
  mediaPlayer.nextChapter();
}