本文整理汇总了Java中org.openide.DialogDescriptor.setAdditionalOptions方法的典型用法代码示例。如果您正苦于以下问题:Java DialogDescriptor.setAdditionalOptions方法的具体用法?Java DialogDescriptor.setAdditionalOptions怎么用?Java DialogDescriptor.setAdditionalOptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.DialogDescriptor
的用法示例。
在下文中一共展示了DialogDescriptor.setAdditionalOptions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDescriptor
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
@Override
protected DialogDescriptor createDescriptor() {
Object[] rightButtons = getRightButtons();
Object[] leftButtons = getLeftButtons();
DialogDescriptor descriptor = new DialogDescriptor(
getResizableXY(createPanel()),
i18n("LBL_Print_Preview"), // NOI18N
true,
rightButtons,
myPrintButton,
DialogDescriptor.DEFAULT_ALIGN,
null,
null
);
descriptor.setClosingOptions(new Object[] { myPrintButton, myCloseButton });
descriptor.setAdditionalOptions(leftButtons);
return descriptor;
}
示例2: handleSaveAllFailed
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
protected void handleSaveAllFailed(Collection<String> errMsgs) {
JButton btnShowMoreInfo = new JButton();
DialogDescriptor errDescr = new DialogDescriptor(
new ExpandableMessage(
"MSG_ExceptionWhileSavingMoreFiles_Intro", //NOI18N
errMsgs,
null,
btnShowMoreInfo),
getMessage("MSG_Title_SavingError"), //NOI18N
true, //modal
DEFAULT_OPTION,
OK_OPTION,
null); //no button listener
errDescr.setMessageType(ERROR_MESSAGE);
errDescr.setOptions(new Object[] { OK_OPTION });
errDescr.setAdditionalOptions(new Object[] { btnShowMoreInfo });
errDescr.setClosingOptions(new Object[] { OK_OPTION });
DialogDisplayer.getDefault().notify(errDescr);
closeDialog(btnSaveAll);
}
示例3: testDefaultOptionWithStandardOk
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
public void testDefaultOptionWithStandardOk () {
JButton testButton = new JButton ("for-test-only");
DialogDescriptor dd = new DialogDescriptor (
"Hello", // innerPane
"title", // title
false, // isModal
new Object[] { NotifyDescriptor.CANCEL_OPTION, NotifyDescriptor.OK_OPTION }, // options
NotifyDescriptor.OK_OPTION, // initialValue
DialogDescriptor.DEFAULT_ALIGN, // optionsAlign
HelpCtx.DEFAULT_HELP, // help
null); // action listener
dd.setAdditionalOptions (new JButton[] {testButton});
Dialog dlg = DialogDisplayer.getDefault ().createDialog (dd);
//dlg.setVisible (true);
assertEquals ("OK_OPTION is the default value.", NotifyDescriptor.OK_OPTION, dd.getDefaultValue ());
assertEquals ("OK_OPTION is the default button on dialog",
NbBundle.getBundle (NbPresenter.class).getString ("OK_OPTION_CAPTION"),
testButton.getRootPane ().getDefaultButton ().getText ());
//dlg.dispose ();
}
示例4: testDefaultOptionWithStandardCancel
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
public void testDefaultOptionWithStandardCancel () {
JButton testButton = new JButton ("for-test-only");
DialogDescriptor dd = new DialogDescriptor (
"Hello", // innerPane
"title", // title
false, // isModal
new Object[] { NotifyDescriptor.OK_OPTION, NotifyDescriptor.CANCEL_OPTION }, // options
NotifyDescriptor.CANCEL_OPTION, // initialValue
DialogDescriptor.DEFAULT_ALIGN, // optionsAlign
HelpCtx.DEFAULT_HELP, // help
null); // action listener
dd.setAdditionalOptions (new JButton[] {testButton});
Dialog dlg = DialogDisplayer.getDefault ().createDialog (dd);
//dlg.setVisible (true);
assertEquals ("CANCEL_OPTION is the default value.", NotifyDescriptor.CANCEL_OPTION, dd.getDefaultValue ());
assertEquals ("CANCEL_OPTION is the default button on dialog",
NbBundle.getBundle (NbPresenter.class).getString ("CANCEL_OPTION_CAPTION"),
testButton.getRootPane ().getDefaultButton ().getText ());
//dlg.dispose ();
}
示例5: getNetworkProblemDescriptor
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
private DialogDescriptor getNetworkProblemDescriptor() {
DialogDescriptor descriptor = getProblemDesriptor(NbBundle.getMessage(ProblemPanel.class, "CTL_ShowProxyOptions"));
JButton showProxyOptions = new JButton ();
Mnemonics.setLocalizedText (showProxyOptions, NbBundle.getMessage(ProblemPanel.class, "CTL_ShowProxyOptions"));
showProxyOptions.getAccessibleContext ().setAccessibleDescription (NbBundle.getMessage(ProblemPanel.class, "ACSD_ShowProxyOptions"));
showProxyOptions.addActionListener (new ActionListener () {
@Override
public void actionPerformed (ActionEvent arg0) {
OptionsDisplayer.getDefault ().open ("General"); // NOI18N
}
});
if (isWarning) {
descriptor.setAdditionalOptions(new Object [] {showProxyOptions});
}
return descriptor;
}
示例6: showDialog
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
static KeyStroke[] showDialog() {
Object[] buttons = new Object[] {
DialogDescriptor.OK_OPTION,
DialogDescriptor.CANCEL_OPTION
};
final ShortcutEnterPanel sepPanel = new ShortcutEnterPanel();
DialogDescriptor descriptor = new DialogDescriptor(sepPanel,sepPanel.getTitle(),
true,buttons,DialogDescriptor.OK_OPTION,DialogDescriptor.DEFAULT_ALIGN, null,sepPanel.listener);
descriptor.setClosingOptions(new Object[] {
DialogDescriptor.OK_OPTION,
DialogDescriptor.CANCEL_OPTION
});
descriptor.setAdditionalOptions(sepPanel.getAdditionalOptions());
DialogDisplayer.getDefault().notify(descriptor);
String shortcut = sepPanel.getShortcutText();
if (descriptor.getValue() == DialogDescriptor.OK_OPTION && shortcut != null && shortcut.trim().length() > 0) {
return WizardUtils.stringToKeyStrokes(shortcut);//NOI18N
} else {
return null;
}
}
示例7: showInfo
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
/** Shows info about found hard coded string. */
private void showInfo() {
JPanel infoPanel = support.getInfo(hcString);
DialogDescriptor dd = new DialogDescriptor(
infoPanel,
I18nUtil.getBundle().getString("CTL_InfoPanelTitle")); //NOI18N
dd.setModal(true);
dd.setOptionType(DialogDescriptor.DEFAULT_OPTION);
dd.setOptions(new Object[] {DialogDescriptor.OK_OPTION});
dd.setAdditionalOptions(new Object[0]);
Dialog infoDialog = DialogDisplayer.getDefault().createDialog(dd);
infoDialog.setVisible(true);
}
示例8: showDialog
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
public void showDialog() {
String titleMsgKey = replacing
? "LBL_ReplaceInProjects" //NOI18N
: "LBL_FindInProjects"; //NOI18N
DialogDescriptor dialogDescriptor = new DialogDescriptor(
this,
NbBundle.getMessage(getClass(), titleMsgKey),
false,
new Object[]{okButton, cancelButton},
okButton,
DialogDescriptor.BOTTOM_ALIGN,
new HelpCtx(getClass().getCanonicalName() + "." + replacing),
this);
dialogDescriptor.setTitle(NbBundle.getMessage(getClass(), titleMsgKey));
dialogDescriptor.createNotificationLineSupport();
dialogDescriptor.setAdditionalOptions(new Object[] {newTabCheckBox});
dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor);
dialog.addWindowListener(new DialogCloseListener());
this.setDialogDescriptor(dialogDescriptor);
dialog.pack();
setCurrentlyShown(this);
dialog.setVisible(
true);
dialog.requestFocus();
this.requestFocusInWindow();
updateHelp();
updateUsability();
if (selectedPresenter == null) {
chooseLastUsedPresenter();
}
}
示例9: showShortcutsDialog
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
@Override
public String showShortcutsDialog() {
final ShortcutsDialog d = new ShortcutsDialog ();
d.init(this);
final DialogDescriptor descriptor = new DialogDescriptor (
d,
loc ("Add_Shortcut_Dialog"),
true,
new Object[] {
DialogDescriptor.OK_OPTION,
DialogDescriptor.CANCEL_OPTION
},
DialogDescriptor.OK_OPTION,
DialogDescriptor.DEFAULT_ALIGN,
null,
d.getListener()
);
descriptor.setClosingOptions (new Object[] {
DialogDescriptor.OK_OPTION,
DialogDescriptor.CANCEL_OPTION
});
descriptor.setAdditionalOptions (new Object [] {
d.getBClear(), d.getBTab()
});
descriptor.setValid(d.isShortcutValid());
d.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName() == null || ShortcutsDialog.PROP_SHORTCUT_VALID.equals(evt.getPropertyName())) {
descriptor.setValid(d.isShortcutValid());
}
}
});
DialogDisplayer.getDefault ().notify (descriptor);
if (descriptor.getValue () == DialogDescriptor.OK_OPTION)
return d.getTfShortcut().getText ();
return null;
}
示例10: confirmContinueCommit
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
private boolean confirmContinueCommit(Collection<String> errMsgs) {
if ((errMsgs == null) || errMsgs.isEmpty()) {
return true;
}
JButton btnShowMoreInfo = new JButton();
JComponent info = new ExpandableMessage(
"MSG_ExceptionWhileSavingMoreFiles_Intro", //NOI18N
errMsgs,
"MSG_ExceptionWhileSavingMoreFiles_Question", //NOI18N
btnShowMoreInfo);
String commitLbl = getMessage("LBL_ProceedWithCommit"); //NOI18N
DialogDescriptor errDialog = new DialogDescriptor(
info,
getMessage("MSG_Title_SavingError"), //title //NOI18N
true, //modal
OK_CANCEL_OPTION,
WARNING_MESSAGE,
null); //button listener
errDialog.setOptions(new Object[] {commitLbl, CANCEL_OPTION});
errDialog.setAdditionalOptions(new Object[] {btnShowMoreInfo});
errDialog.setValue(CANCEL_OPTION); //default option
errDialog.setClosingOptions(new Object[] {commitLbl, CANCEL_OPTION});
Object value = DialogDisplayer.getDefault().notify(errDialog);
return (value == commitLbl);
}
示例11: createDialogDescriptor
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
private DialogDescriptor createDialogDescriptor() {
DialogDescriptor desc = new DialogDescriptor(
getMainDialogComponent(),
getDialogTitle(),
true, //modal
getDialogOptions(),
null, //no initial value
DialogDescriptor.RIGHT_ALIGN,
(HelpCtx) null,
listener);
desc.setAdditionalOptions(getAdditionalOptions());
desc.setClosingOptions(getDialogClosingOptions());
return desc;
}
示例12: parseButtons
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
/** Tries to parse a list of buttons provided by given page.
* @param is the input stream to read the page from
* @param defaultButton the button to add always to the list
*/
static void parseButtons(InputStream is, final Object defaultButton, final DialogDescriptor dd)
throws IOException, ParserConfigurationException, SAXException, InterruptedException, InvocationTargetException {
final ButtonsHTMLParser bp = new ButtonsHTMLParser(is);
final IOException[] ioExPtr = new IOException[] { null };
Runnable buttonsCreation = new Runnable() {
@Override
public void run() {
try {
bp.parse();
} catch (IOException ioex) {
ioExPtr[0] = ioex;
return ;
}
bp.createButtons();
List<Object> options = bp.getOptions();
if (!bp.containsExitButton() && (defaultButton != null)){
options.add(defaultButton);
}
dd.setOptions(options.toArray());
dd.setAdditionalOptions(bp.getAdditionalOptions().toArray());
if (bp.getTitle() != null){
dd.setTitle(bp.getTitle());
}
}
};
if (EventQueue.isDispatchThread()){
buttonsCreation.run();
}else{
EventQueue.invokeAndWait(buttonsCreation);
}
if (ioExPtr[0] != null) {
throw ioExPtr[0];
}
}
示例13: innerShowDialog
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
/** Opens the ExitDialog for activated nodes or for
* whole repository.
*/
private static boolean innerShowDialog (Set<DataObject> openedFiles) {
if (!openedFiles.isEmpty()) {
if (SAVE_ALL_UNCONDITIONALLY) {
//this section should be invoked only by tests!
for (DataObject d: openedFiles) {
doSave(d);
}
return true;
}
// XXX(-ttran) caching this dialog is fatal. If the user
// cancels the Exit action, modifies some more files and tries to
// Exit again the list of modified DataObject's is not updated,
// changes made by the user after the first aborted Exit will be
// lost.
exitDialog = null;
if (exitDialog == null) {
ResourceBundle bundle = NbBundle.getBundle(ExitDialog.class);
JButton buttonSave = new JButton();
buttonSave.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Save"));
JButton buttonSaveAll = new JButton();
buttonSaveAll.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_SaveAll"));
JButton buttonDiscardAll = new JButton();
buttonDiscardAll.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_DiscardAll"));
Mnemonics.setLocalizedText(buttonSave, bundle.getString("CTL_Save"));
Mnemonics.setLocalizedText(buttonSaveAll, bundle.getString ("CTL_SaveAll"));
Mnemonics.setLocalizedText(buttonDiscardAll, bundle.getString ("CTL_DiscardAll"));
exitOptions = new Object[] {
buttonSave,
buttonSaveAll,
buttonDiscardAll,
};
ExitDialog exitComponent = null;
exitComponent = new ExitDialog (openedFiles);
DialogDescriptor exitDlgDescriptor = new DialogDescriptor (
exitComponent, // inside component
bundle.getString("CTL_ExitTitle"), // title
true, // modal
exitOptions, // options
NotifyDescriptor.CANCEL_OPTION, // initial value
DialogDescriptor.RIGHT_ALIGN, // option align
null, // no help
exitComponent // Action Listener
);
exitDlgDescriptor.setAdditionalOptions (new Object[] {NotifyDescriptor.CANCEL_OPTION});
exitDialog = DialogDisplayer.getDefault ().createDialog (exitDlgDescriptor);
}
result = false;
exitDialog.setVisible (true); // Show the modal Save dialog
return result;
}
else
return true;
}
示例14: NotifyExcPanel
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
/** Constructor.
*/
private NotifyExcPanel () {
java.util.ResourceBundle bundle = org.openide.util.NbBundle.getBundle(NotifyExcPanel.class);
next = new JButton ();
Mnemonics.setLocalizedText(next, bundle.getString("CTL_NextException"));
// bugfix 25684, don't set Previous/Next as default capable
next.setDefaultCapable (false);
previous = new JButton ();
Mnemonics.setLocalizedText(previous, bundle.getString("CTL_PreviousException"));
previous.setDefaultCapable (false);
details = new JButton ();
details.setDefaultCapable (false);
output = new JTextPane() {
public @Override boolean getScrollableTracksViewportWidth() {
return false;
}
};
output.setEditable(false);
Font f = output.getFont();
output.setFont(new Font("Monospaced", Font.PLAIN, null == f ? 12 : f.getSize() + 1)); // NOI18N
output.setForeground(UIManager.getColor("Label.foreground")); // NOI18N
output.setBackground(UIManager.getColor("Label.background")); // NOI18N
setLayout( new BorderLayout() );
add(new JScrollPane(output));
setBorder( new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.LOWERED));
next.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_NextException"));
previous.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_PreviousException"));
output.getAccessibleContext().setAccessibleName(bundle.getString("ACSN_ExceptionStackTrace"));
output.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_ExceptionStackTrace"));
getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_NotifyExceptionPanel"));
descriptor = new DialogDescriptor ("", ""); // NOI18N
descriptor.setMessageType (DialogDescriptor.ERROR_MESSAGE);
descriptor.setOptions (computeOptions(previous, next));
descriptor.setAdditionalOptions (new Object[] {
details
});
descriptor.setClosingOptions (new Object[0]);
descriptor.setButtonListener (this);
// bugfix #27176, create dialog in modal state if some other modal
// dialog is opened at the time
// #53328 do not let the error dialog to be created modal unless the main
// window is visible. otherwise the error message may be hidden behind
// the main window thus making the main window unusable
descriptor.setModal( isModalDialogPresent()
&& WindowManager.getDefault().getMainWindow().isVisible() );
setPreferredSize(new Dimension(SIZE_PREFERRED_WIDTH + extraW, SIZE_PREFERRED_HEIGHT + extraH));
dialog = DialogDisplayer.getDefault().createDialog(descriptor);
if( null != lastBounds ) {
lastBounds.width = Math.max( lastBounds.width, SIZE_PREFERRED_WIDTH+extraW );
dialog.setBounds( lastBounds );
}
dialog.getAccessibleContext().setAccessibleName(bundle.getString("ACN_NotifyExcPanel_Dialog")); // NOI18N
dialog.getAccessibleContext().setAccessibleDescription(bundle.getString("ACD_NotifyExcPanel_Dialog")); // NOI18N
}
示例15: innerShowDialog
import org.openide.DialogDescriptor; //导入方法依赖的package包/类
/**
* Opens the ExitDialog.
*/
private static boolean innerShowDialog() {
Collection<? extends Savable> set = Savable.REGISTRY.lookupAll(Savable.class);
if (!set.isEmpty()) {
// XXX(-ttran) caching this dialog is fatal. If the user
// cancels the Exit action, modifies some more files and tries to
// Exit again the list of modified DataObject's is not updated,
// changes made by the user after the first aborted Exit will be
// lost.
exitDialog = null;
if (exitDialog == null) {
ResourceBundle bundle = NbBundle.getBundle(ExitDialog.class);
JButton buttonSave = new JButton();
buttonSave.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Save"));
JButton buttonSaveAll = new JButton();
buttonSaveAll.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_SaveAll"));
JButton buttonDiscardAll = new JButton();
buttonDiscardAll.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_DiscardAll"));
// special handling to handle a button title with mnemonic
// and to allow enable/disable control of the option
Mnemonics.setLocalizedText(buttonSave, bundle.getString("CTL_Save"));
Mnemonics.setLocalizedText(buttonSaveAll, bundle.getString("CTL_SaveAll"));
Mnemonics.setLocalizedText(buttonDiscardAll, bundle.getString("CTL_DiscardAll"));
exitOptions = new Object[] {
buttonSave,
buttonSaveAll,
buttonDiscardAll,
};
ExitDialog exitComponent = new ExitDialog ();
DialogDescriptor exitDlgDescriptor = new DialogDescriptor (
exitComponent, // inside component
bundle.getString("CTL_ExitTitle"), // title
true, // modal
exitOptions, // options
NotifyDescriptor.CANCEL_OPTION, // initial value
DialogDescriptor.RIGHT_ALIGN, // option align
null, // HelpCtx
exitComponent // Action Listener
);
exitDlgDescriptor.setHelpCtx( new HelpCtx( "help_on_exit_dialog" ) ); //NOI18N
exitDlgDescriptor.setAdditionalOptions (new Object[] {NotifyDescriptor.CANCEL_OPTION});
exitDialog = org.openide.DialogDisplayer.getDefault ().createDialog (exitDlgDescriptor);
}
result = false;
exitDialog.setVisible(true); // Show the modal Save dialog
return result;
}
else
return true;
}