本文整理汇总了Java中javax.swing.SwingUtilities.invokeLater方法的典型用法代码示例。如果您正苦于以下问题:Java SwingUtilities.invokeLater方法的具体用法?Java SwingUtilities.invokeLater怎么用?Java SwingUtilities.invokeLater使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.SwingUtilities
的用法示例。
在下文中一共展示了SwingUtilities.invokeLater方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cbEventsActionPerformed
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
private void cbEventsActionPerformed () {
// Add your handling code here:
if (doNotRefresh) return;
SwingUtilities.invokeLater (new Runnable () {
@Override
public void run () {
boolean pv = cbEvents.isPopupVisible ();
int j = cbEvents.getSelectedIndex ();
if (j < 0) return;
update (types.get (j));
if (pv)
SwingUtilities.invokeLater (new Runnable () {
@Override
public void run () {
cbEvents.setPopupVisible (true);
}
});
//cbEvents.setPopupVisible (true);
}
});
}
示例2: nodeRenamed
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
private void nodeRenamed(final TreeNode node) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
((DefaultTreeModel) tree.getModel()).nodeChanged(node);
}
});
}
示例3: makeContentPanel
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
/**
* Creates the content panel consisting of a scrollable text area to display the EULA text and a
* check box to accept it.
*/
private JComponent makeContentPanel() {
JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
// add text area with scroll pane
panel.add(this.scrollPane, BorderLayout.CENTER);
// scroll to tohe top of the document
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
scrollPane.getVerticalScrollBar().setValue(0);
}
});
// add check box to enable accept button
panel.add(this.acceptCheckBox, BorderLayout.SOUTH);
return panel;
}
示例4: run
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
/**
* Calls the <code>construct</code> method to compute the result,
* and then invokes the <code>finished</code> method on the event
* dispatch thread.
*/
public void run() {
Callable function = new Callable() {
public Object call() throws Exception {
return construct();
}
};
Runnable doFinished = new Runnable() {
public void run() {
finished();
}
};
/* Convert to TimedCallable if timeout is specified. */
long msecs = getTimeout();
if (msecs != 0) {
TimedCallable tc = new TimedCallable(function, msecs);
tc.setThreadFactory(getThreadFactory());
function = tc;
}
result.setter(function).run();
SwingUtilities.invokeLater(doFinished);
}
示例5: doneTask
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
void doneTask() {
final Object monitor = this;
SwingUtilities.invokeLater(new Runnable() {
public void run() {
done = true;
synchronized(monitor) {
monitor.notify();
}
}
});
}
示例6: displayMessage
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
private void displayMessage(final String messageToDisplay)
{
SwingUtilities.invokeLater(
new Runnable()
{
public void run() // updates displayArea
{
displayArea.append(messageToDisplay);
}
}
);
}
示例7: setFinishedRendering
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public void setFinishedRendering(int w, int h, int gifFrame) {
error = false;
lastRendTime = (int) (System.currentTimeMillis()-renderStart);
dispW = w;
dispH = h;
this.frame = gifFrame;
SwingUtilities.invokeLater(() -> refreshText());
}
示例8: childrenLoadingFinished
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override
protected void childrenLoadingFinished() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (toSelect != null) {
DashboardViewer.getInstance().select(toSelect);
toSelect = null;
}
}
});
}
示例9: startProgress
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
private void startProgress() {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
progressHandle = ProgressHandleFactory.createHandle(null);
progressComponent = ProgressHandleFactory.createProgressComponent(progressHandle);
progressContainerPanel.add(progressComponent, BorderLayout.CENTER);
progressHandle.start();
progressMessageLabel.setText(NbBundle.getMessage (SchemaPanel.class, "ConnectionProgress_Connecting"));
}
});
}
示例10: run
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
/** Body of task executed in RequestProcessor. Runs AsyncGUIJob's worker
* method and after its completion posts AsyncJob's UI update method
* to AWT thread.
*/
@Override
public void run() {
if (!SwingUtilities.isEventDispatchThread()) {
LOG.log(Level.FINE, "Prepare outside AWT for {0}", comp4Init);
// first pass, executed in some of RP threads
initJob.construct();
comp4Init.removeHierarchyListener(this);
LOG.log(Level.FINE, "No hierarchy listener for {0}", comp4Init);
// continue to invoke finished method only if hasn't been cancelled
boolean localCancel;
synchronized (CANCELLED_LOCK) {
localCancel = wasCancelled;
}
LOG.log(Level.FINE, "wasCancelled {0}", localCancel);
if (!localCancel) {
SwingUtilities.invokeLater(this);
}
} else {
// second pass, executed in event dispatch thread
initJob.finished();
LOG.fine("Second pass finished");
}
}
示例11: paintComponent
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override
public void paintComponent(Graphics g) {
SwingUtilities.invokeLater(() -> {
Graphics2D g2 = (Graphics2D) getGraphics();
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setStroke(new BasicStroke(5, BasicStroke.JOIN_ROUND, BasicStroke.CAP_ROUND));
g2.setColor(Color.red);
g2.drawLine(origemEvento.x, origemEvento.y, destinoEvento.x, destinoEvento.y);
g2.setStroke(new BasicStroke(5, BasicStroke.JOIN_ROUND, BasicStroke.CAP_ROUND));
g2.drawOval(destinoEvento.x - 25, destinoEvento.y - 25, 50, 50);
g2.fillOval(destinoEvento.x - 10, destinoEvento.y - 10, 20, 20);
g2.dispose();
});
}
示例12: main
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public static void main(String args[]) throws Exception {
countDownLatch = new CountDownLatch(1);
SwingUtilities.invokeLater(CaretFloatingPointAPITest::createUI);
countDownLatch.await(15, TimeUnit.MINUTES);
if (!testResult) {
throw new RuntimeException("Test fails!");
}
}
示例13: contentsUpdated
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public void contentsUpdated(long offsetX, long offsetY,
double scaleX, double scaleY,
long lastOffsetX, long lastOffsetY,
double lastScaleX, double lastScaleY,
int shiftX, int shiftY) {
if (highlightedValues.isEmpty() && !support.isTimestampSelection(true)) return;
if (lastOffsetX != offsetX || lastOffsetY != offsetY ||
scaleX != lastScaleX || scaleY != lastScaleY)
SwingUtilities.invokeLater(selectionUpdater);
}
示例14: initLater
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
private void initLater(){
if (ProviderUtil.isValidServerInstanceOrNone(project)){
if(SwingUtilities.isEventDispatchThread()){
connectDatasources();
} else {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
connectDatasources();
}
});
}
}
}
示例15: scrollToBottom
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public void scrollToBottom()
{
Runnable scrollit = new Runnable() {
public void run() {
scrollRectToVisible(getCellRect(getModel().getRowCount(), 1, true));
}
};
SwingUtilities.invokeLater(scrollit);
}