本文整理匯總了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());
}
}
});
}