當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。