當前位置: 首頁>>代碼示例>>Java>>正文


Java EventQueue.invokeLater方法代碼示例

本文整理匯總了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());
                    }
                }
            }
        }
    });
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:DocumentViewPanel.java

示例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();
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:21,代碼來源:UnitTestLibrariesNode.java

示例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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:27,代碼來源:MultiDiffPanelController.java

示例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();
			}
		}
	});
}
 
開發者ID:arfin97,項目名稱:SnakeAndLadder,代碼行數:19,代碼來源:Main.java

示例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();
			}
		}
	});
}
 
開發者ID:sxei,項目名稱:myqq,代碼行數:23,代碼來源:LoginFrame.java

示例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();
            }
        });
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:GitCommitPanel.java

示例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();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:SearchHistoryPanel.java

示例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);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:29,代碼來源:ExClipboard.java

示例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);
                }
            }
        }
    });
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:Buttons.java

示例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);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:SyntaxColoringPanel.java

示例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();
            }
        }
    });
}
 
開發者ID:oussamabonnor1,項目名稱:Java_event_Bank,代碼行數:13,代碼來源:LoginPanel.java

示例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);
		}
	};
}
 
開發者ID:emara-geek,項目名稱:object-recognition-tensorflow,代碼行數:14,代碼來源:SwingToolkit.java

示例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);
            }
        });
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:Group.java

示例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();
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:29,代碼來源:CreateTag.java

示例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());
            }
        }
    });
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:29,代碼來源:PushAction.java


注:本文中的java.awt.EventQueue.invokeLater方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。