本文整理汇总了Java中java.awt.EventQueue.invokeLater方法的典型用法代码示例。如果您正苦于以下问题:Java EventQueue.invokeLater方法的具体用法?Java EventQueue.invokeLater怎么用?Java EventQueue.invokeLater使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.EventQueue
的用法示例。
在下文中一共展示了EventQueue.invokeLater方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateTitle
import java.awt.EventQueue; //导入方法依赖的package包/类
/**
* Updates the title of the enclosing view.
*/
void updateTitle() {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
if (active) {
TopComponent tc = WindowManager.getDefault().findTopComponent("CssStylesTC"); // NOI18N
if(tc != null) {
FileObject fob = getContext();
if(fob != null) {
((CssStylesTC)tc).setTitle(fob.getNameExt());
}
}
}
}
});
}
示例2: configurationXmlChanged
import java.awt.EventQueue; //导入方法依赖的package包/类
public @Override void configurationXmlChanged(AntProjectEvent ev) {
// XXX this is a little strange but happens during project move. Bad ordering.
// Probably bug in moving implementation (our or in general Project API).
if (project.getHelper().resolveFileObject(AntProjectHelper.PROJECT_XML_PATH) != null) {
Runnable r = new Runnable() {
public @Override void run() {
refreshKeys();
refreshScheduled = false;
}
};
if (project.isRunInAtomicAction()) {
if (! refreshScheduled) {
refreshScheduled = true;
EventQueue.invokeLater(r);
}
} else {
r.run();
}
}
}
示例3: updateSplitLocation
import java.awt.EventQueue; //导入方法依赖的package包/类
private void updateSplitLocation () {
JComponent parent = (JComponent) panel.getParent();
Dimension dim = parent == null ? new Dimension() : parent.getSize();
if (dim.width <= 0 || dim.height <= 0) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
updateSplitLocation();
}
});
return;
}
FileViewComponent fileComp = getActiveFileComponent();
int preferredHeaderHeight = fileComp.getPreferredHeaderHeight();
int preferredHeight = fileComp.getPreferredHeight();
int optimalLocation = preferredHeight + preferredHeaderHeight + 5;
if (optimalLocation > dim.height / 3) {
optimalLocation = dim.height / 3;
}
if (optimalLocation <= preferredHeaderHeight) {
optimalLocation = preferredHeaderHeight * 3;
}
if (dividerSet && panel.splitPane.getDividerLocation() <= optimalLocation) return;
panel.splitPane.setDividerLocation(optimalLocation);
dividerSet = true;
}
示例4: main
import java.awt.EventQueue; //导入方法依赖的package包/类
/**
* Launch the application.
*/
public static void main(String[] args) { //ekhane dhukar drkr nai :/
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Main frame = new Main();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
示例5: main
import java.awt.EventQueue; //导入方法依赖的package包/类
/**
* Launch the application.
*/
public static void main(String[] args)
{
EventQueue.invokeLater(new Runnable()
{
public void run()
{
try
{
LoginFrame frame = new LoginFrame();
//AWTUtilities.setWindowOpaque(frame, false);//设置窗体完全透明
frame.setVisible(true);
}
catch (Exception e)
{
e.printStackTrace();
}
}
});
}
示例6: perform
import java.awt.EventQueue; //导入方法依赖的package包/类
@Override
public void perform() {
try {
loadFiles();
if (RepositoryInfo.getInstance(repository).getActiveBranch() != GitBranch.NO_BRANCH_INSTANCE) {
loadHeadLogMessage();
}
} catch (GitException ex) {
GitClientExceptionHandler.notifyException(ex, true);
} finally {
refreshFinished[0] = true;
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
stopProgress();
}
});
}
}
示例7: cmbFilterKindActionPerformed
import java.awt.EventQueue; //导入方法依赖的package包/类
private void cmbFilterKindActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbFilterKindActionPerformed
boolean filterCritVisible = cmbFilterKind.getSelectedItem() != FilterKind.ALL;
lblFilterContains.setVisible(filterCritVisible);
txtFilter.setVisible(filterCritVisible);
if (filterCritVisible) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run () {
if (!cmbFilterKind.isPopupVisible()) {
txtFilter.requestFocusInWindow();
}
}
});
}
if (filterTimer != null && !txtFilter.getText().trim().isEmpty()) {
filterTimer.restart();
}
}
示例8: setContents
import java.awt.EventQueue; //导入方法依赖的package包/类
@Override
public void setContents(Transferable contents, ClipboardOwner owner) {
synchronized (this) {
if (this.contents != null) {
transferableOwnershipLost(this.contents);
}
final ClipboardOwner oldOwner = this.owner;
final Transferable oldContents = this.contents;
this.owner = owner;
this.contents = contents;
if (oldOwner != null && oldOwner != owner) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
oldOwner.lostOwnership(ExClipboard.this, oldContents);
}
});
}
}
FlavorEvent e = new FlavorEvent(this);
fireClipboardChange();
for (FlavorListener l : getFlavorListeners()) {
l.flavorsChanged(e);
}
}
示例9: changeState
import java.awt.EventQueue; //导入方法依赖的package包/类
final void changeState(final String id, final boolean disabled, final String text) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
for (JButton b : arr) {
if (b.getName().equals(id)) {
b.setEnabled(!disabled);
b.setText(text);
}
}
}
});
}
示例10: run
import java.awt.EventQueue; //导入方法依赖的package包/类
@Override
public void run () {
if (EventQueue.isDispatchThread()) {
updatePreview ();
if (blinkSequence == 0) {
return;
}
blinkSequence --;
task.schedule (250);
} else {
EventQueue.invokeLater(this);
}
}
示例11: main
import java.awt.EventQueue; //导入方法依赖的package包/类
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
LoginPanel frame = new LoginPanel();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
示例12: newDebugTask
import java.awt.EventQueue; //导入方法依赖的package包/类
static TimerTask newDebugTask () {
return new TimerTask() {
public void run () {
if (!EventQueue.isDispatchThread()) {
EventQueue.invokeLater(this);
return;
}
for (TableLayout layout : debugLayouts)
layout.drawDebug();
timer.schedule(newDebugTask(), 250);
}
};
}
示例13: setName
import java.awt.EventQueue; //导入方法依赖的package包/类
/**
* Change the current display name.
*/
public void setName(String n) {
String oldGroupName = getNameOrNull();
prefs().put(KEY_NAME, n);
notifyListeners(this, "groupRename", oldGroupName, n);
if (this.equals(getActiveGroup())) {
EventQueue.invokeLater(new Runnable() {
@Override public void run() {
ProjectTab.findDefault(ProjectTab.ID_LOGICAL).setGroup(Group.this);
}
});
}
}
示例14: run
import java.awt.EventQueue; //导入方法依赖的package包/类
@Override
public void run () {
final String tagName = CreateTag.this.tagName;
GitClient client = null;
try {
client = Git.getInstance().getClient(repository);
final Map<String, GitTag> tags = client.getTags(GitUtils.NULL_PROGRESS_MONITOR, true);
EventQueue.invokeLater(new Runnable () {
@Override
public void run () {
if (tagName.equals(panel.tagNameField.getText())) {
nameValid = !tags.containsKey(tagName);
if (!panel.cbForceUpdate.isEnabled()) {
panel.cbForceUpdate.setSelected(false);
}
panel.cbForceUpdate.setEnabled(!nameValid);
validate();
}
}
});
} catch (GitException ex) {
GitClientExceptionHandler.notifyException(ex, true);
} finally {
if (client != null) {
client.release();
}
}
}
示例15: push
import java.awt.EventQueue; //导入方法依赖的package包/类
public void push (final File repository) {
if (EventQueue.isDispatchThread()) {
Utils.post(new Runnable () {
@Override
public void run () {
push(repository);
}
});
return;
}
RepositoryInfo info = RepositoryInfo.getInstance(repository);
try {
info.refreshRemotes();
} catch (GitException ex) {
GitClientExceptionHandler.notifyException(ex, true);
}
final Map<String, GitRemoteConfig> remotes = info.getRemotes();
EventQueue.invokeLater(new Runnable() {
@Override
public void run () {
PushWizard wiz = new PushWizard(repository, remotes);
if (wiz.show()) {
Utils.logVCSExternalRepository("GIT", wiz.getPushUri()); //NOI18N
push(repository, wiz.getPushUri(), wiz.getPushMappings(), wiz.getFetchRefSpecs(), wiz.getRemoteName());
}
}
});
}