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


Java JDialog.setName方法代码示例

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


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

示例1: 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

示例2: 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


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