当前位置: 首页>>代码示例>>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;未经允许,请勿转载。