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


Java JDialog.setBounds方法代码示例

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


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

示例1: showConfigurationDialog

import javax.swing.JDialog; //导入方法依赖的package包/类
private void showConfigurationDialog(ITopologyGenerator generator) {
	JDialog dialog = new JDialog();
	dialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
	dialog.setLayout(new BorderLayout());
	dialog.setTitle(generator.getName());
	dialog.add(generator.getConfigurationDialog(), BorderLayout.CENTER);

	Rectangle tbounds = this.getBounds();
	Rectangle bounds = new Rectangle();
	bounds.setSize(generator.getConfigurationDialog().getPreferredSize());
	bounds.x = (int) (tbounds.x + 0.5 * tbounds.width - 0.5 * bounds.width);
	bounds.y = (int) (tbounds.y + 0.5 * tbounds.height - 0.5 * bounds.height);
	dialog.setBounds(bounds);
	dialog.setResizable(false);

	dialog.setVisible(true);
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:18,代码来源:MultiAlgoScenarioWizard.java

示例2: actionPerformed

import javax.swing.JDialog; //导入方法依赖的package包/类
/**
 * Handles events from the editor button and from
 * the dialog's OK button.
 */
public void actionPerformed(ActionEvent e) {
	if (EDIT.equals(e.getActionCommand())) {
		//The user has clicked the cell, so
		//bring up the dialog.
		button.setBackground(currentColor);
		colorChooser.setColor(currentColor);
		JDialog dialog = JColorChooser.createDialog(button, "Choose User Class Color", true, //modal
				colorChooser, this, //OK button handler
				null); //no CANCEL button handler
		Dimension scrDim = Toolkit.getDefaultToolkit().getScreenSize();
		dialog.setBounds((scrDim.width - dialog.getWidth()) / 2, (scrDim.height - dialog.getHeight()) / 2, dialog.getWidth(), dialog.getHeight());
		dialog.setVisible(true);

		//Make the renderer reappear.
		fireEditingStopped();

	} else { //User pressed dialog's "OK" button.
		currentColor = colorChooser.getColor();
	}
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:25,代码来源:ColorCellEditor.java

示例3: showDialog

import javax.swing.JDialog; //导入方法依赖的package包/类
private static void showDialog(JFrame parent) throws Exception {
    jd = new JDialog(parent);
    jtf = new JTextField("What a day I'm having!");
    jd.getContentPane().setLayout(new BorderLayout());
    jd.getContentPane().add(jtf, BorderLayout.CENTER);
    jd.setBounds(400,400,100, 50);
    new WaitWindow(jd);
    sleep();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:ExtTestCase.java

示例4: mouseClicked

import javax.swing.JDialog; //导入方法依赖的package包/类
@Override
public State mouseClicked(Widget widget, WidgetMouseEvent event) {
    if (event.getButton() == MouseEvent.BUTTON1) {
        JDialog dialog = new JDialog((Frame) null, "Mouse Clicked " + event.getClickCount());
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        dialog.setBounds((screenSize.width - WIDTH) / 2, (screenSize.height - HEIGHT) / 2, WIDTH, HEIGHT);
        dialog.setVisible(true);
        return State.CONSUMED;
    }
    return State.REJECTED;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:Utils.java

示例5: actionPerformed

import javax.swing.JDialog; //导入方法依赖的package包/类
public void actionPerformed( final ActionEvent e ) {
    String command = e.getActionCommand();

    if ( COMMAND_OK.equals( command ) ) {
        // Call the OK option listener
        ProjectManager.mutex().writeAccess(new Mutex.Action<Object>() {
            public Object run() {
                okOptionListener.actionPerformed( e ); // XXX maybe create new event
                actionPerformed(e, categories);
                return null;
            }
        });
        
        final ProgressHandle handle = ProgressHandleFactory.createHandle(NbBundle.getMessage(CustomizerDialog.class, "LBL_Saving_Project_data_progress"));
        JComponent component = ProgressHandleFactory.createProgressComponent(handle);
        Frame mainWindow = WindowManager.getDefault().getMainWindow();
        final JDialog dialog = new JDialog(mainWindow, 
                NbBundle.getMessage(CustomizerDialog.class, "LBL_Saving_Project_data"), true);
        SavingProjectDataPanel panel = new SavingProjectDataPanel(component);
        
        dialog.getContentPane().add(panel);
        dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
        dialog.pack();
        
        Rectangle bounds = mainWindow.getBounds();
        int middleX = bounds.x + bounds.width / 2;
        int middleY = bounds.y + bounds.height / 2;
        Dimension size = dialog.getPreferredSize();
        dialog.setBounds(middleX - size.width / 2, middleY - size.height / 2, size.width, size.height);
        
        // Call storeListeners out of AWT EQ
        RequestProcessor.getDefault().post(new Runnable() {
            @Override
            public void run() {
                try {
                    ProjectManager.mutex().writeAccess(new Mutex.Action<Object>() {
                        @Override
                        public Object run() {
                            FileUtil.runAtomicAction(new Runnable() {
                                @Override
                                public void run() {
                            handle.start();
                            if (storeListener != null) {
                                storeListener.actionPerformed(e);
                            }
                            storePerformed(e, categories);
                            // #97998 related
                            saveModifiedProject();
                                }
                            });
                            return null;
                        }
                    });
                } finally {
                    SwingUtilities.invokeLater(new Runnable() {
                        @Override
                        public void run() {
                            dialog.setVisible(false);
                            dialog.dispose();
                        }
                    });
                }
            }
        });
        
        dialog.setVisible(true);
        
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:70,代码来源:CustomizerDialog.java

示例6: testMemLeakPluginManagerUI

import javax.swing.JDialog; //导入方法依赖的package包/类
public void testMemLeakPluginManagerUI () throws Exception {
    help = this;
    
    close = new JButton ();
    SwingUtilities.invokeAndWait (new Runnable () {
        public void run () {
            ui = new PluginManagerUI (close);
        }
    });
    
    assertNotNull (ui);
    ref = new WeakReference<PluginManagerUI> (ui);
    assertNotNull (ref.get ());
    
    dlg = new JDialog (new JFrame ());
    dlg.setBounds (100, 100, 800, 500);
    dlg.add (ui);

    SwingUtilities.invokeAndWait (new Runnable () {
        public void run () {
            dlg.setVisible (true);
        }
    });
    ui.initTask.waitFinished ();
    Thread.sleep (1000);
    SwingUtilities.invokeAndWait (new Runnable () {
        public void run () {
            dlg.setVisible (false);
            dlg.getContentPane ().removeAll ();
            dlg.dispose ();
        }
    });
    Thread.sleep (10500);
    //dlg = null;
    close = null;

    ui = null;
    assertNull (ui);
    
    ToolTipManager.sharedInstance ().mousePressed (null);
    // sun.management.ManagementFactoryHelper.getDiagnosticMXBean().dumpHeap("/tmp/heapdump2.out", true);
    assertGC ("Reference to PluginManagerUI is empty.", ref);

    assertNotNull (ref);
    assertNull (ref.get ());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:47,代码来源:PluginManagerActionTest.java


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