本文整理汇总了Java中java.awt.Dialog.getSize方法的典型用法代码示例。如果您正苦于以下问题:Java Dialog.getSize方法的具体用法?Java Dialog.getSize怎么用?Java Dialog.getSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Dialog
的用法示例。
在下文中一共展示了Dialog.getSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: displayAlert
import java.awt.Dialog; //导入方法依赖的package包/类
/**
* Just show the dialog but do not do anything about it.
*/
private boolean displayAlert(String projectDisplayName) {
String title = NbBundle.getMessage(UnboundTargetAlert.class, "UTA_TITLE", label, projectDisplayName);
final DialogDescriptor d = new DialogDescriptor(this, title);
d.setOptionType(NotifyDescriptor.OK_CANCEL_OPTION);
d.setMessageType(NotifyDescriptor.ERROR_MESSAGE);
d.setValid(false);
selectCombo.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
d.setValid(((String) selectCombo.getSelectedItem()).trim().length() > 0);
}
});
Dialog dlg = DialogDisplayer.getDefault().createDialog(d);
selectCombo.requestFocusInWindow();
// XXX combo box gets cut off at the bottom unless you do something - why??
Dimension sz = dlg.getSize();
dlg.setSize(sz.width, sz.height + 30);
dlg.setVisible(true);
return d.getValue() == NotifyDescriptor.OK_OPTION;
}
示例2: formattersAddButtonActionPerformed
import java.awt.Dialog; //导入方法依赖的package包/类
private void formattersAddButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_formattersAddButtonActionPerformed
VariablesFormatter f = new VariablesFormatter("");
final VariableFormatterEditPanel fPanel = new VariableFormatterEditPanel();
fPanel.load(f);
fPanel.setFormatterNames(getFormatterNames());
final Dialog[] dlgPtr = new Dialog[] { null };
DialogDescriptor formatterEditDescriptor = new DialogDescriptor(
fPanel,
NbBundle.getMessage(CategoryPanelFormatters.class, "TTL_AddFormatter"),
true,
NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.OK_OPTION,
new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (e.getSource() == NotifyDescriptor.OK_OPTION) {
boolean valid = fPanel.checkValidInput();
if (valid) {
dlgPtr[0].setVisible(false);
}
} else {
dlgPtr[0].setVisible(false);
}
}
});
formatterEditDescriptor.setClosingOptions(new Object[] {});
NotificationLineSupport notificationSupport = formatterEditDescriptor.createNotificationLineSupport();
fPanel.setValidityObjects(formatterEditDescriptor, notificationSupport, false);
//formatterEditDescriptor.setValid(false);
Dialog dlg = DialogDisplayer.getDefault().createDialog(formatterEditDescriptor);
Properties p = Properties.getDefault().getProperties("debugger.options.JPDA"); // NOI18N
int w = p.getInt("VariableFormatters_AddEdit_WIDTH", -1); // NOI18N
int h = p.getInt("VariableFormatters_AddEdit_HEIGHT", -1); // NOI18N
if (w > 0 && h > 0) {
dlg.setSize(new Dimension(w, h));
}
dlgPtr[0] = dlg;
dlg.setVisible(true);
Dimension dim = dlg.getSize();
p.setInt("VariableFormatters_AddEdit_WIDTH", dim.width); // NOI18N
p.setInt("VariableFormatters_AddEdit_HEIGHT", dim.height); // NOI18N
if (NotifyDescriptor.OK_OPTION.equals(formatterEditDescriptor.getValue())) {
fPanel.store(f);
((DefaultListModel) formattersList.getModel()).addElement(f);
formattersList.setSelectedValue(f, true);
}
/*
NotifyDescriptor.InputLine nd = new NotifyDescriptor.InputLine(
NbBundle.getMessage(CategoryPanelFormatters.class, "CategoryPanelFormatters.addDLG.nameLabel"),
NbBundle.getMessage(CategoryPanelFormatters.class, "CategoryPanelFormatters.addDLG.title"));
DialogDisplayer.getDefault().notify(nd);
VariablesFormatter f = new VariablesFormatter(nd.getInputText());
((DefaultListModel) formattersList.getModel()).addElement(f);
formattersList.setSelectedValue(f, true);
//JCheckBox cb = new JCheckBox(nd.getInputText());
//cb.setSelected(true);
//filterClassesList.add(cb);
//filterClassesList.repaint();
*/
}
示例3: editButtonActionPerformed
import java.awt.Dialog; //导入方法依赖的package包/类
private void editButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editButtonActionPerformed
int index = formattersList.getSelectedIndex();
if (index < 0) return ;
DefaultListModel model = (DefaultListModel) formattersList.getModel();
VariablesFormatter f = (VariablesFormatter) model.getElementAt(index);
VariableFormatterEditPanel fPanel = new VariableFormatterEditPanel();
fPanel.load(f);
Set<String> formatterNames = getFormatterNames();
formatterNames.remove(f.getName());
fPanel.setFormatterNames(formatterNames);
DialogDescriptor formatterEditDescriptor = new DialogDescriptor(
fPanel,
NbBundle.getMessage(CategoryPanelFormatters.class, "TTL_EditFormatter"),
true,
NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.OK_OPTION,
null);
NotificationLineSupport notificationSupport = formatterEditDescriptor.createNotificationLineSupport();
fPanel.setValidityObjects(formatterEditDescriptor, notificationSupport, true);
//formatterEditDescriptor.setValid(false);
Dialog dlg = DialogDisplayer.getDefault().createDialog(formatterEditDescriptor);
Properties p = Properties.getDefault().getProperties("debugger.options.JPDA"); // NOI18N
int w = p.getInt("VariableFormatters_AddEdit_WIDTH", -1); // NOI18N
int h = p.getInt("VariableFormatters_AddEdit_HEIGHT", -1); // NOI18N
if (w > 0 && h > 0) {
dlg.setSize(new Dimension(w, h));
}
dlg.setVisible(true);
Dimension dim = dlg.getSize();
p.setInt("VariableFormatters_AddEdit_WIDTH", dim.width); // NOI18N
p.setInt("VariableFormatters_AddEdit_HEIGHT", dim.height); // NOI18N
if (NotifyDescriptor.OK_OPTION.equals(formatterEditDescriptor.getValue())) {
fPanel.store(f);
checkBoxComponents.put(f, new JCheckBox(f.getName(), f.isEnabled()));
((DefaultListModel) formattersList.getModel()).setElementAt(f, index);
//formattersList.repaint();
formattersList.setSelectedValue(f, true);
loadSelectedFormatter(f);
}
}