当前位置: 首页>>代码示例>>Java>>正文


Java JDialog.setModal方法代码示例

本文整理汇总了Java中javax.swing.JDialog.setModal方法的典型用法代码示例。如果您正苦于以下问题:Java JDialog.setModal方法的具体用法?Java JDialog.setModal怎么用?Java JDialog.setModal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JDialog的用法示例。


在下文中一共展示了JDialog.setModal方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

import javax.swing.JDialog; //导入方法依赖的package包/类
public static void run(String className, String testName, String fileName) throws Exception {
    final File golden = new File("/space/nm/java/editor/test/unit/data/goldenfiles/org/netbeans/modules/java/editor/semantic/" + className + "/" + testName + ".pass");
    final File test   = new File("/tmp/tests/org.netbeans.modules.java.editor.semantic." + className + "/" + testName + "/" + testName + ".out");
    final File source = new File("/tmp/tests/org.netbeans.modules.java.editor.semantic." + className + "/" + testName + "/test/" + fileName + ".java");
    
    final StyledDocument doc = loadDocument(source);
    final List<HighlightImpl> goldenHighlights = parse(doc, golden);
    final List<HighlightImpl> testHighlights = parse(doc, test);

    Runnable show = new Runnable() {
        public void run() {
            JDialog d = new JDialog();
            
            d.setModal(true);
            
            ShowGoldenFilesPanel panel = new ShowGoldenFilesPanel(d);
            
            panel.setDocument(doc, goldenHighlights, testHighlights, golden, test);
            
            d.getContentPane().add(panel);
            
            d.show();
        }
    };

    if (SwingUtilities.isEventDispatchThread()) {
        show.run();
    } else {
        SwingUtilities.invokeAndWait(show);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:ShowGoldenFiles.java

示例2: main

import javax.swing.JDialog; //导入方法依赖的package包/类
public static void main(String[] args) {
  final String loremIpsum = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";

  final JDialog d = new JDialog();
  d.setTitle("Flow Label Test");
  d.setModal(true);
  d.setResizable(true);
  d.setLocationRelativeTo(null);
  d.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
  d.add(new FlowLabel(loremIpsum + "\n\n" + loremIpsum));
  d.pack();
  d.setVisible(true);
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:14,代码来源:FlowLabel.java

示例3: show

import javax.swing.JDialog; //导入方法依赖的package包/类
/** Shows a given graph in an optionally modal dialog. */
private void show(final Graph graph, GrammarModel grammar, boolean modal) {
    GraphPreviewPanel panel = GraphPreviewDialog.createPanel(grammar, graph);
    panel.add(new NodeIdsButton(panel), BorderLayout.NORTH);
    JOptionPane optionPane = new JOptionPane(panel, JOptionPane.PLAIN_MESSAGE);
    JDialog dialog = optionPane.createDialog(graph.getName());
    dialog.setModal(modal);
    dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    dialog.setVisible(true);
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:11,代码来源:Viewer.java

示例4: showHelp

import javax.swing.JDialog; //导入方法依赖的package包/类
private void showHelp()
{
	JDialog dialog = ComponentHelper.createJDialog(comp);
	dialog.getContentPane().add(new HelpPanel(dialog, help));
	dialog.setTitle(CurrentLocale.get("com.tle.admin.plugin.helplistener.title", title)); //$NON-NLS-1$

	dialog.setSize(new Dimension(600, 400));
	ComponentHelper.centreOnScreen(dialog);

	dialog.setModal(true);
	dialog.setVisible(true);
}
 
开发者ID:equella,项目名称:Equella,代码行数:13,代码来源:HelpListener.java

示例5: main

import javax.swing.JDialog; //导入方法依赖的package包/类
public static void main(String args[])
{
	JDialog d = new JDialog();
	d.setSize(300, 300);
	d.setModal(true);

	JLinkButton a = new JLinkButton("Hello", new ImageIcon("c:\\image.gif"));
	JLinkButton b = new JLinkButton("Disabled");
	b.setEnabled(false);

	d.getContentPane().add(a);

	d.setVisible(true);
	System.exit(0);
}
 
开发者ID:equella,项目名称:Equella,代码行数:16,代码来源:JLinkButton.java

示例6: testDiffView

import javax.swing.JDialog; //导入方法依赖的package包/类
public void testDiffView () throws Throwable {
    // create a file and initial commit
    File file = new File(wc, "file.txt");
    file.createNewFile();

    // chain of change & commit
    StringBuilder content = new StringBuilder();
    for (int i = 1; i < 10; ++i) {
        for (int j = 1; j < 20; ++j) {
            content.append("File change number ").append(i).append("_").append(j).append("\n");
        }
        TestKit.write(file, content.toString());
        System.out.println("Commit nbr. " + i);
        TestKit.commit(wc);
    }

    // local changes
    // changes every few lines
    int pos = content.indexOf("\n");
    while (pos != -1) {
        int nextPos = content.indexOf("\n", pos + 30);
        if (nextPos == -1) {
            pos = -1;
        } else {
            String replaceString = "Local change \nLocal change \nLocal change \n";
            content.replace(pos + 1, nextPos, replaceString);
            pos = nextPos + nextPos - pos + replaceString.length();
            // every 5 next lines
            for (int i = 0; i < 5 && pos != -1; ++i) {
                pos = content.indexOf("\n", pos + 1);
            }
        }
    }
    TestKit.write(file, content.toString());

    boolean showing = SvnSearchHistorySupport.getInstance(file).searchHistory(100);
    assertTrue(showing);

    JDialog d = new JDialog((JFrame)null, "Close dialog");
    d.setModal(false);
    d.setVisible(true);
    while (d.isVisible()) {
        Thread.sleep(1000);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:46,代码来源:SearchHistoryTest.java

示例7: testDiffView

import javax.swing.JDialog; //导入方法依赖的package包/类
public void testDiffView () throws Throwable {
    // create a file and initial commit
    File file = new File(getWorkTreeDir(), "file.txt");
    file.createNewFile();

    // chain of change & commit
    StringBuilder content = new StringBuilder();
    for (int i = 1; i < 10; ++i) {
        for (int j = 1; j < 20; ++j) {
            content.append("File change number ").append(i).append("_").append(j).append("\n");
        }
        write(file, content.toString());
        System.out.println("Commit nbr. " + i);
        commit(wc);
    }

    // local changes
    // changes every few lines
    int pos = content.indexOf("\n");
    while (pos != -1) {
        int nextPos = content.indexOf("\n", pos + 30);
        if (nextPos == -1) {
            pos = -1;
        } else {
            String replaceString = "Local change \nLocal change \nLocal change \n";
            content.replace(pos + 1, nextPos, replaceString);
            pos = nextPos + nextPos - pos + replaceString.length();
            // every 5 next lines
            for (int i = 0; i < 5 && pos != -1; ++i) {
                pos = content.indexOf("\n", pos + 1);
            }
        }
    }
    write(file, content.toString());

    boolean showing = HgSearchHistorySupport.getInstance(file).searchHistory(100);
    assertTrue(showing);

    JDialog d = new JDialog((JFrame)null, "Close dialog");
    d.setModal(false);
    d.setVisible(true);
    while (d.isVisible()) {
        Thread.sleep(1000);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:46,代码来源:SearchHistoryTestCase.java

示例8: setEnlargedView

import javax.swing.JDialog; //导入方法依赖的package包/类
/**
 * This method shows the enlarged dialog for the current ontology class instances
 * in order to provide an easier access for the end user.
 */
private void setEnlargedView() {
	
	JDialog dialog = new JDialog(OntologyVisualisationConfiguration.getOwnerWindow());
	dialog.setPreferredSize(new Dimension(100, 200));
	dialog.setName("Ontology-Instance-Viewer");
	dialog.setTitle(OntologyVisualisationConfiguration.getApplicationTitle() +  ": Ontology-Instance-Viewer");
	dialog.setModal(true);
	dialog.setResizable(true);
	dialog.setContentPane(getJContentPane());
	
	// --- Size and center the dialog -----------------
	Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
	int diaWidth = (int) (screenSize.width*0.8);
	int diaHeight = (int) (screenSize.height * 0.9);

	int left = (screenSize.width - diaWidth) / 2;
	int top = (screenSize.height - diaHeight) / 2; 

	dialog.setSize(new Dimension(diaWidth, diaHeight));
    dialog.setLocation(left, top);	
	
    // --- Remind and remove THIS from the parent -----
    this.getDynTableJPanel().setOntologyClassVisualsationVisible(null);
    Container parentContainer = this.getParent();
    parentContainer.remove(this);
    parentContainer.validate();
    parentContainer.repaint();
    
    // --- Add THIS to the dialog ---------------------
    this.removeEnlargeTab();
    jPanel4TouchDown.add(this, BorderLayout.CENTER);
    dialog.setVisible(true);
	// - - - - - - - - - - - - - - - - - - - - - - - -  
    // - - User-Interaction  - - - - - - - - - - - - - 
	// - - - - - - - - - - - - - - - - - - - - - - - -
    this.addEnlargeTab();
	
    // --- Add THIS again to the parent ---------------
    this.getDynTableJPanel().setOntologyClassVisualsationVisible(null);
    parentContainer.add(this);
    parentContainer.validate();
    parentContainer.repaint();
    
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:49,代码来源:OntologyInstanceViewer.java

示例9: initSpyDialog

import javax.swing.JDialog; //导入方法依赖的package包/类
/**
 * Initializes Spy dialog.
 */
protected void initSpyDialog(Component rootComponent, Component component) {
	if (rootComponent instanceof Dialog) {
		spyDialog = new CaddyDialog((Dialog) rootComponent) {
			@Override
			protected JRootPane createRootPane() {
				return createSpyRootPane();
			}
		};
	} else if (rootComponent instanceof Frame) {
		spyDialog = new CaddyDialog((Frame) rootComponent) {
			@Override
			protected JRootPane createRootPane() {
				return createSpyRootPane();
			}
		};
	} else {
		spyDialog = new JDialog() {
			@Override
			protected JRootPane createRootPane() {
				return createSpyRootPane();
			}
		};
	}
	spyDialog.setName("SwingSpy");
	spyDialog.setTitle("SwingSpy");
	spyDialog.setModal(false);
	spyDialog.setAlwaysOnTop(true);
	Container contentPane = spyDialog.getContentPane();
	contentPane.setLayout(new BorderLayout());
	spyPanel = new SwingSpyPanel();
	spyPanel.reload(rootComponent, component);
	contentPane.add(spyPanel);
	spyDialog.pack();

	spyDialog.addWindowListener(new WindowAdapter() {
		@Override
		public void windowClosing(WindowEvent e) {
			super.windowClosed(e);
			spyGlass.setVisible(false);
			spyDialog = null;
		}
	});
	spyDialog.setLocationRelativeTo(null);
	spyDialog.setVisible(true);
}
 
开发者ID:igr,项目名称:swingspy,代码行数:49,代码来源:SwingSpy.java

示例10: exportToKML

import javax.swing.JDialog; //导入方法依赖的package包/类
public static void exportToKML(UnknownDataSet ds, DataSelector select) {
	KMLExportConfigDialog fc = null;
	HeaderConfig hc = null;

	// Set up the headers and fields
	do {
		if (hc == null)
			hc = new HeaderConfig((JFrame)ds.map.getTopLevelAncestor(),ds);
		else
			hc.setVisible(true);
		if (hc.visibleV == null) {
			hc.dispose();
			return;
		}

		int imgI = guessImage(ds, hc.visibleV, select);
		fc = new KMLExportConfigDialog((JFrame) ds.map.getTopLevelAncestor(), 
				ds.desc.name.replace(":", ""), hc.visibleV, imgI);
	} while (!fc.export);
	hc.dispose();

	// Get the save file
	JFileChooser jfc = new JFileChooser(System.getProperty("user.home"));
	File f = new File(ds.desc.name.split("\\s")[0] + ".kmz");
	jfc.setSelectedFile(f);

	do {
		int c = jfc.showSaveDialog(null);
		if (c==JFileChooser.CANCEL_OPTION||c==JFileChooser.ERROR_OPTION) return;
		f = jfc.getSelectedFile();
		if (f.exists()) {
			c=JOptionPane.showConfirmDialog(null, "File Already Exists\nConfirm Overwrite");
			if (c==JOptionPane.OK_OPTION) break;
			// if (c==JOptionPane.CANCEL_OPTION) return;
		}
	} while (f.exists());

	int n = 1 + fc.getScales().size();
	n *= select.getRowCount();

	JDialog dialog = new JDialog((JFrame) ds.map.getTopLevelAncestor());
	dialog.setTitle("Exporting to KMZ");
	dialog.setModal(true);
	JProgressBar pb = new JProgressBar(0,n);
	JPanel p = new JPanel();
	p.add(new JLabel("Saving " + f.getName()));
	p.add(pb);

	dialog.getContentPane().setLayout(new FlowLayout());
	dialog.getContentPane().add(p);
	dialog.pack();
	dialog.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
	dialog.setLocation(dialog.getOwner().getX() + dialog.getOwner().getWidth() / 2 - dialog.getWidth()/2, 
			dialog.getOwner().getY() + dialog.getOwner().getHeight() / 2 - dialog.getHeight()/2);

	new Task(new Object[] {ds,select,f,fc,hc,pb,dialog}) {
		public void run() {
			exportToKML((UnknownDataSet)args[0],
					(DataSelector)args[1],
					(File)args[2],
					(KMLExportConfigDialog)args[3],
					(HeaderConfig)args[4],
					(JProgressBar)args[5]);
			((JDialog) args[6]).dispose();
		}
	}.start();
	dialog.setVisible(true);
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:69,代码来源:KMLExport.java


注:本文中的javax.swing.JDialog.setModal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。