当前位置: 首页>>代码示例>>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;未经允许,请勿转载。