コード例 #1
0
  void test3(Window owner, Window child1, Window child2) {
    System.out.println("* * * STAGE 3 * * *\nWidow owner: " + owner);

    owner.setFocusableWindowState(true);
    owner.setVisible(true);

    child1.setFocusableWindowState(false);
    child1.setVisible(true);

    child2.setFocusableWindowState(true);
    child2.add(button);
    child2.setVisible(true);

    Util.waitTillShown(child2);

    Util.clickOnComp(button, robot);
    System.err.println(
        "focus owner: " + KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner());
    if (button != KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner()) {
      throw new RuntimeException("Test failed.");
    }
    child1.dispose();
    child2.dispose();
    owner.dispose();
  }
コード例 #2
0
 /** Close. */
 public void close() {
   Window window = this.browserWindow;
   if (window != null) {
     window.dispose();
   }
   Window pw = this.progressWindow;
   if (pw != null) {
     pw.dispose();
   }
 }
コード例 #3
0
ファイル: ScreenManager.java プロジェクト: Gogoro/Undef
 // get out of full screen
 public void restoreScreen() {
   Window w = vc.getFullScreenWindow();
   if (w != null) {
     w.dispose();
   }
   vc.setFullScreenWindow(null);
 }
コード例 #4
0
ファイル: AppWindow.java プロジェクト: Sciss/Meloncillo
  /** Frees resources, clears references */
  public void dispose() {
    if (tempFloatingTimer != null) {
      tempFloatingTimer.stop();
    }

    if (initialized) {
      if (winListener != null) removeListener(winListener);
      if (cmpListener != null) c.removeComponentListener(cmpListener);

      wh.removeWindow(this, null);
      //			AbstractApplication.getApplication().addComponent( getClass().getName(), null );

      if (borrowMenuBar) {
        borrowMenuBar(null);
        wh.removeBorrowListener(this);
      }
      if (wh.getMenuBarBorrower() == this) wh.setMenuBarBorrower(null);
      if (ownMenuBar) {
        setJMenuBar(null);
        wh.getMenuBarRoot().destroy(this);
      }
    }

    if (w != null) {
      w.dispose();
    } else if (jif != null) {
      jif.dispose();
    }

    if (ggTitle != null) ggTitle.dispose();

    classPrefs = null;
    cmpListener = null;
    winListener = null;
  }
コード例 #5
0
 private void disposeAndUpdate(boolean update) {
   if (myView != null) {
     boolean visible = myView.isVisible();
     myView.setVisible(false);
     Container container = myContent.getParent();
     if (container != null) {
       container.remove(myContent);
     }
     if (myView instanceof Window) {
       myViewBounds = myView.getBounds();
       Window window = (Window) myView;
       if (!push(UIUtil.getWindow(myOwner), window)) {
         window.dispose();
       }
     } else {
       Container parent = myView.getParent();
       if (parent == null) {
         myViewBounds = new Rectangle(myContent.getPreferredSize());
       } else {
         myViewBounds = new Rectangle(myView.getBounds());
         parent.remove(myView);
         Point point = new Point(myViewBounds.x, myViewBounds.y);
         SwingUtilities.convertPointToScreen(point, parent);
         myViewBounds.x = point.x;
         myViewBounds.y = point.y;
       }
     }
     myView = null;
     if (update && visible) {
       setVisible(true);
     }
   }
 }
コード例 #6
0
 /** Restores the screen's display mode. */
 public void restoreScreen() {
   Window window = device.getFullScreenWindow();
   if (window != null) {
     window.dispose();
   }
   device.setFullScreenWindow(null);
 }
コード例 #7
0
ファイル: ScreenManager.java プロジェクト: killgt/CryoWar
 /** Recupera el modo de pantalla no completa */
 public void recuperarPantalla() {
   Window window = device.getFullScreenWindow();
   if (window != null) {
     window.dispose();
   }
   device.setFullScreenWindow(null);
 }
コード例 #8
0
  protected void processCancel(ActionEvent event, boolean reallyCancel) {
    DeferredWizardResult deferredResult = parent.getDeferredResult();
    if (deferredResult != null && deferredResult.canAbort()) deferredResult.abort();
    Wizard wizard = parent.getWizard();
    MergeMap settings = parent.getSettings();

    boolean closeWindow;

    if (reallyCancel && parent.cancel()) {
      wizard.cancel(settings);
      return;
    }

    closeWindow = reallyCancel ? wizard.cancel(settings) : parent.receiver == null;

    // if we have the event (allowFinish was not deferred) then be very sure to close the proper
    // dialog
    if (closeWindow) {
      Window win =
          event != null
              ? (Window) ((JComponent) event.getSource()).getTopLevelAncestor()
              : getWindow();
      win.setVisible(false);
      win.dispose();
    }
  }
コード例 #9
0
 @Override
 public void actionPerformed(ActionEvent e) {
   actionPerformedUpdates(_parent);
   _imgBtn.getWindow().close();
   _parent.dispose();
   SikuliIDE.getInstance().getCurrentCodePane().setDirty(setDirty(false));
 }
コード例 #10
0
ファイル: DumpOnKey.java プロジェクト: FauxFaux/jdk9-jdk
  public static void main(final String[] args) throws AWTException {
    final boolean dump = Boolean.parseBoolean(args[0]);
    final Window w =
        new Frame() {
          @Override
          public void list(final PrintStream out, final int indent) {
            super.list(out, indent);
            dumped = true;
          }
        };
    w.setSize(200, 200);
    w.setLocationRelativeTo(null);
    w.setVisible(true);

    final Robot robot = new Robot();
    robot.setAutoDelay(50);
    robot.setAutoWaitForIdle(true);
    robot.mouseMove(w.getX() + w.getWidth() / 2, w.getY() + w.getHeight() / 2);
    robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
    robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);

    robot.keyPress(KeyEvent.VK_CONTROL);
    robot.keyPress(KeyEvent.VK_SHIFT);
    robot.keyPress(KeyEvent.VK_F1);
    robot.keyRelease(KeyEvent.VK_F1);
    robot.keyRelease(KeyEvent.VK_SHIFT);
    robot.keyRelease(KeyEvent.VK_CONTROL);

    w.dispose();
    if (dumped != dump) {
      throw new RuntimeException("Exp:" + dump + ", actual:" + dumped);
    }
  }
コード例 #11
0
ファイル: MessagePopup.java プロジェクト: kares/F-ReC
 /**
  * Clear the error message and close the window. This can be called from outside this class. It is
  * called automatically when the user clicks the OK button or close box of the window that
  * displays the error message.
  */
 public synchronized void clearErrorMessage() {
   if (popup == null) return;
   popup.dispose();
   errorMessage = null;
   if (errorSource != null) errorSource.errorCleared();
   errorSource = null;
   popup = null;
 }
コード例 #12
0
 public void cleanUp() {
   for (Window w : allWindows) {
     if (w != null) {
       System.out.println("Disposing of window " + w.getClass().getName());
       w.dispose();
     }
   }
 }
コード例 #13
0
ファイル: BrowserPanel.java プロジェクト: bogas04/gngr
 /**
  * Disposes the current <code>BrowserPanel</code>. This method is normally activated by the
  * standard File/Exit menu.
  *
  * @see #setCloseWindowOnDispose(boolean)
  */
 public void dispose() {
   if (this.closeWindowOnDispose) {
     final java.awt.Window awtFrame = this.getAwtWindow();
     if (awtFrame != null) {
       awtFrame.dispose();
     }
   }
 }
コード例 #14
0
 @Override
 public void actionPerformed(ActionEvent e) {
   if (isDirty()) {
     _imgBtn.resetParameters();
   }
   _imgBtn.getWindow().close();
   _parent.dispose();
 }
コード例 #15
0
  public void actionPerformed(ActionEvent e) {
    Object src = e.getSource();

    // Exit the window
    if (src == target.getFileItem(Window.FILE_ITEM_EXIT)) {
      target.dispose();
      System.exit(0);
    }

    // Show About window
    if (src == target.getHelpItem(Window.HELP_ITEM_ABOUT)) {
      new AboutWindow();
    }

    // Connect to a server
    if (src == target.getFileItem(Window.FILE_ITEM_CONNECT)) {
      new ConnectWindow(target);
    }

    // Disconnect
    if (src == target.getFileItem(Window.FILE_ITEM_DISCONNECT)) {
      target.DisConnect();
    }

    // Send File
    if (src == target.getToolItem(Window.TOOL_ITEM_SENDFILE)) {
      target.fileClient.Send();
    }

    // Send, send info to remote server.
    if (src == target.getSendBtn()) {
      if (target.isConncted()) {
        this.target.chatClient.Send(this.target.getBottomText());
        this.target.clearText();
      } else {
        this.target.AppendInfo("Please connect to a server first");
      }
    }

    // Cancel, close the window .
    if (src == target.getCancelBtn()) {
      target.dispose();
      System.exit(0);
    }
  }
コード例 #16
0
  void test1(Window owner, Window child) {
    System.out.println("* * * STAGE 1 * * *\nWindow owner: " + owner);

    owner.setFocusableWindowState(false);
    owner.setVisible(true);

    child.add(button);
    child.setVisible(true);

    Util.waitTillShown(child);

    Util.clickOnComp(button, robot);
    if (button == KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner()) {
      throw new RuntimeException("Test Failed.");
    }
    child.dispose();
    owner.dispose();
  }
コード例 #17
0
ファイル: connect.java プロジェクト: jenhantao/Assembly-Graph
 @Override
 public void close() {
   for (WeakReference<Window> wf : pig) {
     Window gui = (Window) wf.get();
     if (gui != null) {
       gui.dispose();
     }
   }
 }
コード例 #18
0
 private void connectButtonActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_connectButtonActionPerformed
   // TODO add your handling code here:
   if (client.connect(
       serverAdressTextField.getText(),
       serverPortTextField.getText(),
       usernameTextField.getText())) {
     Window window = SwingUtilities.windowForComponent((Component) evt.getSource());
     window.dispose();
   }
 } // GEN-LAST:event_connectButtonActionPerformed
コード例 #19
0
 /** {@inheritDoc} */
 @Override
 public boolean disposeModalDialog(JComponent sourceWidget, Map<String, Object> context) {
   if (super.disposeModalDialog(sourceWidget, context)) {
     Window actionWindow = SwingUtil.getVisibleWindow(sourceWidget);
     if (actionWindow instanceof JDialog) {
       actionWindow.dispose();
     }
     transferFocus(context);
     return true;
   }
   return false;
 }
コード例 #20
0
  /**
   * Apply the complete list of options to the current underlying job
   *
   * @param opts the options to apply
   */
  protected void applyOptionsToJob(List<String> opts) {
    String combined = Utils.joinOptions(opts.toArray(new String[opts.size()]));
    System.err.println("Combined: " + combined);

    if (!combined.equals(m_optionsOrig)) {
      m_modifyListener.setModifiedStatus(this, true);
    }

    m_bean.setJobOptions(combined);

    m_parentWindow.dispose();
  }
コード例 #21
0
  void deferredResultFinished(Object o) {
    String name = deferredStatus;
    deferredStatus = null;

    configureNavigationButtons(parent.getWizard(), prev, next, finish);

    if (name.startsWith(DEFERRED_FAILED)) {
      // Cancel clicked after a deferred failure
      if (o instanceof ActionEvent) {
        JButton button = (JButton) ((ActionEvent) o).getSource();
        name = button.getName();
        if (NAME_CANCEL.equals(name)) {
          processCancel(o instanceof ActionEvent ? (ActionEvent) o : null, false);
          return;
        }
      }
      // in failed state, so we always reload the current step's screen
      String currentStep = parent.getCurrentStep();
      parent.navigateTo(currentStep);
      return;
    }

    switch (name) {
      case NAME_NEXT:
        processNextProceed(o);
        break;
        // else ignore, we don't know it
      case NAME_PREV:
        processPrevProceed(o);
        break;
      case NAME_CANCEL:
        processCancel(o instanceof ActionEvent ? (ActionEvent) o : null, false);
        break;
      case NAME_FINISH:
        // allowFinish on the "down" click of the finish button
        processFinishProceed(o);
        break;
      case NAME_CLOSE:
        // the "up" click of the finish button: wizard.finish was a deferred result
        Window dlg = getWindow();
        dlg.setVisible(false);
        dlg.dispose();
        break;
      default:
        break;
    }

    parent.updateProblem();
  }
コード例 #22
0
 /**
  * Properly disposes of the given {@code Window}, making it and its native resources available for
  * garbage collection.
  *
  * <p><b>Note:</b> This method is accessed in the current executing thread. Such thread may or may
  * not be the event dispatch thread (EDT.) Client code must call this method from the EDT.
  *
  * @param w the {@code Window} to dispose.
  */
 @Override
 @RunsInCurrentThread
 public void dispose(@Nonnull Window w) {
   if (isAppletViewer(w)) {
     return;
   }
   for (Window owned : w.getOwnedWindows()) {
     if (owned != null) {
       dispose(owned);
     }
   }
   if (isSharedInvisibleFrame(w)) {
     return;
   }
   w.dispose();
 }
コード例 #23
0
ファイル: XCOMSGE.java プロジェクト: cdavoren/XCOMSGE
  protected void loadSavedGame(SaveSelectionPanel ssp, Window windowToClose) {
    ShortSaveInfo ssi = ssp.getSelectedSaveGame();
    if (ssi == null) {
      JOptionPane.showMessageDialog(
          windowToClose, "Select a non-empty slot.", "Error", JOptionPane.ERROR_MESSAGE);
      return;
    }

    try {
      System.out.println("Loading game with slot " + ssi.slot + "...");
      SavedGame sg = SavedGame.loadSavedGame(EditorResourceManager.getUFODirectory(), ssi.slot);
      System.out.println("Successfully loaded saved game.");
      windowToClose.dispose();
      MainMenuFrame mainMenu = new MainMenuFrame(sg);
      mainMenu.setVisible(true);
    } catch (IOException ioe) {
      System.out.println("Error loading saved game: " + ioe.getMessage());
      ioe.printStackTrace(System.out);
    }
  }
コード例 #24
0
 /** Make screenshot taking part of unit tests */
 @Test
 public static void testScreenshots() throws Exception {
   File shotdir = FileUtils.createTempDir("jgridstart-screenshots-");
   try {
     doScreenshots(shotdir);
   } catch (Throwable e) {
     // on error, output final screenshot as base64 on debug log
     File errorshot = new File(shotdir, "error.png");
     saveScreenshot(errorshot);
     Thread.sleep(500);
     FileInputStream in = new FileInputStream(errorshot);
     byte[] data = new byte[(int) errorshot.length()];
     in.read(data, 0, data.length);
     // need to log in chunks because logger doesn't seem to be able to support >4096 chars
     String basedata = new String(Base64.encode(data));
     logger.finest("Interactive UI testing failed, last screenshot (base64 encoded):");
     logger.finest("=== BEGIN PNG ===");
     int pos = 0;
     while (pos < basedata.length()) {
       int len = 1024;
       if (pos + len < basedata.length()) logger.finest(basedata.substring(pos, pos + len));
       else logger.finest(basedata.substring(pos));
       pos += len;
     }
     logger.finest("=== END PNG ===");
     // destroy window
     Window mainwnd = AWT.getActiveWindow();
     if (mainwnd != null && mainwnd.isVisible()) mainwnd.dispose();
     // pass on error
     if (e instanceof Exception) throw (Exception) e;
     else if (e instanceof Error) throw (Error) e;
     else throw new Exception("Unknown throwable: ", e);
   } finally {
     // remove screenshot directory again
     FileUtils.recursiveDelete(shotdir);
   }
 }
コード例 #25
0
 public void componentHidden(ComponentEvent e) {
   Window w = (Window) e.getComponent();
   w.dispose();
 }
コード例 #26
0
ファイル: Util.java プロジェクト: zhemaituk/beanshell
 public static void endSplashScreen() {
   if (splashScreen != null) splashScreen.dispose();
 }
コード例 #27
0
ファイル: MainView.java プロジェクト: BlueLover-zm/fs_test
 public void closeWindow() {
   Window window = SwingUtilities.getWindowAncestor(this);
   window.dispose();
 }
コード例 #28
0
  @Override
  public void actionPerformed(ActionEvent evt) {
    if (evt.getActionCommand().equals("SearchDB")) {
      searchDatabaseForMatches();
    } else if (evt.getActionCommand().equals("Finish")) {
      commit();
    } else if (evt.getActionCommand().equals("Cancel")) {
      containerFrame.dispose();
    } else if (evt.getActionCommand().equals("DefineByPattern")) {
      fillTableByPattern();
    } else if (evt.getActionCommand().equals("IncludeExcludeSubObjects")) {
      table.getColumnExt("SubObjectColumn").setVisible(this.chkIncludeSubobjects.isSelected());
    } else if (evt.getActionCommand().equals("SetDefaults")) {

      /*MVCArrayList<ControlledVoc> objectdic = Dictionary.getMutableDictionary("objectTypeDictionary");
      for(ControlledVoc item : objectdic)
      {
      	if(item.getNormal().equals("Site"))
      	{
      		defaultEntitiesDialog.setDefaultValues(item);
      	}
      }*/

      defaultEntitiesDialog.setVisible(true);

      if (defaultEntitiesDialog == null) {
        defaultEntitiesDialog = new DefaultEntityParametersDialog(containerFrame);
      }

    } else if (evt.getActionCommand().equals("GenerateMissing")) {
      if (model.areThereEmptyCells(this.chkIncludeSubobjects.isSelected())) {
        Alert.message(
            containerFrame,
            "Missing entries",
            "You must provide titles for all entities in the table.");
        return;
      }

      searchDatabaseForMatches();

      if (!model.areThereMissingEntites(true)) {
        Alert.message(containerFrame, "Nothing to do", "There are no entities to create!");
        return;
      }

      Object[] options = {"Yes", "No", "Cancel"};
      int n =
          JOptionPane.showOptionDialog(
              this,
              "You are about to create basic database entities for all the red crosses in the table.\n"
                  + "Are you sure you want to continue?",
              "Confirmation",
              JOptionPane.YES_NO_CANCEL_OPTION,
              JOptionPane.QUESTION_MESSAGE,
              null,
              options,
              options[2]);

      if (n == JOptionPane.OK_OPTION) {
        model.generateMissingEntities(
            this.chkIncludeSubobjects.isSelected(), this.defaultEntitiesDialog);
      }

      return;
    }
  }
コード例 #29
0
 public void windowClosing(WindowEvent e) {
   Window w = e.getWindow();
   w.setVisible(false);
   w.dispose();
   System.exit(0);
 }
コード例 #30
0
 /** @inheritDoc */
 public void actionPerformed(ActionEvent e) {
   w.setVisible(false);
   w.dispose();
 }