Java Code Examples for javax.swing.SwingUtilities

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 addis, under directory /application/src/main/java/org/drugis/addis/entities/analysis/.

Source file: MetaBenefitRiskAnalysis.java

  31 
vote

public MetaMeasurementSource(){
  PropertyChangeListener l=new PropertyChangeListener(){
    public void propertyChange(    PropertyChangeEvent evt){
      SwingUtilities.invokeLater(new Runnable(){
        public void run(){
          notifyListeners();
        }
      }
);
    }
  }
;
  for (  Summary s : getEffectSummaries()) {
    s.addPropertyChangeListener(l);
  }
}
 

Example 2

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

Source file: ImageScrollerLargeView.java

  31 
vote

public final void actionPerformed(final ActionEvent e){
  if (JOptionPane.getFrameForComponent(ImageScrollerLargeView.this).getFocusOwner() == null) {
    m_insideCount=0;
    return;
  }
  if (m_inside && m_edge != NONE) {
    m_insideCount++;
    if (m_insideCount > 6) {
      SwingUtilities.invokeLater(new Scroller());
    }
  }
}
 

Example 3

From project ardverk-dht, under directory /components/tools/src/main/java/org/ardverk/dht/ui/.

Source file: AbstractPanel.java

  30 
vote

@Override public final void handleMessageSent(final KUID contactId,final Message message){
  SwingUtilities.invokeLater(new Runnable(){
    @Override public void run(){
      handleMessageSent0(contactId,message);
    }
  }
);
}
 

Example 4

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

Source file: AddImageAction.java

  30 
vote

/** 
 * Closes the current dialog and wizard, and opens a new one. Used in the "Add another image" action on the last panel
 */
void restart(){
  wizardDescriptor.setValue(WizardDescriptor.FINISH_OPTION);
  dialog.setVisible(false);
  final Runnable r=new Runnable(){
    @Override public void run(){
      actionPerformed(null);
    }
  }
;
  SwingUtilities.invokeLater(r);
}
 

Example 5

From project BioMAV, under directory /Behavior/src/nl/ru/ai/projects/parrot/biomav/editor/.

Source file: BehaviorEditor.java

  30 
vote

@Override public BehaviorVertex create(){
  BehaviorVertex vertex=new BehaviorVertex();
  vertex.addBehaviorVertexListener(new BehaviorVertexListener(){
    @Override public void behaviorVertexActivityChanged(    BehaviorVertex vertex){
      SwingUtilities.invokeLater(new Runnable(){
        @Override public void run(){
          graphViewer.repaint();
        }
      }
);
    }
  }
);
  return vertex;
}
 

Example 6

From project BMach, under directory /src/jsyntaxpane/actions/.

Source file: ActionUtils.java

  30 
vote

/** 
 * Returns the Frame that contains this component or null if the component is not within a Window or the containing window is not a frame
 * @param comp
 * @return
 */
public static Frame getFrameFor(Component comp){
  Window w=SwingUtilities.getWindowAncestor(comp);
  if (w != null && w instanceof Frame) {
    Frame frame=(Frame)w;
    return frame;
  }
  return null;
}
 

Example 7

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

Source file: JDateChooser.java

  30 
vote

/** 
 * Updates the UI of itself and the popup.
 */
public void updateUI(){
  super.updateUI();
  setEnabled(isEnabled());
  if (jcalendar != null) {
    SwingUtilities.updateComponentTreeUI(popup);
  }
}
 

Example 8

From project Chess_1, under directory /src/chess/gui/.

Source file: GridPanel.java

  30 
vote

/** 
 * Show a tool tip.
 * @param tipText the tool tip text
 * @param pt the pixel position over which to show the tip
 */
public void showTip(String tipText,Point pt){
  if (getRootPane() == null)   return;
  if (glassPane == null) {
    getRootPane().setGlassPane(glassPane=new JPanel());
    glassPane.setOpaque(false);
    glassPane.setLayout(null);
    glassPane.add(tip=new JToolTip());
    tipTimer=new Timer(TIP_DELAY,new ActionListener(){
      public void actionPerformed(      ActionEvent evt){
        glassPane.setVisible(false);
      }
    }
);
    tipTimer.setRepeats(false);
  }
  if (tipText == null)   return;
  tip.setTipText(tipText);
  tip.setLocation(SwingUtilities.convertPoint(this,pt,glassPane));
  tip.setSize(tip.getPreferredSize());
  glassPane.setVisible(true);
  glassPane.repaint();
  tipTimer.restart();
}
 

Example 9

From project ceres, under directory /ceres-glayer/src/main/java/com/bc/ceres/glayer/tools/.

Source file: Tools.java

  29 
vote

@Override public void mouseReleased(final MouseEvent mouseEvent){
  if (mouseEvent.isPopupTrigger()) {
    final Point point=mouseEvent.getPoint();
    SwingUtilities.convertPointToScreen(point,layerCanvas);
    sliderPopUp.show(point);
  }
 else {
    sliderPopUp.hide();
  }
}
 

Example 10

From project ChkBugReport, under directory /src/com/sonyericsson/chkbugreport/.

Source file: Gui.java

  29 
vote

public void loadFile(final String path){
  enableUI(false);
  new Thread(){
    @Override public void run(){
      mMain.loadFile(path);
      SwingUtilities.invokeLater(new Runnable(){
        @Override public void run(){
          enableUI(true);
        }
      }
);
    }
  }
.start();
}
 

Example 11

From project Clotho-Core, under directory /ClothoApps/CollectionViewTool/src/org/clothocad/tool/collectionview/.

Source file: GlassMessage.java

  29 
vote

public static void main(String[] args){
  Runnable doCreateAndShowGUI=new Runnable(){
    @Override public void run(){
      createAndShowGUI();
    }
  }
;
  SwingUtilities.invokeLater(doCreateAndShowGUI);
}
 

Example 12

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

Source file: DefaultQuarantineWindow.java

  29 
vote

protected void initQuarantineLoad(){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      waitingPanel.exec(new QuarantineRunnable(Transfer.QUARANTINE_TO_USER,QUARANTINE_TO_USER));
    }
  }
);
}
 

Example 13

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

Source file: ExecutionListWaitingWindow.java

  29 
vote

public void propertyChange(final PropertyChangeEvent evt){
  String type=evt.getPropertyName();
  if (ExecutionListProgress.INFO_EVENT.equals(type)) {
    infoScrollPane.setVisible(true);
    SwingUtilities.invokeLater(new Runnable(){
      public void run(){
        infoTextArea.setText(infoTextArea.getText() + "\n" + evt.getNewValue());
      }
    }
);
  }
 else   if (ExecutionListProgress.EXECUTIONLIST_EVENT.equals(type)) {
    ExecutionListModel executionListModel=(ExecutionListModel)evt.getNewValue();
    currentExecListTreatmentName=executionListModel.getName();
    SwingUtilities.invokeLater(new Runnable(){
      public void run(){
        infoTextArea.setText("");
        infoScrollPane.setVisible(false);
        execListNameLabel.setText(currentExecListTreatmentName + EXECUTING);
      }
    }
);
  }
}
 

Example 14

From project codjo-segmentation, under directory /codjo-segmentation-gui/src/main/java/net/codjo/segmentation/gui/exportParam/.

Source file: ExportParametersLogic.java

  29 
vote

@SuppressWarnings({"InnerClassTooDeeplyNested"}) public void actionPerformed(ActionEvent event){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      gui.getWaitingPanel().startAnimation();
      requestFileExport();
    }
  }
);
}
 

Example 15

From project codjo-standalone-common, under directory /src/main/java/net/codjo/gui/.

Source file: WaitCursorEventQueue.java

  29 
vote

/** 
 * Main processing method for the WaitCursorTimer object
 */
public synchronized void run(){
  while (true) {
    try {
      wait();
      wait(delay);
      if (source instanceof Component) {
        parent=SwingUtilities.getRoot((Component)source);
      }
 else       if (source instanceof MenuComponent) {
        MenuContainer mParent=((MenuComponent)source).getParent();
        if (mParent instanceof Component) {
          parent=SwingUtilities.getRoot((Component)mParent);
        }
      }
      if (parent != null && parent.isShowing()) {
        parent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
      }
    }
 catch (    InterruptedException ie) {
    }
  }
}
 

Example 16

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

Source file: AMenuStartItem.java

  29 
vote

/** 
 * Start Window
 * @param AD_Workbench_ID workbench
 * @param AD_Window_ID	window
 */
private void startWindow(int AD_Workbench_ID,int AD_Window_ID){
  AWindow frame=(AWindow)Env.showWindow(AD_Window_ID);
  if (frame != null) {
    m_menu.getWindowManager().add(frame);
    return;
  }
  if (Ini.isPropertyBool(Ini.P_SINGLE_INSTANCE_PER_WINDOW)) {
    frame=m_menu.getWindowManager().find(AD_Window_ID);
    if (frame != null) {
      frame.toFront();
      return;
    }
  }
  SwingUtilities.invokeLater(m_updatePB);
  frame=new AWindow(m_menu.getGraphicsConfiguration());
  boolean OK=false;
  if (AD_Workbench_ID != 0)   OK=frame.initWorkbench(AD_Workbench_ID);
 else   OK=frame.initWindow(AD_Window_ID,null);
  if (!OK)   return;
  SwingUtilities.invokeLater(m_updatePB);
  if (Ini.isPropertyBool(Ini.P_OPEN_WINDOW_MAXIMIZED)) {
    AEnv.showMaximized(frame);
  }
  SwingUtilities.invokeLater(m_updatePB);
  if (!(Ini.isPropertyBool(Ini.P_OPEN_WINDOW_MAXIMIZED))) {
    frame.validate();
    AEnv.showCenterScreen(frame);
  }
  m_menu.getWindowManager().add(frame);
  frame=null;
}
 

Example 17

From project Core_2, under directory /src/main/java/ch/swingfx/timer/.

Source file: AnimationTimer.java

  29 
vote

/** 
 * Start the animation
 */
public void start(){
  if (!fTimer.isRunning()) {
    if (fAnimationTarget == null) {
      throw new IllegalStateException("Animation target is not set!");
    }
    fAnimationStartTime=System.nanoTime() / 1000000;
    final Runnable r=new Runnable(){
      public void run(){
        fAnimationTarget.begin(AnimationTimer.this);
      }
    }
;
    if (SwingUtilities.isEventDispatchThread()) {
      r.run();
    }
 else {
      SwingUtilities.invokeLater(r);
    }
    fTimer.start();
  }
}
 

Example 18

From project cowgraph, under directory /CowGraph/CowGraphVisualEditor/src/zbeans/cowgraph/visual/editor/.

Source file: CowGraphVisualEditorScene.java

  29 
vote

@Override public void propertyChange(PropertyChangeEvent evt){
  if (evt.getPropertyName().equals(ObservableBean.getCollectionElementAddedPropertyName(CowGraphVersion.PROP_ELEMENTS))) {
    this.addNode((GraphElement)evt.getNewValue());
    if (SwingUtilities.isEventDispatchThread()) {
      repaint();
      getScene().validate();
    }
 else {
      SwingUtilities.invokeLater(new Runnable(){
        @Override public void run(){
          repaint();
          getScene().validate();
        }
      }
);
    }
  }
 else   if (evt.getPropertyName().equals(ObservableBean.getCollectionElementRemovedPropertyName(CowGraphVersion.PROP_ELEMENTS))) {
    GraphElement element=(GraphElement)evt.getOldValue();
  }
}
 

Example 19

From project dawn-common, under directory /org.dawb.hdf5/src/ncsa/hdf/view/.

Source file: HDFView.java

  29 
vote

/** 
 * Set default UI fonts.
 */
private void updateFontSize(Font font){
  if (font == null) {
    return;
  }
  UIDefaults defaults=UIManager.getLookAndFeelDefaults();
  for (Iterator i=defaults.keySet().iterator(); i.hasNext(); ) {
    Object key=i.next();
    if (defaults.getFont(key) != null) {
      UIManager.put(key,new javax.swing.plaf.FontUIResource(font));
    }
  }
  SwingUtilities.updateComponentTreeUI(this);
}
 

Example 20

From project dawn-isencia, under directory /com.isencia.passerelle.engine/src/main/java/com/isencia/passerelle/actor/gui/.

Source file: PasserelleConfigurer.java

  29 
vote

/** 
 * Request restoration of the user settable attribute values to what they were when this object was created.  The actual restoration occurs later, in the UI thread, in order to allow all pending changes to the attribute values to be processed first. If the original values match the current values, then nothing is done.
 */
public void restore(){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      Iterator parameters=_object.attributeList(Settable.class).iterator();
      boolean hasChanges=false;
      StringBuffer buffer=new StringBuffer("<group>\n");
      while (parameters.hasNext()) {
        Settable parameter=(Settable)parameters.next();
        if (isVisible(_object,parameter)) {
          String newValue=parameter.getExpression();
          String oldValue=(String)_originalValues.get(parameter);
          if (!newValue.equals(oldValue)) {
            hasChanges=true;
            buffer.append("<property name=\"");
            buffer.append(((NamedObj)parameter).getName(_object));
            buffer.append("\" value=\"");
            buffer.append(StringUtilities.escapeForXML(oldValue));
            buffer.append("\"/>\n");
          }
        }
      }
      buffer.append("</group>\n");
      if (hasChanges) {
        MoMLChangeRequest request=new MoMLChangeRequest(this,_object,buffer.toString(),null);
        _object.requestChange(request);
      }
    }
  }
);
}
 

Example 21

From project des, under directory /daemon/lib/apache-log4j-1.2.16/src/main/java/org/apache/log4j/lf5/viewer/categoryexplorer/.

Source file: CategoryExplorerModel.java

  29 
vote

/** 
 * Fires a nodechanged event on the SwingThread.
 */
protected void refresh(final CategoryNode node){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      nodeChanged(node);
    }
  }
);
}
 

Example 22

From project dnieprov, under directory /src/org/dnieprov/driver/.

Source file: PasswordGuiCallback.java

  29 
vote

@Override public char[] getPassword(String title,String msg) throws DnieUnexpectedException {
  final JPasswordField jpf=new JPasswordField();
  JOptionPane jop=new JOptionPane(new Object[]{new JLabel("<HTML>" + msg + "<HTML>"),jpf},JOptionPane.QUESTION_MESSAGE,JOptionPane.OK_CANCEL_OPTION);
  JDialog dialog=jop.createDialog(title);
  dialog.setAlwaysOnTop(true);
  dialog.addComponentListener(new ComponentAdapter(){
    @Override public void componentShown(    ComponentEvent e){
      SwingUtilities.invokeLater(new Runnable(){
        @Override public void run(){
          jpf.requestFocusInWindow();
        }
      }
);
    }
  }
);
  dialog.setVisible(true);
  if (jop.getValue() == null) {
    return null;
  }
  int result=(Integer)jop.getValue();
  dialog.dispose();
  if (result == JOptionPane.OK_OPTION) {
    return jpf.getPassword();
  }
  return null;
}
 

Example 23

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

Source file: SolutionBusiness.java

  29 
vote

public void registerForBestSolutionChanges(final SolverAndPersistenceFrame solverAndPersistenceFrame){
  solver.addEventListener(new SolverEventListener(){
    public void bestSolutionChanged(    BestSolutionChangedEvent event){
      if (solver.isEveryProblemFactChangeProcessed()) {
        final Solution latestBestSolution=event.getNewBestSolution();
        SwingUtilities.invokeLater(new Runnable(){
          public void run(){
            guiScoreDirector.setWorkingSolution(latestBestSolution);
            solverAndPersistenceFrame.bestSolutionChanged();
          }
        }
);
      }
    }
  }
);
}
 

Example 24

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

Source file: CompanyPanel.java

  29 
vote

public void updateCompany(){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      currentField.setText(format.format(model.getCurrentPrice()));
      previousField.setText(format.format(model.getPreviousPrice()));
      if (model.getCurrentPrice() > model.getPreviousPrice()) {
        currentField.setForeground(Color.BLUE);
      }
 else {
        currentField.setForeground(Color.RED);
      }
    }
  }
);
}
 

Example 25

From project drugis-common, under directory /common-gui/src/main/java/org/drugis/common/gui/.

Source file: BuildViewWhenReadyComponent.java

  29 
vote

private void buildDoneView(){
  Runnable worker=new Runnable(){
    public void run(){
      setVisible(false);
      removeAll();
      add(d_builder.buildPanel());
      setVisible(true);
    }
  }
;
  SwingUtilities.invokeLater(worker);
}
 

Example 26

From project e4-rendering, under directory /com.toedter.e4.demo.contacts.swing/src/com/toedter/e4/demo/contacts/swing/handlers/.

Source file: SwitchThemeHandler.java

  29 
vote

@Execute public void switchTheme(@Named("contacts.commands.switchtheme.themeid") final String themeId,final JFrame frame){
  SwingUtilities.invokeLater(new Runnable(){
    @Override public void run(){
      try {
        UIManager.setLookAndFeel(themeId);
        SwingUtilities.updateComponentTreeUI(frame);
      }
 catch (      ClassNotFoundException e) {
        e.printStackTrace();
      }
catch (      InstantiationException e) {
        e.printStackTrace();
      }
catch (      IllegalAccessException e) {
        e.printStackTrace();
      }
catch (      UnsupportedLookAndFeelException e) {
        e.printStackTrace();
      }
    }
  }
);
}
 

Example 27

From project eclim, under directory /org.eclim.installer/java/org/eclim/installer/step/.

Source file: EclipsePluginsStep.java

  29 
vote

public void process(final String line){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      if (line.startsWith(BEGIN_TASK)) {
        String l=line.substring(BEGIN_TASK.length() + 2);
        double work=Double.parseDouble(l.substring(l.indexOf('=') + 1,l.indexOf(' ')));
        taskProgress.setIndeterminate(false);
        taskProgress.setMaximum((int)work);
        taskProgress.setValue(0);
      }
 else       if (line.startsWith(PREPARE_TASK)) {
        taskLabel.setText(line.substring(PREPARE_TASK.length() + 1).trim());
      }
 else       if (line.startsWith(SUB_TASK)) {
        taskLabel.setText(taskName + line.substring(SUB_TASK.length() + 1).trim());
      }
 else       if (line.startsWith(INTERNAL_WORKED)) {
        double worked=Double.parseDouble(line.substring(INTERNAL_WORKED.length() + 2));
        taskProgress.setValue((int)worked);
        overallProgress.setValue(overallProgressStep + (int)(taskProgress.getPercentComplete() * 100));
      }
 else       if (line.startsWith(SET_TASK_NAME)) {
        taskName=line.substring(SET_TASK_NAME.length() + 1).trim() + ' ';
      }
    }
  }
);
}
 

Example 28

From project empire-db, under directory /empire-db-examples/empire-db-example-cxf/src/main/java/org/apache/empire/samples/cxf/wssample/client/.

Source file: RunClient.java

  29 
vote

public static void main(String[] args){
  final EmployeeServiceClient proxy=new EmployeeServiceClient(ServerControl.serviceAddress);
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      new ClientGUI(proxy);
    }
  }
);
}
 

Example 29

From project en4j, under directory /NBPlatformApp/MainModule/src/main/java/com/rubenlaguna/en4j/mainmodule/.

Source file: NoteListTopComponent.java

  29 
vote

private void performSearch(final boolean useDim){
  final RequestProcessor.Task previousSearchTask=currentSearchTask;
  if (previousSearchTask != null) {
    previousSearchTask.cancel();
  }
  Runnable r=new Runnable(){
    @Override public void run(){
      if (previousSearchTask != null) {
        previousSearchTask.waitFinished();
      }
      LOG.log(Level.FINE,"{0} searchstring {1}",new Object[]{this.toString(),searchstring});
      dim(useDim);
      final String text=searchstring;
      LOG.fine("searching in lucene...");
      if (text.trim().isEmpty() || text.equals(org.openide.util.NbBundle.getMessage(NoteListTopComponent.class,"NoteListTopComponent.searchTextField.text"))) {
        LOG.log(Level.FINE,"no need to search the search box is empty {0} from thread {1}",new Object[]{text,Thread.currentThread().getName()});
        notesMatcher.refilter(null);
      }
 else {
        NoteFinder finder=Lookup.getDefault().lookup(NoteFinder.class);
        Collection<Note> prelList=finder.find(text);
        LOG.log(Level.FINE,"search for {0} returned {1} results.",new Object[]{text,prelList.size()});
        notesMatcher.refilter(prelList);
      }
      final int repSize=rep.size();
      SwingUtilities.invokeLater(new Runnable(){
        @Override public void run(){
          final String text=filteredList.size() + "/" + repSize;
          LOG.log(Level.FINE,"Refreshing the label in the EDT with {0}",text);
          partialResultsJLabel.setText(text);
        }
      }
);
      unDim(useDim);
    }
  }
;
  currentSearchTask=RP.post(r,500);
  LOG.fine("currentSearchtask posted");
}
 

Example 30

From project Enterprise-Application-Samples, under directory /CCA/PushApp/src/eclserver/.

Source file: NewJFrame.java

  29 
vote

private void ensureEventThread(){
  if (SwingUtilities.isEventDispatchThread()) {
    return;
  }
  throw new RuntimeException("EXCEPTION:  RuntimeException in ensureEventThread()");
}
 

Example 31

From project erjang, under directory /src/main/java/erjang/console/.

Source file: ERLConsole.java

  29 
vote

public StatusBar(){
  setLayout(new BorderLayout());
  setPreferredSize(new Dimension(10,23));
  JPanel rightPanel=new JPanel(new BorderLayout());
  rightPanel.add(new JLabel(new AngledLinesWindowsCornerIcon()),BorderLayout.SOUTH);
  rightPanel.setOpaque(false);
  add(rightPanel,BorderLayout.EAST);
  setBackground(SystemColor.control);
  progress=new JLabel("booting...");
  progress.setPreferredSize(new Dimension(300,23));
  Progress.setListener(new ProgressListener(){
    @Override public void progress(    final String msg){
      SwingUtilities.invokeLater(new Runnable(){
        public void run(){
          progress.setText(msg);
          progress.repaint();
        }
      }
);
    }
  }
);
  add(progress,BorderLayout.WEST);
  mem_label=new JLabel();
  add(mem_label,BorderLayout.CENTER);
}
 

Example 32

From project Euclidean-Pattern-Generator, under directory /src/com/hisschemoller/sequencer/.

Source file: SequencerMain.java

  29 
vote

public static void main(String[] args){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      new SequencerMain();
    }
  }
);
}
 

Example 33

From project extension_libero_manufacturing, under directory /extension/eevolution/libero/src/main/java/it/cnr/imaa/essi/lablib/gui/checkboxtree/.

Source file: QuadristateCheckbox.java

  29 
vote

public QuadristateCheckbox(String text,Icon icon,State state){
  super(text,icon);
  super.addMouseListener(new MouseAdapter(){
    @Override public void mousePressed(    MouseEvent e){
      grabFocus();
      getModel().nextState();
    }
  }
);
  ActionMap map=new ActionMapUIResource();
  map.put("pressed",new AbstractAction(){
    public void actionPerformed(    ActionEvent e){
      grabFocus();
      getModel().nextState();
    }
  }
);
  map.put("released",null);
  SwingUtilities.replaceUIActionMap(this,map);
  setState(state);
}
 

Example 34

From project flyingsaucer, under directory /flying-saucer-core/src/main/java/org/xhtmlrenderer/swing/.

Source file: SelectionHighlighter.java

  29 
vote

public void mousePressed(MouseEvent e){
  int nclicks=e.getClickCount();
  if (SwingUtilities.isLeftMouseButton(e)) {
    if (e.isConsumed()) {
    }
 else {
      adjustCaretAndFocus(e);
      MouseEvent newE=convertMouseEventToScale(e);
      adjustCaretAndFocus(newE);
      if (nclicks == 2) {
        selectWord(newE);
      }
    }
  }
}
 

Example 35

From project formic, under directory /src/java/foxtrot/.

Source file: AbstractSyncWorker.java

  29 
vote

/** 
 * Executes the given Task using the given workerThread and eventPump. This method blocks (while dequeuing AWT events) until the Task is finished, either by returning a result or by throwing.
 */
Object post(Task task,WorkerThread workerThread,EventPump eventPump) throws Exception {
  boolean isEventThread=SwingUtilities.isEventDispatchThread();
  if (!isEventThread && !workerThread.isWorkerThread()) {
    throw new IllegalStateException("Method post() can be called only from the AWT Event Dispatch Thread or from a worker thread");
  }
  if (isEventThread) {
    workerThread.postTask(task);
    eventPump.pumpEvents(task);
  }
 else {
    workerThread.runTask(task);
  }
  try {
    return task.getResultOrThrow();
  }
  finally {
    task.reset();
  }
}
 

Example 36

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

Source file: BlinkingNodeHook.java

  29 
vote

/** 
 * TimerTask method to enable the selection after a given time. 
 */
public void run(){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      if (getNode() == null || getController().isBlocked())       return;
      getNode().acceptViewVisitor(new NodeViewVisitor(){
        public void visit(        NodeView view){
          if (!view.isVisible()) {
            return;
          }
          Color col=view.getMainView().getForeground();
          int index=-1;
          if (col != null && colors.contains(col)) {
            index=colors.indexOf(col);
          }
          index++;
          if (index >= colors.size())           index=0;
          view.getMainView().setForeground((Color)colors.get(index));
        }
      }
);
    }
  }
);
}
 

Example 37

From project GenericKnimeNodes, under directory /com.genericworkflownodes.knime.base_plugin/src/com/genericworkflownodes/knime/generic_node/dialogs/param_dialog/itemlist/.

Source file: ItemListFillerDialog.java

  29 
vote

public static void main(String[] args){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      ItemListFillerDialogModel mdl=new ItemListFillerDialogModel(new String[]{"A","B","D"});
      mdl.restrictValues("A","B","C","D");
      mdl.setSetLike(true);
      ItemListFillerDialog sd=new ItemListFillerDialog(mdl);
      sd.setVisible(true);
    }
  }
);
}
 

Example 38

From project glg2d, under directory /src/main/java/glg2d/.

Source file: GLAwareRepaintManager.java

  29 
vote

private void queue(){
  SwingUtilities.invokeLater(new Runnable(){
    @Override public void run(){
      Map<JComponent,Rectangle> r;
synchronized (rects) {
        r=new IdentityHashMap<JComponent,Rectangle>(rects);
        queued=false;
        rects.clear();
      }
      r=filter(r);
      G2DGLPanel canvas=getGLParent(r.keySet().iterator().next());
      canvas.paintGLImmediately(r);
    }
  }
);
}
 

Example 39

From project Gmote, under directory /gmoteupdater/src/org/gmote/server/updater/.

Source file: ProgressDialog.java

  29 
vote

public static void showProgressDialog(){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      makeFrame();
    }
  }
);
}
 

Example 40

From project gradle-intellij-gui, under directory /src/main/java/org/gradle/ideaplugin/ui/.

Source file: GradleOutputComponent.java

  29 
vote

public void requestComplete(long requestID,final boolean wasSuccessful){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      if (!wasSuccessful && !myToolWindow.isVisible())       showToolWindow();
    }
  }
);
  setIcon();
}
 

Example 41

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

Source file: ExtendedTextField.java

  29 
vote

/** 
 * The mouse has been pressed over this text field. Popup the cut/paste menu.
 * @param evt mouse event
 */
protected void dealWithMousePress(MouseEvent evt){
  if (SwingUtilities.isRightMouseButton(evt)) {
    JPopupMenu menu=new JPopupMenu();
    menu.add(new CutAction(this));
    menu.add(new CopyAction(this));
    menu.add(new PasteAction(this));
    menu.add(new DeleteAction(this));
    menu.addSeparator();
    menu.add(new SelectAllAction(this));
    Point pt=SwingUtilities.convertPoint(evt.getComponent(),evt.getPoint(),this);
    menu.show(this,pt.x,pt.y);
  }
}
 

Example 42

From project gs-tool, under directory /src/org/graphstream/tool/.

Source file: ToolGUI.java

  29 
vote

public static void main(String... args){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      ToolType tt=(ToolType)JOptionPane.showInputDialog(null,"Choose tool type:","GraphStream Tool",JOptionPane.QUESTION_MESSAGE,null,ToolType.values(),ToolType.GENERATE);
      if (tt != null) {
        Tool t=null;
switch (tt) {
case GENERATE:
          t=new Generate();
        break;
case CONVERT:
      t=new Convert();
    break;
case PLAYER:
  t=new Player();
break;
}
ToolGUI gui=new ToolGUI(t);
gui.display();
}
}
}
);
}
 

Example 43

From project harmony, under directory /harmony.ui.topologygui/src/main/java/org/opennaas/ui/topology/.

Source file: TopologyClient.java

  29 
vote

/** 
 * @param args
 */
public static void main(final String[] args){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      final TopologyClient application=new TopologyClient();
      application.getJFrame().setVisible(true);
    }
  }
);
}
 

Example 44

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

Source file: ErrorGui.java

  29 
vote

public boolean goterror(Throwable t){
  reporter=Thread.currentThread();
  java.io.StringWriter w=new java.io.StringWriter();
  t.printStackTrace(new java.io.PrintWriter(w));
  final String tr=w.toString();
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      closebtn.setEnabled(false);
      status.setText("Please wait...");
      exbox.setText(tr);
      pack();
      setVisible(true);
    }
  }
);
  return (true);
}
 

Example 45

From project HMS, under directory /common/src/main/java/org/apache/hms/common/util/.

Source file: ServiceDiscovery.java

  29 
vote

/** 
 * Add a service.
 */
public void serviceAdded(ServiceEvent event){
  final String name=event.getName();
  System.out.println("ADD: " + name);
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      insertSorted(services,name);
    }
  }
);
}
 

Example 46

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

Source file: SoundPoolGUI.java

  29 
vote

/** 
 * @param toSelec Si un noeud particulier doit etre s??ectionn?.
 */
public void updateSoundTree(final DefaultMutableTreeNode toSelec){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      Vector<HoloWaveForm> sounds=holoEditRef.gestionPistes.soundPool.getSounds();
      soundTree.clear();
      for (int i=0; i < sounds.size(); i++) {
        HoloWaveForm h=sounds.get(i);
        DefaultMutableTreeNode parent=soundTree.addObject(h);
        HoloWaveForm hwf=(HoloWaveForm)h;
        DefaultMutableTreeNode childNode=null;
        for (        Object child : hwf.getLinkedDatas()) {
          if (child != null)           childNode=soundTree.addObject(parent,child);
        }
        try {
          if (toSelec != null) {
            if (toSelec.toString().equals(parent.toString()))             soundTree.getTree().getSelectionModel().setSelectionPath(new TreePath(childNode.getPath()));
          }
 else           if (i == (sounds.size() - 1)) {
            soundTree.getTree().expandPath(new TreePath(parent.getPath()));
            soundTree.getTree().getSelectionModel().setSelectionPath(new TreePath(parent.getPath()));
          }
        }
 catch (        NullPointerException e) {
          System.err.println("null");
        }
      }
      soundTree.repaint();
    }
  }
);
}