當前位置: 首頁>>代碼示例>>Java>>正文


Java JDialog.dispose方法代碼示例

本文整理匯總了Java中javax.swing.JDialog.dispose方法的典型用法代碼示例。如果您正苦於以下問題:Java JDialog.dispose方法的具體用法?Java JDialog.dispose怎麽用?Java JDialog.dispose使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JDialog的用法示例。


在下文中一共展示了JDialog.dispose方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: show

import javax.swing.JDialog; //導入方法依賴的package包/類
/** Helper method for constructing an always-on-top modal dialog. */
private static Object show(String title, int type, Object message, Object[] options, Object initialOption) {
	if (options == null) {
		options = new Object[] {
				"Ok"
		};
		initialOption = "Ok";
	}
	JOptionPane p = new JOptionPane(message, type, JOptionPane.DEFAULT_OPTION, null, options, initialOption);
	p.setInitialValue(initialOption);
	JDialog d = p.createDialog(null, title);
	p.selectInitialValue();
	d.setAlwaysOnTop(true);
	d.setVisible(true);
	d.dispose();
	return p.getValue();
}
 
開發者ID:AlloyTools,項目名稱:org.alloytools.alloy,代碼行數:18,代碼來源:OurDialog.java

示例2: actionPerformed

import javax.swing.JDialog; //導入方法依賴的package包/類
final public void actionPerformed(ActionEvent objPactionEvent) {
	final Object objLsourceObject = objPactionEvent.getSource();

	if (objLsourceObject == this.objGpropertiesJButton) {
		if (this.objGserviceUIFactory != null) {
			final JDialog objLjDialog = (JDialog) this.objGserviceUIFactory.getUI(ServiceUIFactory.MAIN_UIROLE, ServiceUIFactory.JDIALOG_UI);

			if (objLjDialog != null) {
				objLjDialog.setVisible(true);
				objLjDialog.dispose();
			} else {
				this.objGpropertiesJButton.setEnabled(false);
			}
		}
	}
}
 
開發者ID:jugglemaster,項目名稱:JuggleMasterPro,代碼行數:17,代碼來源:PrintServiceSubJPanel.java

示例3: showDialog

import javax.swing.JDialog; //導入方法依賴的package包/類
/**
 *  Show font selection dialog.
 *  @param parent Dialog's Parent component.
 *  @return OK_OPTION, CANCEL_OPTION or ERROR_OPTION
 *
 *  @see #OK_OPTION 
 *  @see #CANCEL_OPTION
 *  @see #ERROR_OPTION
 **/
public int showDialog(Component parent) {
    dialogResultValue = ERROR_OPTION;
    JDialog dialog = createDialog(parent);
    dialog.addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            dialogResultValue = CANCEL_OPTION;
        }
    });

    dialog.setVisible(true);
    dialog.dispose();
    dialog = null;

    return dialogResultValue;
}
 
開發者ID:takun2s,項目名稱:smile_1.5.0_java7,代碼行數:27,代碼來源:FontChooser.java

示例4: showDialog

import javax.swing.JDialog; //導入方法依賴的package包/類
/**
 * Show font selection dialog.
 * 
 * @param parent
 *            Dialog's Parent component.
 * @return OK_OPTION, CANCEL_OPTION or ERROR_OPTION
 *
 * @see #OK_OPTION
 * @see #CANCEL_OPTION
 * @see #ERROR_OPTION
 **/
public int showDialog(Component parent) {
	dialogResultValue = ERROR_OPTION;
	JDialog dialog = createDialog(parent);
	dialog.addWindowListener(new WindowAdapter() {
		public void windowClosing(WindowEvent e) {
			dialogResultValue = CANCEL_OPTION;
		}
	});

	dialog.setVisible(true);
	dialog.dispose();
	dialog = null;

	return dialogResultValue;
}
 
開發者ID:KevinPriv,項目名稱:Luyten4Forge,代碼行數:27,代碼來源:JFontChooser.java

示例5: main

import javax.swing.JDialog; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
    JColorChooser chooser = new JColorChooser();
    AbstractColorChooserPanel[] panels = chooser.getChooserPanels();
    chooser.setChooserPanels(new AbstractColorChooserPanel[] { panels[1] });

    JDialog dialog = show(chooser);
    pause(DELAY);

    dialog.dispose();
    pause(DELAY);

    Test4177735 test = new Test4177735();
    SwingUtilities.invokeAndWait(test);
    if (test.count != 0) {
        throw new Error("JColorChooser leaves " + test.count + " threads running");
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:18,代碼來源:Test4177735.java

示例6: showDialog

import javax.swing.JDialog; //導入方法依賴的package包/類
/**
 *  Show font selection dialog.
 *  @param parent Dialog's Parent component.
 *  @return OK_OPTION, CANCEL_OPTION or ERROR_OPTION
 *
 *  @see #OK_OPTION 
 *  @see #CANCEL_OPTION
 *  @see #ERROR_OPTION
 **/
public int showDialog(Component parent)
{
    dialogResultValue = ERROR_OPTION;
    JDialog dialog = createDialog(parent);
    dialog.addWindowListener(new WindowAdapter()
    {
        public void windowClosing(WindowEvent e)
        {
            dialogResultValue = CANCEL_OPTION;
        }
    });

    dialog.setVisible(true);
    dialog.dispose();
    dialog = null;

    return dialogResultValue;
}
 
開發者ID:chcandido,項目名稱:brModelo,代碼行數:28,代碼來源:JFontChooser.java

示例7: onClick

import javax.swing.JDialog; //導入方法依賴的package包/類
@Override
public void onClick(ActionEvent arg0)
{
    JDialog v_JDialog = this.getDialog();
    
    v_JDialog.setVisible(false);
    v_JDialog.dispose();
}
 
開發者ID:HY-ZhengWei,項目名稱:HBaseClient,代碼行數:9,代碼來源:CloseDialogAction.java

示例8: showmsg

import javax.swing.JDialog; //導入方法依賴的package包/類
/**
 * Popup the given informative message, then ask the user to click Close to
 * close it.
 */
public static void showmsg(String title, Object... msg) {
	JButton dismiss = new JButton(Util.onMac() ? "Dismiss" : "Close");
	Object[] objs = new Object[msg.length + 1];
	System.arraycopy(msg, 0, objs, 0, msg.length);
	objs[objs.length - 1] = OurUtil.makeH(null, dismiss, null);
	JOptionPane about = new JOptionPane(objs, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null,
			new Object[] {});
	JDialog dialog = about.createDialog(null, title);
	dismiss.addActionListener(Runner.createDispose(dialog));
	dialog.setAlwaysOnTop(true);
	dialog.setVisible(true);
	dialog.dispose();
}
 
開發者ID:AlloyTools,項目名稱:org.alloytools.alloy,代碼行數:18,代碼來源:OurDialog.java

示例9: ask

import javax.swing.JDialog; //導入方法依賴的package包/類
/** 
 * Shows the dialog, and returns {@code true} if the user chose to continue.
 * Afterwards, {@link #getBound()} shows the next bound to which to explore.
 */
public boolean ask(Frame owner) {
    getMessageLabel().setText(String.format("Exploration has generated %s states", getBound()));
    getBoundSpinnerModel().setMinimum(getBound() + 1);
    getBoundSpinnerModel().setValue(getBound() * 2);
    JDialog dialog = createDialog(owner);
    dialog.setVisible(true);
    dialog.dispose();
    return this.answer;
}
 
開發者ID:meteoorkip,項目名稱:JavaGraph,代碼行數:14,代碼來源:ExploreWarningDialog.java

示例10: showDialog

import javax.swing.JDialog; //導入方法依賴的package包/類
/**
 * Makes the dialog visible and awaits the user's response. Since the dialog
 * is modal, this method returns only when the user closes the dialog. The
 * return value indicates if the properties have changed.
 * @param frame the frame on which the dialog is to be displayed
 * @return <code>true</code> if the properties have changed during the
 *         time the dialog was visible.
 */
public boolean showDialog(Component frame) {
    boolean result;
    boolean stopDialog;
    do {
        getContentPane().setValue(null);
        getContentPane().setVisible(true);
        JDialog dialog = getContentPane().createDialog(frame, createTitle());
        dialog.setResizable(true);
        dialog.setVisible(true);
        dialog.dispose();
        Object selectedValue = getContentPane().getValue();
        if (this.table.isChanged()) {
            if (selectedValue == getOkButton()) {
                result = stopDialog = true;
            } else {
                int abandon = showAbandonDialog();
                result = abandon == JOptionPane.YES_OPTION;
                stopDialog = abandon != JOptionPane.CANCEL_OPTION;
            }
        } else {
            // nothing was changed during editing
            result = false;
            stopDialog = true;
        }
    } while (!stopDialog);
    return result;
}
 
開發者ID:meteoorkip,項目名稱:JavaGraph,代碼行數:36,代碼來源:PropertiesDialog.java

示例11: show

import javax.swing.JDialog; //導入方法依賴的package包/類
/** Helper method for constructing an always-on-top modal dialog. */
private static Object show(String title, int type, Object message, Object[] options, Object initialOption) {
   if (options == null) { options = new Object[]{"Ok"};  initialOption = "Ok"; }
   JOptionPane p = new JOptionPane(message, type, JOptionPane.DEFAULT_OPTION, null, options, initialOption);
   p.setInitialValue(initialOption);
   JDialog d = p.createDialog(null, title);
   p.selectInitialValue();
   d.setAlwaysOnTop(true);
   d.setVisible(true);
   d.dispose();
   return p.getValue();
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:13,代碼來源:OurDialog.java

示例12: showmsg

import javax.swing.JDialog; //導入方法依賴的package包/類
/** Popup the given informative message, then ask the user to click Close to close it. */
public static void showmsg(String title, Object... msg) {
   JButton dismiss = new JButton(Util.onMac() ? "Dismiss" : "Close");
   Object[] objs = new Object[msg.length + 1];
   System.arraycopy(msg, 0, objs, 0, msg.length);
   objs[objs.length - 1] = OurUtil.makeH(null, dismiss, null);
   JOptionPane about = new JOptionPane(objs, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new Object[]{});
   JDialog dialog = about.createDialog(null, title);
   dismiss.addActionListener(Runner.createDispose(dialog));
   dialog.setAlwaysOnTop(true);
   dialog.setVisible(true);
   dialog.dispose();
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:14,代碼來源:OurDialog.java

示例13: main

import javax.swing.JDialog; //導入方法依賴的package包/類
public static void main(String[] args) {
    JColorChooser chooser = new JColorChooser(COLOR);
    JDialog dialog = Test4177735.show(chooser);

    PropertyChangeListener listener = new Test4234761();
    chooser.addPropertyChangeListener("color", listener); // NON-NLS: property name

    JTabbedPane tabbedPane = (JTabbedPane) chooser.getComponent(0);
    tabbedPane.setSelectedIndex(1); // HSB tab index

    if (!chooser.getColor().equals(COLOR)) {
        listener.propertyChange(null);
    }
    dialog.dispose();
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:16,代碼來源:Test4234761.java

示例14: main

import javax.swing.JDialog; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
    int hsvIndex = 0;
    int panelsLength;
    int finalIndex;
    JColorChooser chooser = new JColorChooser();
    AbstractColorChooserPanel[] panels = chooser.getChooserPanels();
    panelsLength = panels.length;

    for(int i = 0; i < panelsLength; i++) {
        if(panels[i].getDisplayName().equals("HSV")) {
            hsvIndex = i;
        }
    }
    finalIndex = Math.min(hsvIndex, panelsLength - 1);
    chooser.setChooserPanels(new AbstractColorChooserPanel[] { panels[finalIndex] });

    JDialog dialog = show(chooser);
    pause(DELAY);

    dialog.dispose();
    pause(DELAY);

    Test4177735 test = new Test4177735();
    SwingUtilities.invokeAndWait(test);
    if (test.count != 0) {
        throw new Error("JColorChooser leaves " + test.count + " threads running");
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:29,代碼來源:Test4177735.java

示例15: saveSEGY

import javax.swing.JDialog; //導入方法依賴的package包/類
private void saveSEGY(OutputStream out) throws IOException {
	if(image==null) throw new IOException("no image loaded");

	String mcsPath = PathUtil.getPath("PORTALS/MULTI_CHANNEL_PATH",
			MapApp.BASE_URL+"/data/portals/mcs/");

	URL url = URLFactory.url( mcsPath + line.getCruiseID().trim() + "/segy/" +
			line.getCruiseID().trim() +"-"+ 
			line.getID().trim() + ".segy" );
	URLConnection urlCon = url.openConnection();
	BufferedInputStream in = new BufferedInputStream(urlCon.getInputStream());
	int length = urlCon.getContentLength();

	// Create a JProgressBar + JDialog
	JDialog d = new JDialog((Frame)null, "Saving SEGY");
	JPanel p = new JPanel(new BorderLayout());
	p.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
	d.setLocationRelativeTo(null);
	JProgressBar pb = new JProgressBar(0,length);
	p.add(new JLabel("Saving " + (length / 1000000) + "mb segy file"), BorderLayout.NORTH);
	p.add(pb);
	d.getContentPane().add(p);

	d.pack();
	d.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
	d.setVisible(true);

	byte[] b = new byte[16384];
	int read = in.read(b);
	while (read != -1) {
		out.write(b, 0, read);
		pb.setValue(pb.getValue() + read);
		pb.repaint();
		read = in.read(b);
	}

	out.flush();
	in.close();
	d.dispose();
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:41,代碼來源:XMImage.java


注:本文中的javax.swing.JDialog.dispose方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。