List of usage examples for javax.swing SwingUtilities invokeLater
public static void invokeLater(Runnable doRun)
From source file:edu.ku.brc.specify.rstools.ExportToFile.java
public void processDataList(List<?> data, Properties reqParams) throws Exception { DataExport exporter = buildExporter(reqParams); if (exporter != null) { final String name = FilenameUtils.getName(exporter.getConfig().getFileName()); final String msgKey = reqParams.getProperty("statusmsgkey") == null ? "EXPORTING_TO" : reqParams.getProperty("statusmsgkey"); final String doneMsgKey = reqParams.getProperty("statusdonemsgkey") == null ? "EXPORTING_DONE" : reqParams.getProperty("statusdonemsgkey"); final JStatusBar statusBar = UIRegistry.getStatusBar(); if (statusBar != null) { SwingUtilities.invokeLater(new Runnable() { public void run() { statusBar.setText(/*from w ww. j a v a 2 s . c o m*/ String.format(UIRegistry.getResourceString(msgKey), new Object[] { name })); } }); } try { exporter.writeData(data); if (statusBar != null) { SwingUtilities.invokeLater(new Runnable() { public void run() { statusBar.setText( String.format(UIRegistry.getResourceString(doneMsgKey), new Object[] { name })); } }); } } catch (IOException e) { edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount(); edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(ExportToFile.class, e); throw (e); } } }
From source file:de.codesourcery.jasm16.ide.ui.views.HexDumpView.java
@Override public void refreshDisplay() { if (emulator == null) { return;/* w w w.j av a 2s . com*/ } SwingUtilities.invokeLater(new Runnable() { @Override public void run() { final byte[] data = MemUtils.getBytes(emulator.getMemory(), dumpStartAddress, calcSizeOfVisibleMemory(), true); textArea.setText(Misc.toHexDumpWithAddresses(dumpStartAddress, data, data.length, numberOfWordsPerLine, printASCII, true)); } }); }
From source file:it.unibo.alchemist.boundary.gui.asmc.SimplePlot.java
@Override public void batchDone(final double[][] values, final double lower, final double upper, final int sampleSize) { this.removeAll(); final YIntervalSeries series = new YIntervalSeries("Probability of condition satisfaction vs. time"); for (final double[] value : values) { series.add(value[0], value[1], value[2], value[TRE]); }//from w w w. j a va 2 s . co m final YIntervalSeriesCollection data = new YIntervalSeriesCollection(); data.addSeries(series); final JFreeChart chart = ChartFactory.createXYLineChart("", "X", "Y", data, PlotOrientation.VERTICAL, true, true, false); XYItemRenderer renderer; switch (currentRenderer) { case 1: renderer = new YIntervalRenderer(); break; case 0: default: renderer = new DeviationRenderer(true, false); } final XYPlot plot = (XYPlot) chart.getPlot(); plot.setRenderer(renderer); plot.getDomainAxis().setLowerBound(lower); plot.getDomainAxis().setUpperBound(upper); plot.getRangeAxis().setUpperBound(1.0); plot.getRangeAxis().setLowerBound(0.0); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(DIMENSION); this.setLayout(new BorderLayout()); this.add(chartPanel, BorderLayout.NORTH); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { chartPanel.getRootPane().validate(); } }); }
From source file:edu.harvard.mcz.imagecapture.ui.FilteringAgentJComboBox.java
private void init() { // listen for loss of focus on the text field this.getEditor().getEditorComponent().addFocusListener(this); this.setEditable(true); final JTextField textfield = (JTextField) this.getEditor().getEditorComponent(); textfield.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent keyEvent) { log.debug(keyEvent);/*w ww . ja va2s. c om*/ SwingUtilities.invokeLater(new Runnable() { public void run() { filter(textfield.getText(), true); } }); } }); }
From source file:EnrollFingerprint.Enroll.java
protected void init() { capturer.addDataListener(new DPFPDataAdapter() { @Override// ww w .j ava 2s. com public void dataAcquired(final DPFPDataEvent e) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { makeReport("La huella fue capturada."); setPrompt("Escanear la misma huella de nuevo."); process(e.getSample()); } }); } }); capturer.addReaderStatusListener(new DPFPReaderStatusAdapter() { @Override public void readerConnected(final DPFPReaderStatusEvent e) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { makeReport("Lector de huellas conectado."); } }); } @Override public void readerDisconnected(final DPFPReaderStatusEvent e) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { makeReport("Lector de huellas desconectado."); } }); } }); capturer.addSensorListener(new DPFPSensorAdapter() { @Override public void fingerTouched(final DPFPSensorEvent e) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { makeReport("El escaner de huellas fue tocado."); } }); } @Override public void fingerGone(final DPFPSensorEvent e) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { makeReport("El dedo fue retirado del escaner de huellas."); } }); } }); capturer.addImageQualityListener(new DPFPImageQualityAdapter() { @Override public void onImageQuality(final DPFPImageQualityEvent e) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { if (e.getFeedback().equals(DPFPCaptureFeedback.CAPTURE_FEEDBACK_GOOD)) { makeReport("La calidad de la huella escaneada es buena."); } else { makeReport("La calidad de la huella escaneada es pobre."); } } }); } }); }
From source file:edu.harvard.mcz.imagecapture.ui.FilteringGeogJComboBox.java
private void init() { countryLimit = ""; stateprovLimit = ""; cachedModel = null;/*from ww w .j a va 2 s. c o m*/ lastTextLength = 0; // listen for loss of focus on the text field this.getEditor().getEditorComponent().addFocusListener(this); this.setEditable(true); final JTextField textfield = (JTextField) this.getEditor().getEditorComponent(); textfield.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent keyEvent) { log.debug(keyEvent); SwingUtilities.invokeLater(new Runnable() { public void run() { filter(textfield.getText(), true); } }); } }); }
From source file:net.sf.profiler4j.console.util.task.LongTask.java
/** * Called to update the message that appears in the dialog. This method may be called * during the execution of the task./*from w ww .j a v a2 s.c om*/ * @param s New message */ protected void setTaskMessage(final String s) { SwingUtilities.invokeLater(new Runnable() { public void run() { dialog.setMessage(s); } }); }
From source file:io.github.jeddict.jpa.modeler.properties.classmember.ClassMemberPanel.java
@Override public void setValue(ClassMembers classMembers) { this.classMembers = classMembers; SwingUtilities.invokeLater(() -> { node = new CMRootNode(classWidget, classMembers, new ClassMemberChildFactory(), new CheckableAttributeNode()); manager.setRootContext(node);//ww w. ja v a2 s .c om node.init(); }); updatebutton(); }
From source file:turtlekit.viewer.StatesPerSecondCharter.java
/** * //from w w w . ja v a 2s.com */ private void initTimer() { stopTimer(); timer = new java.util.Timer(true); timer.scheduleAtFixedRate(new TimerTask() { private double last = 0; @Override public void run() { try { final double gvt = probe.getPropertyValue(); final double statesPerSecond = (gvt - last); if (logger != null) logger.fine("statesPerSecond =" + statesPerSecond); last = gvt; SwingUtilities.invokeLater(new Runnable() {// avoiding null pointers on the awt thread @Override public void run() { if (statesPerSecond > 0) { serie.add((int) gvt, statesPerSecond); } } }); } catch (NullPointerException e) {//ugly but avoids e when quiting } } }, 0, getRefreshRate()); }
From source file:dev.agustin.serializer.MainWindow.java
protected void textScroll() { SwingUtilities.invokeLater(new Runnable() { public void run() { getJTextArea().setCaretPosition(getJTextArea().getText().length()); }// www. j a v a 2 s . c o m }); }