当前位置: 首页>>代码示例>>Java>>正文


Java SwingUtilities.invokeLater方法代码示例

本文整理汇总了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);
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:AddBreakpointPanel.java

示例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);
        }
    });
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:9,代码来源:ObjectTree.java

示例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;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:25,代码来源:EULADialog.java

示例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);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:31,代码来源:SwingWorker.java

示例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();
            }
        }
    });
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:12,代码来源:bug4337267.java

示例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);
         }
      }  
   ); 
}
 
开发者ID:cleitonferreira,项目名称:LivroJavaComoProgramar10Edicao,代码行数:13,代码来源:Client.java

示例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());
}
 
开发者ID:CalebKussmaul,项目名称:GIFKR,代码行数:9,代码来源:PreviewStatusPanel.java

示例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;
            }
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:TaskContainerNode.java

示例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"));
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:SchemaPanel.java

示例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");
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:AsyncInitSupport.java

示例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();
    });
}
 
开发者ID:limagiran,项目名称:hearthstone,代码行数:15,代码来源:Animacao.java

示例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!");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:CaretFloatingPointAPITest.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:TimelineSelectionOverlay.java

示例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();
                }
            });
        }
    }        
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:PersistenceUnitWizardPanelDS.java

示例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);
}
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:10,代码来源:Timer.java


注:本文中的javax.swing.SwingUtilities.invokeLater方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。