本文整理汇总了Java中java.awt.Dialog.dispose方法的典型用法代码示例。如果您正苦于以下问题:Java Dialog.dispose方法的具体用法?Java Dialog.dispose怎么用?Java Dialog.dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Dialog
的用法示例。
在下文中一共展示了Dialog.dispose方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showCustomizer
import java.awt.Dialog; //导入方法依赖的package包/类
@NbBundle.Messages("MSG_CONFIGURE=Configure Selenium Server")
public static boolean showCustomizer() {
Selenium2Customizer panel = new Selenium2Customizer();
DialogDescriptor descriptor = new DialogDescriptor(panel, Bundle.MSG_CONFIGURE());
panel.setDescriptor(descriptor);
Dialog dialog = DialogDisplayer.getDefault().createDialog(descriptor);
dialog.setModal(true);
dialog.setVisible(true);
dialog.dispose();
if (descriptor.getValue() == DialogDescriptor.OK_OPTION) {
Selenium2ServerSupport.getPrefs().put(Selenium2ServerSupport.SELENIUM_SERVER_JAR, panel.tfSeleniumServerJar.getText());
Selenium2ServerSupport.getPrefs().put(Selenium2ServerSupport.FIREFOX_PROFILE_TEMPLATE_DIR, panel.tfFirefoxProfileDir.getText());
Selenium2ServerSupport.getPrefs().put(Selenium2ServerSupport.USER_EXTENSION_FILE, panel.tfUserExtensionFile.getText());
Selenium2ServerSupport.getPrefs().putInt(Selenium2ServerSupport.PORT, Integer.parseInt(panel.spinnerPort.getValue().toString()));
Selenium2ServerSupport.getPrefs().putBoolean(Selenium2ServerSupport.SINGLE_WINDOW, panel.cbSingleWindow.isSelected());
return true;
} else {
return false;
}
}
示例2: actionPerformed
import java.awt.Dialog; //导入方法依赖的package包/类
public void actionPerformed( ActionEvent e ) {
for (ActionListener al : uiProperties.getOptionListeners()) {
al.actionPerformed(e);
}
//#95952 some users experience this assertion on a fairly random set of changes in
// the customizer, that leads me to assume that a project can be already marked
// as modified before the project customizer is shown.
// assert !ProjectManager.getDefault().isModified(project) :
// "Some of the customizer panels has written the changed data before OK Button was pressed. Please file it as bug."; //NOI18N
// Close & dispose the the dialog
Dialog dialog = project2Dialog.get(project);
if ( dialog != null ) {
dialog.setVisible(false);
dialog.dispose();
}
}
示例3: actionPerformed
import java.awt.Dialog; //导入方法依赖的package包/类
@Messages({"# {0} - module display name", "CTL_EditModuleDependencyTitle=Edit \"{0}\" Dependency"})
public @Override void actionPerformed(ActionEvent ev) {
final EditTestDependencyPanel editTestPanel = new EditTestDependencyPanel(testDep);
DialogDescriptor descriptor = new DialogDescriptor(editTestPanel,
CTL_EditModuleDependencyTitle(testDep.getModule().getLocalizedName()));
descriptor.setHelpCtx(new HelpCtx("org.netbeans.modules.apisupport.project.ui.customizer.EditTestDependencyPanel"));
Dialog d = DialogDisplayer.getDefault().createDialog(descriptor);
d.setVisible(true);
if (descriptor.getValue().equals(DialogDescriptor.OK_OPTION)) {
TestModuleDependency editedDep = editTestPanel.getEditedDependency();
try {
ProjectXMLManager pxm = new ProjectXMLManager(project);
pxm.removeTestDependency(testType, testDep.getModule().getCodeNameBase());
pxm.addTestDependency(testType, editedDep);
ProjectManager.getDefault().saveProject(project);
} catch (IOException e) {
Exceptions.attachMessage(e, "Cannot store dependency: " + editedDep); // NOI18N
Exceptions.printStackTrace(e);
}
}
d.dispose();
}
示例4: editModuleDependency
import java.awt.Dialog; //导入方法依赖的package包/类
@Messages("CTL_EditModuleDependencyTitle=Edit Module Dependency")
private void editModuleDependency(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editModuleDependency
ModuleDependency origDep = getDepListModel().getDependency(
dependencyList.getSelectedIndex());
EditDependencyPanel editPanel = new EditDependencyPanel(
origDep, getProperties().getActivePlatform());
DialogDescriptor descriptor = new DialogDescriptor(editPanel,
CTL_EditModuleDependencyTitle());
descriptor.setHelpCtx(new HelpCtx("org.netbeans.modules.apisupport.project.ui.customizer.EditDependencyPanel"));
Dialog d = DialogDisplayer.getDefault().createDialog(descriptor);
d.setVisible(true);
if (descriptor.getValue().equals(DialogDescriptor.OK_OPTION)) {
getDepListModel().editDependency(origDep, editPanel.getEditedDependency());
}
d.dispose();
dependencyList.requestFocusInWindow();
}
示例5: getScaleFactor
import java.awt.Dialog; //导入方法依赖的package包/类
static float getScaleFactor() {
final Dialog dialog = new Dialog((Window) null);
dialog.setSize(100, 100);
dialog.setModal(true);
final float[] scaleFactors = new float[1];
Panel panel = new Panel() {
@Override
public void paint(Graphics g) {
float scaleFactor = 1;
if (g instanceof SunGraphics2D) {
scaleFactor = ((SunGraphics2D) g).surfaceData.getDefaultScale();
}
scaleFactors[0] = scaleFactor;
dialog.setVisible(false);
}
};
dialog.add(panel);
dialog.setVisible(true);
dialog.dispose();
return scaleFactors[0];
}
示例6: customize
import java.awt.Dialog; //导入方法依赖的package包/类
private static void customize (JPDAWatch w) {
WatchPanel wp = new WatchPanel (w.getExpression ());
JComponent panel = wp.getPanel ();
ResourceBundle bundle = NbBundle.getBundle (WatchesActionsProvider.class);
org.openide.DialogDescriptor dd = new org.openide.DialogDescriptor (
panel,
java.text.MessageFormat.format(bundle.getString("CTL_Edit_Watch_Dialog_Title"), // NOI18N
new Object [] { w.getExpression() })
);
dd.setHelpCtx (new HelpCtx ("debug.customize.watch"));
Dialog dialog = DialogDisplayer.getDefault ().createDialog (dd);
dialog.setVisible (true);
dialog.dispose ();
if (dd.getValue () != org.openide.DialogDescriptor.OK_OPTION) return;
if (panel.getClientProperty("WatchCanceled") != null) return ; //NOI18N
w.setExpression (wp.getExpression ());
}
示例7: customize
import java.awt.Dialog; //导入方法依赖的package包/类
private static void customize (Watch w) {
WatchPanel wp = new WatchPanel(w.getExpression());
JComponent panel = wp.getPanel();
org.openide.DialogDescriptor dd = new org.openide.DialogDescriptor(
panel,
NbBundle.getMessage(WatchesActionsProvider.class, "CTL_WatchDialog_Title", // NOI18N
w.getExpression())
);
dd.setHelpCtx(new HelpCtx("debug.add.watch"));
Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
dialog.setVisible(true);
dialog.dispose();
if (dd.getValue() != org.openide.DialogDescriptor.OK_OPTION) return;
w.setExpression(wp.getExpression());
}
示例8: initAuthentication
import java.awt.Dialog; //导入方法依赖的package包/类
/**
*
* @param auth
* @return false if cancelled
*/
public boolean initAuthentication(final Authentication auth) {
AuthenticationSettingsPanel vpanel = new AuthenticationSettingsPanel(auth, false);
vpanel.addValidationListener(new AuthValidationListener());
cfgPanel.add(vpanel, BorderLayout.CENTER);
DialogDescriptor dd = new DialogDescriptor(this,
NbBundle.getMessage(AuthTypeSelectorDlg.class, "TITLE_AuthTypeSelectorDlg"), // NOI18N
true, new Object[]{ok, DialogDescriptor.CANCEL_OPTION}, ok,
DialogDescriptor.DEFAULT_ALIGN, null, null);
Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
dialog.setResizable(false);
try {
dialog.setVisible(true);
} catch (Throwable th) {
if (!(th.getCause() instanceof InterruptedException)) {
throw new RuntimeException(th);
}
dd.setValue(DialogDescriptor.CANCEL_OPTION);
} finally {
dialog.dispose();
}
if (dd.getValue() == ok) {
vpanel.applyChanges(null);
return true;
} else {
return false;
}
}
示例9: performAction
import java.awt.Dialog; //导入方法依赖的package包/类
@NbBundle.Messages({
"LBL_Tag=&Tag",
"# {0} - tag",
"LBL_TagTag=Tag {0}"
})
@Override
protected void performAction(Node[] activatedNodes) {
DockerTag tag = activatedNodes[0].getLookup().lookup(DockerTag.class);
if (tag != null) {
JButton tagButton = new JButton();
Mnemonics.setLocalizedText(tagButton, Bundle.LBL_Tag());
TagPanel panel = new TagPanel(tag.getImage().getInstance(), tagButton);
DialogDescriptor descriptor
= new DialogDescriptor(panel, Bundle.LBL_TagTag(tag.getTag()),
true, new Object[] {tagButton, DialogDescriptor.CANCEL_OPTION}, tagButton,
DialogDescriptor.DEFAULT_ALIGN, null, null);
descriptor.setClosingOptions(new Object[] {tagButton, DialogDescriptor.CANCEL_OPTION});
panel.setMessageLine(descriptor.createNotificationLineSupport());
Dialog dlg = null;
try {
dlg = DialogDisplayer.getDefault().createDialog(descriptor);
dlg.setVisible(true);
if (descriptor.getValue() == tagButton) {
perform(tag, panel.getRepository(), panel.getTag(), panel.isForce());
}
} finally {
if (dlg != null) {
dlg.dispose();
}
}
}
}
示例10: testScaleFactor
import java.awt.Dialog; //导入方法依赖的package包/类
private static void testScaleFactor(final GraphicsConfiguration gc) {
final Dialog dialog = new Dialog((Frame) null, "Test", true, gc);
try {
dialog.setSize(100, 100);
Panel panel = new Panel() {
@Override
public void paint(Graphics g) {
if (g instanceof Graphics2D) {
AffineTransform gcTx = gc.getDefaultTransform();
AffineTransform gTx
= ((Graphics2D) g).getTransform();
passed = gcTx.getScaleX() == gTx.getScaleX()
&& gcTx.getScaleY() == gTx.getScaleY();
} else {
passed = true;
}
dialog.setVisible(false);
}
};
dialog.add(panel);
dialog.setVisible(true);
if (!passed) {
throw new RuntimeException("Transform is not scaled!");
}
} finally {
dialog.dispose();
}
}
示例11: askPassword
import java.awt.Dialog; //导入方法依赖的package包/类
@Override
public boolean askPassword(ExecutionEnvironment execEnv, String key) {
Mnemonics.setLocalizedText(promptLabel, NbBundle.getMessage(CertPassphraseDlg.class, "CertPassphraseDlg.promptLabel.text", key)); // NOI18N
tfUser.setText(execEnv.getUser());
String hostName = execEnv.getHost();
if (execEnv.getSSHPort() != 22) {
hostName += ":" + execEnv.getSSHPort(); //NOI18N
}
tfHost.setText(hostName); // NOI18N
DialogDescriptor dd = new DialogDescriptor(this,
NbBundle.getMessage(CertPassphraseDlg.class, "CertPassphraseDlg.title.text"), // NOI18N
true, // NOI18N
new Object[]{
DialogDescriptor.OK_OPTION,
DialogDescriptor.CANCEL_OPTION},
DialogDescriptor.OK_OPTION,
DialogDescriptor.DEFAULT_ALIGN, null, null);
Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
dialog.setResizable(false);
try {
dialog.setVisible(true);
} catch (Throwable th) {
if (!(th.getCause() instanceof InterruptedException)) {
throw new RuntimeException(th);
}
dd.setValue(DialogDescriptor.CANCEL_OPTION);
} finally {
dialog.dispose();
}
return dd.getValue() == DialogDescriptor.OK_OPTION;
}
示例12: selectDevice
import java.awt.Dialog; //导入方法依赖的package包/类
/**
* Selects a device
*
* @return device info or {@code null}
*/
@Override
public LaunchData selectDevice(AvdManager avdManager, IDevice[] devices) {
final DeviceUiChooser panel = new DeviceUiChooser(avdManager, devices);
final Object[] options = new Object[]{
DialogDescriptor.OK_OPTION,
DialogDescriptor.CANCEL_OPTION
};
final DialogDescriptor desc = new DialogDescriptor(panel,
"Select device",
true, options, options[0], DialogDescriptor.BOTTOM_ALIGN, null, null);
desc.setMessageType(DialogDescriptor.INFORMATION_MESSAGE);
desc.setValid(false); // no selection yet
panel.addLaunchDataListener(new LaunchDeviceListener() {
@Override
public void lauchDeviceChanged(LaunchData launchData) {
desc.setValid(launchData != null);
}
});
final Dialog dlg = DialogDisplayer.getDefault().createDialog(desc);
panel.addSelectCallback(new Runnable() {
@Override
public void run() {
dlg.setVisible(false);
desc.setValue(options[0]);
}
});
dlg.setVisible(true);
dlg.dispose();
if (desc.getValue() == options[0]) {
return panel.getLaunchData();
}
return null;
}
示例13: selectDependencies
import java.awt.Dialog; //导入方法依赖的package包/类
/**
*
* @param props
* @param initialFilterText initial filter text or null if not given
* @return
*/
public static ModuleDependency[] selectDependencies(final SingleModuleProperties props, final String initialFilterText) {
final AddModulePanel addPanel;
if (null != initialFilterText) {
// init dialog with filter text
addPanel = new AddModulePanel(props, initialFilterText);
}
else{
// keep backwards compatibility
addPanel = new AddModulePanel(props);
}
final DialogDescriptor descriptor = new DialogDescriptor(addPanel,
getMessage("CTL_AddModuleDependencyTitle"));
descriptor.setHelpCtx(new HelpCtx("org.netbeans.modules.apisupport.project.ui.customizer.AddModulePanel"));
descriptor.setClosingOptions(new Object[0]);
final Dialog d = DialogDisplayer.getDefault().createDialog(descriptor);
descriptor.setButtonListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (DialogDescriptor.OK_OPTION.equals(e.getSource()) && addPanel.getSelectedDependencies().length == 0) {
return;
}
d.setVisible(false);
d.dispose();
}
});
if (lastSize != null) {
d.setBounds(lastSize);
}
d.setVisible(true);
lastSize = d.getBounds();
d.dispose();
if (descriptor.getValue().equals(DialogDescriptor.OK_OPTION)) {
return addPanel.getSelectedDependencies();
} else {
return new ModuleDependency[0]; // #114932
}
}
示例14: showAddDialog
import java.awt.Dialog; //导入方法依赖的package包/类
/**
* Displays Add Cluster dialog and lets user select path to external cluster.
*
* @param prj Project into which the path will be stored. Returned path is relative to the project dir if possible.
* @return Info for newly added cluster or null if user cancelled the dialog.
*/
static ClusterInfo showAddDialog(Project prj) {
EditClusterPanel panel = new EditClusterPanel();
panel.prjDir = FileUtil.toFile(prj.getProjectDirectory());
panel.prj = prj;
SourceRootsSupport srs = new SourceRootsSupport(new URL[0], null);
panel.sourcesPanel.setSourceRootsProvider(srs);
JavadocRootsSupport jrs = new JavadocRootsSupport(new URL[0], null);
panel.javadocPanel.setJavadocRootsProvider(jrs);
DialogDescriptor descriptor = new DialogDescriptor(
panel,
NbBundle.getMessage(EditClusterPanel.class, "CTL_AddCluster_Title"), // NOI18N
true,
new Object[] { panel.okButton, NotifyDescriptor.CANCEL_OPTION },
panel.okButton,
DialogDescriptor.DEFAULT_ALIGN,
new HelpCtx("org.netbeans.modules.apisupport.project.ui.customizer.EditClusterPanel"),
null);
descriptor.setClosingOptions(null);
Dialog dlg = DialogDisplayer.getDefault().createDialog(descriptor);
panel.updateDialog();
dlg.setVisible(true);
ClusterInfo retVal = null;
if (descriptor.getValue() == panel.okButton) {
retVal = ClusterInfo.createExternal(panel.getAbsoluteClusterPath(),
srs.getSourceRoots(), jrs.getJavadocRoots(), true);
}
dlg.dispose();
return retVal;
}
示例15: showEditDialog
import java.awt.Dialog; //导入方法依赖的package包/类
/**
* Shows Edit Cluster dialog for existing external cluster.
* Browse button is disabled, user can only change src and javadoc.
*
* @param ci Original cluster info
* @return Updated cluster info or null if user cancelled the dialog
*/
static ClusterInfo showEditDialog(ClusterInfo ci, Project prj) {
EditClusterPanel panel = new EditClusterPanel();
panel.prjDir = FileUtil.toFile(prj.getProjectDirectory());
panel.prj = prj;
SourceRootsSupport srs = new SourceRootsSupport(
ci.getSourceRoots() == null ? new URL[0] : ci.getSourceRoots(), null);
panel.sourcesPanel.setSourceRootsProvider(srs);
JavadocRootsSupport jrs = new JavadocRootsSupport(
ci.getJavadocRoots() == null ? new URL[0] : ci.getJavadocRoots(), null);
panel.javadocPanel.setJavadocRootsProvider(jrs);
DialogDescriptor descriptor = new DialogDescriptor(
panel,
NbBundle.getMessage(EditClusterPanel.class, "CTL_EditCluster_Title"), // NOI18N
true,
new Object[] { panel.okButton, NotifyDescriptor.CANCEL_OPTION },
panel.okButton,
DialogDescriptor.DEFAULT_ALIGN,
new HelpCtx("org.netbeans.modules.apisupport.project.ui.customizer.EditClusterPanel"),
null);
descriptor.setClosingOptions(null);
Dialog dlg = DialogDisplayer.getDefault().createDialog(descriptor);
panel.clusterDirText.setText(ci.getClusterDir().toString());
panel.updateDialog();
panel.browseButton.setEnabled(false);
dlg.setVisible(true);
ClusterInfo retVal = null;
if (descriptor.getValue() == panel.okButton) {
retVal = ClusterInfo.createExternal(panel.getAbsoluteClusterPath(),
srs.getSourceRoots(), jrs.getJavadocRoots(), true);
}
dlg.dispose();
return retVal;
}