コード例 #1
0
ファイル: ClientController.java プロジェクト: piopawlu/ols
  /** @see nl.lxtreme.ols.api.devices.CaptureCallback#captureStarted(int, int, int) */
  @Override
  public synchronized void captureStarted(
      final int aSampleRate, final int aChannelCount, final int aChannelMask) {
    final Runnable runner =
        new Runnable() {
          @Override
          public void run() {
            updateActions();
          }
        };

    if (SwingUtilities.isEventDispatchThread()) {
      runner.run();
    } else {
      SwingUtilities.invokeLater(runner);
    }
  }
コード例 #2
0
ファイル: ClientController.java プロジェクト: piopawlu/ols
 /** Dispatches a request to repaint the entire main frame. */
 private void repaintMainFrame() {
   SwingUtilities.invokeLater(
       new Runnable() {
         @Override
         public void run() {
           ClientController.this.mainFrame.repaint();
         }
       });
 }
コード例 #3
0
ファイル: SwingComponentUtils.java プロジェクト: piopawlu/ols
  /**
   * Tries to find the owning window for the given component.
   *
   * @param aComponent the AWT event to find the owning window for, may be <code>null</code>.
   * @return the owning window, or <code>null</code> if no such window could be found, or a <code>
   *     null</code> component was given.
   */
  public static final Window getOwningWindow(final Component aComponent) {
    if (aComponent == null) {
      return null;
    }

    Window owner = SwingUtilities.getWindowAncestor(aComponent);
    if (owner == null) {
      owner = getCurrentWindow();
    }
    return owner;
  }