本文整理了Java中javax.swing.JDesktopPane.getAllFramesInLayer()
方法的一些代码示例,展示了JDesktopPane.getAllFramesInLayer()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JDesktopPane.getAllFramesInLayer()
方法的具体详情如下:
包路径:javax.swing.JDesktopPane
类名称:JDesktopPane
方法名:getAllFramesInLayer
暂无
代码示例来源:origin: magefree/mage
public void btnAboutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAboutActionPerformed
JInternalFrame[] windows = desktopPane.getAllFramesInLayer(JLayeredPane.MODAL_LAYER);
for (JInternalFrame window : windows) {
if (window instanceof AboutDialog) {
// don't open the window twice.
return;
}
}
AboutDialog aboutDialog = new AboutDialog();
desktopPane.add(aboutDialog, JLayeredPane.MODAL_LAYER);
aboutDialog.showDialog(VERSION);
}//GEN-LAST:event_btnAboutActionPerformed
代码示例来源:origin: magefree/mage
try {
JDesktopPane desktopPane = (JDesktopPane) MageFrame.getUI().getComponent(MageComponents.DESKTOP_PANE);
JInternalFrame[] windows = desktopPane.getAllFramesInLayer(javax.swing.JLayeredPane.DEFAULT_LAYER);
for (JInternalFrame frame : windows) {
if (frame.getTitle().equals("Waiting for players")) {
代码示例来源:origin: cmu-phil/tetrad
/**
* @return true iff there exist a session in the desktop.
*/
private boolean existsSession() {
JInternalFrame[] allFrames = desktopPane.getAllFramesInLayer(0);
for (JInternalFrame allFrame : allFrames) {
Object o = allFrame.getContentPane().getComponents()[0];
if (o instanceof SessionEditor) {
return true;
}
}
return false;
}
代码示例来源:origin: cmu-phil/tetrad
public SessionEditor getFrontmostSessionEditor() {
JInternalFrame[] allFrames = desktopPane.getAllFramesInLayer(0);
if (allFrames.length == 0) {
return null;
}
JInternalFrame frontmostFrame = allFrames[0];
Object o = frontmostFrame.getContentPane().getComponents()[0];
boolean isSessionEditor = o instanceof SessionEditor;
return isSessionEditor ? (SessionEditor) o : null;
}
代码示例来源:origin: cmu-phil/tetrad
public boolean existsSessionByName(String name) {
JInternalFrame[] allFrames = desktopPane.getAllFramesInLayer(0);
for (JInternalFrame allFrame : allFrames) {
Object o = allFrame.getContentPane().getComponents()[0];
if (o instanceof SessionEditor) {
SessionEditor editor = (SessionEditor) o;
String editorName = editor.getName();
if (editorName.equals(name)) {
return true;
}
}
}
return false;
}
代码示例来源:origin: cmu-phil/tetrad
public void closeFrontmostSession() {
for (JInternalFrame frame : desktopPane.getAllFrames()) {
if (frame instanceof EditorWindow) {
((EditorWindow) frame).closeDialog();
}
}
JInternalFrame[] frames = desktopPane.getAllFramesInLayer(0);
if (frames.length > 0) {
frames[0].dispose();
Map<SessionEditor, JInternalFrame> framesMap = this.framesMap;
for (Iterator<SessionEditor> i = framesMap.keySet().iterator(); i
.hasNext();) {
SessionEditor sessionEditor = i.next();
JInternalFrame frame = framesMap.get(sessionEditor);
if (frame == frames[0]) {
i.remove();
break;
}
}
}
}
代码示例来源:origin: cmu-phil/tetrad
public void closeSessionByName(String name) {
for (JInternalFrame frame : desktopPane.getAllFrames()) {
if (frame instanceof EditorWindow) {
((EditorWindow) frame).closeDialog();
}
}
JInternalFrame[] frames = desktopPane.getAllFramesInLayer(0);
if (frames.length > 0) {
Map<SessionEditor, JInternalFrame> framesMap = this.framesMap;
for (Iterator<SessionEditor> i = framesMap.keySet().iterator(); i
.hasNext();) {
SessionEditor sessionEditor = i.next();
if (sessionEditor.getName().equals(name)) {
// JInternalFrame frame = framesMap.get(sessionEditor);
i.remove();
}
}
}
}
代码示例来源:origin: cmu-phil/tetrad
itemsToFrames.clear();
JInternalFrame[] layer0Frames = desktop.getDesktopPane().getAllFramesInLayer(0);
List<String> titles = new ArrayList<>();
Map<String, JInternalFrame> titlesToFrames = new HashMap<>();
代码示例来源:origin: cmu-phil/tetrad
@Override
public Session getSessionByName(String name) {
JInternalFrame[] allFrames = desktopPane.getAllFramesInLayer(0);
for (JInternalFrame allFrame : allFrames) {
Object o = allFrame.getContentPane().getComponents()[0];
if (o instanceof SessionEditor) {
SessionEditor editor = (SessionEditor) o;
String editorName = editor.getName();
if (editorName.equals(name)) {
return editor.getSessionWorkbench().getSessionWrapper()
.getSession();
}
}
}
return null;
}
代码示例来源:origin: cmu-phil/tetrad
public void closeEmptySessions() {
JInternalFrame[] frames = desktopPane.getAllFramesInLayer(0);
for (JInternalFrame frame : frames) {
Object o = frame.getContentPane().getComponents()[0];
if (o instanceof SessionEditor) {
SessionEditor sessionEditor = (SessionEditor) o;
SessionEditorWorkbench workbench = sessionEditor
.getSessionWorkbench();
Graph graph = workbench.getGraph();
if (graph.getNumNodes() == 0) {
frame.dispose();
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!