本文整理汇总了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();
}
示例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);
}
}
}
}
示例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;
}
示例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;
}
示例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");
}
}
示例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;
}
示例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();
}
示例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();
}
示例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;
}
示例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;
}
示例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();
}
示例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();
}
示例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();
}
示例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");
}
}
示例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();
}