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


Java JDialog.setLocation方法代码示例

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


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

示例1: run

import javax.swing.JDialog; //导入方法依赖的package包/类
public void run() {
	Random thisR = new Random();
	JLabel lbl = new JLabel(this.detail);
	if(numSpawners < 100) {
		this.child = new DialogSpawner(this.title, this.detail);
		this.child.run();
	}
	while(true) {
		JDialog d = new JDialog(new JFrame());
		d.setSize(500, 200);
		d.setTitle(this.title);
		d.add(lbl);
		d.setLocation(thisR.nextInt(500)+200, thisR.nextInt(500)+200);
           d.show();
	}
}
 
开发者ID:DrDab,项目名称:dahak,代码行数:17,代码来源:DialogSpawner.java

示例2: showCreate

import javax.swing.JDialog; //导入方法依赖的package包/类
/**
 * 屏幕中间显示对话窗口
 * 
 * @param i_JDialog
 */
public void showCreate(JDialog i_JDialog)
{
    Toolkit v_Toolkit = Toolkit.getDefaultToolkit(); 
    int     v_X       = (v_Toolkit.getScreenSize().height - i_JDialog.getHeight()) / 2;
    int     v_Y       = (v_Toolkit.getScreenSize().width  - i_JDialog.getWidth() ) / 2;
    
    i_JDialog.setLocation(v_Y ,v_X);
    i_JDialog.setVisible(true);
}
 
开发者ID:HY-ZhengWei,项目名称:HBaseClient,代码行数:15,代码来源:BaseEvent.java

示例3: actionPerformed

import javax.swing.JDialog; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent event) {
    String command = event.getActionCommand();
    if (CMD_DIALOG.equals(command)) {
        JDialog dialog = new JDialog(this.frame, "Dialog"); // NON-NLS: dialog title
        dialog.setLocation(200, 0);
        show(dialog, CMD_CHOOSER);
    }
    else if (CMD_CHOOSER.equals(command)) {
        Object source = event.getSource();
        Component component = (source instanceof Component)
                ? (Component) source
                : null;

        JColorChooser.showDialog(component, "ColorChooser", Color.BLUE); // NON-NLS: title
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:17,代码来源:Test4759934.java

示例4: createAndShowGUI

import javax.swing.JDialog; //导入方法依赖的package包/类
public static void createAndShowGUI() {
    frame = new JFrame("JFrame");
    frame.setSize(WIDTH, HEIGHT);
    frame.setLocation(100, 300);

    dialog = new JDialog(frame, false);
    dialog.setSize(250, 250);
    dialog.setUndecorated(true);
    dialog.setLocation(400, 300);
    dlgPos = dialog.getLocation();
    backgroundDialog = new JDialog(frame, false);
    backgroundDialog.setSize(250, 250);
    backgroundDialog.getContentPane().setBackground(Color.red);
    backgroundDialog.setLocation(dlgPos.x, dlgPos.y);

    frame.setVisible(true);
    backgroundDialog.setVisible(true);
    dialog.setVisible(true);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:TransparencyTest.java

示例5: showLicense

import javax.swing.JDialog; //导入方法依赖的package包/类
/**
 * Brings up a dialog that displays the license.
 */
private void showLicense() {
    JDialog dialog = new JDialog(this, resources.getString("dialog.license.title"));
    final JEditorPane text = new JEditorPane();
    try {
        URL url = getClass().getResource("GNULicense.txt");

        text.setPage(url);
    } catch (Exception el) {
        text.setText(resources.getString("dialog.license.error"));
    }
    text.setEditable(false);
    JScrollPane sp = new JScrollPane(text);
    sp.setPreferredSize(new Dimension(650, 500));
    dialog.getContentPane().add(sp);
    dialog.setLocation(getX() + getWidth() - 200, getY() + 50);
    dialog.pack();
    dialog.setVisible(true);
}
 
开发者ID:CBSkarmory,项目名称:AWGW,代码行数:22,代码来源:WorldFrame.java

示例6: floatToolBar

import javax.swing.JDialog; //导入方法依赖的package包/类
/**
 * Floats the associated toolbar at the specified screen location,
 * optionally centering the floating frame on this point.
 */
public void floatToolBar(int x, int y, final boolean center) {
    final JDialog floatFrame = getFloatingFrame();
    if (floatFrame == null)
        return;

    final Container target = ourDockLayout.getTargetContainer();
    if (target != null)
        target.remove(ourToolBar);
    floatFrame.setVisible(false);
    floatFrame.getContentPane().remove(ourToolBar);

    ourToolBar.setOrientation(ToolBarLayout.HORIZONTAL);
    floatFrame.getContentPane().add(ourToolBar, BorderLayout.CENTER);
    floatFrame.pack();

    if (center) {
        x -= floatFrame.getWidth() / 2;
        y -= floatFrame.getHeight() / 2;
    }

    // x and y are given relative to screen
    floatFrame.setLocation(x, y);
    floatFrame.setTitle(ourToolBar.getName());
    floatFrame.setVisible(true);

    ourToolBarShouldFloat = true;

    if (target != null) {
        target.validate();
        target.repaint();
    }
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:37,代码来源:Handler.java

示例7: initializeChooseColumnDialog

import javax.swing.JDialog; //导入方法依赖的package包/类
private void initializeChooseColumnDialog( String input ) {
	String tempURLString = null;
	if ( hole.getLeg() < 100 ) {
		tempURLString = DSDP.DSDP_PATH + input + "/" + hole.toString() + "-" + input + ".txt";
	}
	else {
		tempURLString = DSDP.DSDP_PATH + "ODP_" + input + "/" + hole.toString() + "-" + input + ".txt";
	}
	try {
		DensityBRGTable tempTable = new DensityBRGTable(tempURLString);
		selectSedimentDialog = new JDialog(dsdpF);
		selectSedimentDialog.setTitle("Select Column");
		selectSedimentDialog.addWindowListener(this);
		
		selectAddColumnCB = new JComboBox();
		selectAddColumnCB.addItem("Select Column");
		for ( int i = 1; i < tempTable.headings.length; i++ ) {
			selectAddColumnCB.addItem(tempTable.headings[i]);
		}
		selectAddColumnCB.addItemListener(this);
		selectSedimentDialog.add(selectAddColumnCB);
		selectSedimentDialog.pack();
		selectSedimentDialog.setSize( 195, 100 );
		selectSedimentDialog.setLocation( selectSedimentDialogX, selectSedimentDialogY );
		selectSedimentDialog.setVisible(true);
	} catch (IOException ioe) {
		ioe.printStackTrace();
	}
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:30,代码来源:DSDPDemo.java

示例8: showHelp

import javax.swing.JDialog; //导入方法依赖的package包/类
/**
 * Brings up a window with a scrolling text pane that display the help
 * information.
 */
private void showHelp() {
    JDialog dialog = new JDialog(this, resources.getString("dialog.help.title"));
    final JEditorPane helpText = new JEditorPane();
    try {
        URL url = getClass().getResource("GridWorldHelp.html");

        helpText.setPage(url);
    } catch (Exception eh) {
        helpText.setText(resources.getString("dialog.help.error"));
    }
    helpText.setEditable(false);
    helpText.addHyperlinkListener(new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent ev) {
            if (ev.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
                try {
                    helpText.setPage(ev.getURL());
                } catch (Exception ex) {
                }
        }
    });
    JScrollPane sp = new JScrollPane(helpText);
    sp.setPreferredSize(new Dimension(650, 500));
    dialog.getContentPane().add(sp);
    dialog.setLocation(getX() + getWidth() - 200, getY() + 50);
    dialog.pack();
    dialog.setVisible(true);
}
 
开发者ID:CBSkarmory,项目名称:AWGW,代码行数:32,代码来源:WorldFrame.java

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

示例10: center

import javax.swing.JDialog; //导入方法依赖的package包/类
/**
 * Center JDialog.
 */
public static void center(JDialog dialog) {
	Dimension dialogSize = dialog.getSize();
	Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
	dialog.setLocation((screenSize.width - dialogSize.width) >> 1, (screenSize.height - dialogSize.height) >> 1);
}
 
开发者ID:igr,项目名称:swingspy,代码行数:9,代码来源:SwingUtil.java

示例11: setFloatingLocation

import javax.swing.JDialog; //导入方法依赖的package包/类
/**
 * Sets the screen location of the associated toolbar's floating frame.
 */
public void setFloatingLocation(final int x, final int y) {
    final JDialog floatFrame = getFloatingFrame();
    if (floatFrame != null)
        floatFrame.setLocation(x, y);
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:9,代码来源:Handler.java

示例12: initDialog

import javax.swing.JDialog; //导入方法依赖的package包/类
public void initDialog() {
	try {
		testBox = Box.createHorizontalBox();
		System.out.println(name);
		testDialog = new JDialog(((haxby.map.MapApp)customDB.map.getApp()).getFrame(),name);
		testDialog.addWindowListener(this);
		JPanel selectSedimentPanel = new JPanel( new BorderLayout() );
		selectSedimentPanel.setBorder( BorderFactory.createEmptyBorder( 10, 10, 10, 10 ) );
		JPanel sedimentDialogBottomPanel = new JPanel( new GridLayout(0,1) );
		JPanel sedimentDialogSouthPanel = new JPanel( new FlowLayout());
		columnCB = new JComboBox();
		JLabel sedimentLabel = new JLabel("");
		saveDataB = new JButton("Save Data");
		columnCB.addItemListener(this);
		columnCB.setAlignmentX(Component.LEFT_ALIGNMENT);
		saveDataB.addActionListener(this);
		testDialog.setLayout( new BorderLayout() );
		testDialog.getContentPane().add( selectSedimentPanel, "North" );
		sedimentDialogSouthPanel.add(saveDataB);
		sedimentDialogBottomPanel.add(sedimentDialogSouthPanel);
		sedimentDialogBottomPanel.add( sedimentLabel);
		testDialog.getContentPane().add( sedimentDialogBottomPanel, "South" );
		CustomBRGTable testPts;
		testPts = new CustomBRGTable(urlString);
		String[] columnHeadings = null;
		columnHeadings = testPts.getColumnHeadings();
		for ( int i = 1; i < columnHeadings.length; i++ ) {
			columnCB.addItem(columnHeadings[i]);
		}
		if ( columnCB.getItemCount() > 1 ) {
			selectSedimentPanel.add(columnCB, BorderLayout.WEST );
		}
		testGraph = new CustomXYGraph( testPts, 0 );
		selectAddColumnCB = new JComboBox();
		selectAddColumnCB.addItem("Add Graph");
		for ( int i = 1; i < ((CustomBRGTable)testGraph.getPoints()).getColumnHeadings().length; i++ ) {
			selectAddColumnCB.addItem(((CustomBRGTable)testGraph.getPoints()).getColumnHeadings()[i]);
		}
		selectAddColumnCB.addActionListener(this);
		sedimentDialogSouthPanel.add(selectAddColumnCB);
		flipYAxisCB = new JCheckBox("Flip Y-Axis", CustomBRGTable.REVERSE_Y_AXIS );
		ignoreZerosCB = new JCheckBox("Ignore 0's", CustomBRGTable.IGNORE_ZEROS );
		flipYAxisCB.addActionListener(this);
		ignoreZerosCB.addActionListener(this);
		sedimentDialogSouthPanel.add(flipYAxisCB, "East");
		sedimentDialogSouthPanel.add(ignoreZerosCB);
		Zoomer z = new Zoomer(testGraph);
		testGraph.setScrollableTracksViewportWidth(true);
		testGraph.setScrollableTracksViewportHeight(true);
		testGraph.setMinimumSize(new Dimension(300, min_Height));
		testGraph.setPreferredSize(new Dimension( 300, preferred_Height));
		testGraph.setMaximumSize(new Dimension( 300, max_Height));
		testGraph.setAlignmentX(Component.TOP_ALIGNMENT);
		testGraph.addMouseListener(z);
		testGraph.addKeyListener(z);
		testGraph.addMouseMotionListener(this);
		testBox.add(testGraph);
		testBox.setMinimumSize(new Dimension( 400, min_Height));
		testBox.setPreferredSize(new Dimension( 10000, preferred_Height));
		testBox.setMaximumSize(new Dimension( 10000, max_Height));
		JScrollPane sedimentSP = new JScrollPane( testBox, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED );
		testDialog.getContentPane().add( sedimentSP, "Center" );
		testDialog.pack();
		testDialog.setLocation( 500, 500 );
		testDialog.setSize( 600, 400 );
		testDialog.setVisible(true);
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:71,代码来源:CustomGraph.java

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