本文整理汇总了Java中java.awt.Dialog.pack方法的典型用法代码示例。如果您正苦于以下问题:Java Dialog.pack方法的具体用法?Java Dialog.pack怎么用?Java Dialog.pack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Dialog
的用法示例。
在下文中一共展示了Dialog.pack方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: open
import java.awt.Dialog; //导入方法依赖的package包/类
public boolean open () {
dd = new DialogDescriptor(panel, NbBundle.getMessage(RevisionPicker.class, "LBL_RevisionPickerDialog.title"), //NOI18N
true, new Object[] { okButton, DialogDescriptor.CANCEL_OPTION }, okButton, DialogDescriptor.DEFAULT_ALIGN, new HelpCtx("org.netbeans.modules.git.ui.repository.RevisionPickerDialog"), null); //NOI18N
Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
updateDialogState();
browserPanel.addPropertyChangeListener(this);
Preferences prefs = GitModuleConfig.getDefault().getPreferences();
WindowListener windowListener = new DialogBoundsPreserver(prefs, this.getClass().getName());
dialog.addWindowListener(windowListener);
windowListener.windowOpened(new WindowEvent(dialog, WindowEvent.WINDOW_OPENED));
dialog.pack();
updateSliders(prefs);
dialog.setVisible(true);
persistSliders(prefs);
browserPanel.removePropertyChangeListener(this);
return dd.getValue() == okButton;
}
示例2: showDetails
import java.awt.Dialog; //导入方法依赖的package包/类
private static void showDetails(RunningVM vm) {
HTMLTextArea area = new HTMLTextArea();
JScrollPane areaScroll = new JScrollPane(area, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
areaScroll.setBorder(BorderFactory.createEmptyBorder());
areaScroll.setViewportBorder(BorderFactory.createEmptyBorder());
areaScroll.setPreferredSize(new Dimension(500, 260));
configureScrollBar(areaScroll.getVerticalScrollBar());
configureScrollBar(areaScroll.getHorizontalScrollBar());
area.setText(getDetails(vm));
area.setCaretPosition(0);
HelpCtx helpCtx = new HelpCtx("ProcessDetails.HelpCtx"); //NOI18N
JButton close = new JButton(Bundle.AttachDialog_BtnClose());
close.setDefaultCapable(true);
DialogDescriptor dd = new DialogDescriptor(areaScroll, Bundle.AttachDialog_DetailsCaption(getProcessName(vm.getMainClass())),
true, new Object[] { close }, close, DialogDescriptor.DEFAULT_ALIGN, helpCtx, null);
Dialog d = DialogDisplayer.getDefault().createDialog(dd);
d.pack();
d.setVisible(true);
}
示例3: createDialog
import java.awt.Dialog; //导入方法依赖的package包/类
/** Constructs managed dialog instance using TopManager.createDialog
* and returnrs it */
private Dialog createDialog () {
ResourceBundle bundle = NbBundle.getBundle (AddBreakpointAction.class);
panel = new AddBreakpointPanel ();
// create dialog descriptor, create & return the dialog
descriptor = new DialogDescriptor (
panel,
bundle.getString ("CTL_Breakpoint_Title"), // NOI18N
true,
this
);
descriptor.setOptions (new JButton[] {
bOk = new JButton (bundle.getString ("CTL_Ok")), // NOI18N
bCancel = new JButton (bundle.getString ("CTL_Cancel")) // NOI18N
});
bOk.getAccessibleContext ().setAccessibleDescription (bundle.getString ("ACSD_CTL_Ok")); // NOI18N
bCancel.getAccessibleContext ().setAccessibleDescription (bundle.getString ("ACSD_CTL_Cancel")); // NOI18N
descriptor.setClosingOptions (new Object [0]);
notificationSupport = descriptor.createNotificationLineSupport();
Dialog d = DialogDisplayer.getDefault ().createDialog (descriptor);
d.pack ();
return d;
}
示例4: propertyChange
import java.awt.Dialog; //导入方法依赖的package包/类
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (ExplorerManager.PROP_SELECTED_NODES.equals (evt.getPropertyName())) {
Node[] nodes = (Node[]) evt.getNewValue();
if (nodes.length!=1) {
selectPlatform (null);
}
else {
selectPlatform (nodes[0]);
Dialog dialog = (Dialog) SwingUtilities.getAncestorOfClass (Dialog.class, this);
if (dialog != null)
dialog.pack ();
}
}
}
示例5: displayProfilingPoints
import java.awt.Dialog; //导入方法依赖的package包/类
public static void displayProfilingPoints(Lookup.Provider project, ProfilingSettings settings) {
ProfilingPointsDisplayer ppd = getDefault();
ppd.setupDisplay(project, settings);
final DialogDescriptor dd = new DialogDescriptor(ppd,
Bundle.ProfilingPointsDisplayer_PpActiveMsg(settings.getSettingsName()),
true,
new Object[] { DialogDescriptor.OK_OPTION }, DialogDescriptor.OK_OPTION,
0, null, null);
final Dialog d = DialogDisplayer.getDefault().createDialog(dd);
d.pack();
d.setVisible(true);
ppd.cleanup();
}
示例6: openProperties
import java.awt.Dialog; //导入方法依赖的package包/类
public static void openProperties(File[] roots, String ctxDisplayName) {
if(!Subversion.getInstance().checkClientAvailable()) {
return;
}
final PropertiesPanel panel = new PropertiesPanel();
final PropertiesTable propTable;
propTable = new PropertiesTable(panel.labelForTable, PropertiesTable.PROPERTIES_COLUMNS, new String[] { PropertiesTableModel.COLUMN_NAME_VALUE});
panel.setPropertiesTable(propTable);
JComponent component = propTable.getComponent();
panel.propsPanel.setLayout(new BorderLayout());
panel.propsPanel.add(component, BorderLayout.CENTER);
SvnProperties svnProperties = new SvnProperties(panel, propTable, roots);
JButton btnClose = new JButton();
Mnemonics.setLocalizedText(btnClose, getString("CTL_Properties_Action_Close")); //NOI18N
btnClose.getAccessibleContext().setAccessibleDescription(getString("CTL_Properties_Action_Close")); //NOI18N
btnClose.getAccessibleContext().setAccessibleName(getString("CTL_Properties_Action_Close")); //NOI18N
DialogDescriptor dd = new DialogDescriptor(panel, org.openide.util.NbBundle.getMessage(SvnPropertiesAction.class, "CTL_PropertiesDialog_Title", ctxDisplayName)); // NOI18N
dd.setModal(true);
dd.setOptions(new Object[] {btnClose});
dd.setHelpCtx(new HelpCtx(SvnPropertiesAction.class));
panel.putClientProperty("contentTitle", ctxDisplayName); // NOI18N
panel.putClientProperty("DialogDescriptor", dd); // NOI18N
Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
dialog.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(SvnPropertiesAction.class, "CTL_PropertiesAction")); // NOI18N
dialog.pack();
dialog.setVisible(true);
}
示例7: saveQuery
import java.awt.Dialog; //导入方法依赖的package包/类
public static boolean saveQuery(final String query,
final OQLSupport.OQLTreeModel treeModel,
final JTree tree) {
JButton okButton = new JButton();
Mnemonics.setLocalizedText(okButton, Bundle.OQLQueryCustomizer_OkButtonText());
CustomizerPanel customizer = new CustomizerPanel(okButton, treeModel);
final DialogDescriptor dd = new DialogDescriptor(customizer,
Bundle.OQLQueryCustomizer_SaveQueryCaption(), true,
new Object[] { okButton,
DialogDescriptor.CANCEL_OPTION },
okButton, 0, HELP_CTX_SAVE_QUERY, null);
final Dialog d = DialogDisplayer.getDefault().createDialog(dd);
d.pack();
d.setVisible(true);
if (dd.getValue() == okButton) {
OQLSupport.OQLQueryNode node;
if (customizer.isNewQuery()) {
OQLSupport.Query q = new OQLSupport.Query(query,
customizer.getQueryName(),
customizer.getQueryDescription());
node = new OQLSupport.OQLQueryNode(q);
treeModel.customCategory().add(node);
treeModel.nodeStructureChanged(treeModel.customCategory());
} else {
node = (OQLSupport.OQLQueryNode)customizer.getSelectedValue();
node.getUserObject().setScript(query);
treeModel.nodeChanged(node);
}
tree.setSelectionPath(new TreePath(treeModel.getPathToRoot(node)));
return true;
} else {
return false;
}
}
示例8: showDescription
import java.awt.Dialog; //导入方法依赖的package包/类
public static void showDescription(Rule rule, String htmlDescription) {
Class ruleClass = rule.getClass();
URL ruleBase = ruleClass.getResource(ruleClass.getSimpleName() + ".class"); // NOI18N
final DialogDescriptor dd = new DialogDescriptor(new DescriptionDisplayer(ruleBase, htmlDescription),
rule.getDisplayName(), true,
new Object[] { DialogDescriptor.OK_OPTION },
DialogDescriptor.OK_OPTION, DialogDescriptor.BOTTOM_ALIGN, null, null);
final Dialog d = DialogDisplayer.getDefault().createDialog(dd);
d.pack(); // allows correct resizing of textarea in PreferredInstrFilterPanel
d.setVisible(true);
}
示例9: onManageClick
import java.awt.Dialog; //导入方法依赖的package包/类
private void onManageClick() {
final PropertiesPanel panel = new PropertiesPanel();
final PropertiesTable propTable;
propTable = new PropertiesTable(panel.labelForTable, PropertiesTable.PROPERTIES_COLUMNS, new String[] { PropertiesTableModel.COLUMN_NAME_VALUE});
panel.setPropertiesTable(propTable);
JComponent component = propTable.getComponent();
panel.propsPanel.setLayout(new BorderLayout());
panel.propsPanel.add(component, BorderLayout.CENTER);
HgExtProperties hgProperties = new HgExtProperties(panel, propTable, null) ;
final JButton okButton = new JButton(NbBundle.getMessage(MercurialOptionsPanelController.class, "CTL_Properties_Action_OK")); // NOI18N
okButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(MercurialOptionsPanelController.class, "CTL_Properties_Action_OK")); // NOI18N
final JButton cancelButton = new JButton(NbBundle.getMessage(MercurialOptionsPanelController.class, "CTL_Properties_Action_Cancel")); // NOI18N
cancelButton.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(MercurialOptionsPanelController.class, "CTL_Properties_Action_Cancel")); // NOI18N
DialogDescriptor dd = new DialogDescriptor(panel, NbBundle.getMessage(MercurialOptionsPanelController.class, "CTL_PropertiesDialog_Title", null), // NOI18N
true, new Object[] {okButton, cancelButton}, okButton, DialogDescriptor.DEFAULT_ALIGN, new HelpCtx(MercurialOptionsPanelController.class),
null);
panel.putClientProperty("contentTitle", null); // NOI18N
panel.putClientProperty("DialogDescriptor", dd); // NOI18N
Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
dialog.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(MercurialOptionsPanelController.class, "CTL_PropertiesDialog_Title")); // NOI18N
dialog.pack();
dialog.setVisible(true);
if (dd.getValue() == okButton) {
hgProperties.setProperties();
}
}
示例10: propertyChange
import java.awt.Dialog; //导入方法依赖的package包/类
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (ExplorerManager.PROP_SELECTED_NODES.equals(evt.getPropertyName())) {
Node[] nodes = (Node[]) evt.getNewValue();
if (nodes.length != 1) {
selectPlatform(null);
} else {
selectPlatform(nodes[0]);
Dialog dialog = (Dialog) SwingUtilities.getAncestorOfClass(Dialog.class, this);
if (dialog != null) {
dialog.pack();
}
}
}
}
示例11: main
import java.awt.Dialog; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
Robot robot = new Robot();
for(int i = 0; i < 10; i++) {
Dialog dialog = new Dialog((Frame) null);
dialog.setLocation(100, 100);
Component panel = new Panel();
panel.setPreferredSize(new Dimension(200, 100));
dialog.add(panel);
dialog.pack();
dialog.setVisible(true);
robot.waitForIdle();
robot.delay(200);
Point frameLoc = dialog.getLocationOnScreen();
Point contentLoc = panel.getLocationOnScreen();
System.out.println("Decor location " + frameLoc);
System.out.println("Content location " + contentLoc);
dialog.setResizable(false);
robot.waitForIdle();
robot.delay(200);
Point l = dialog.getLocationOnScreen();
if (!l.equals(frameLoc)) {
dialog.dispose();
throw new RuntimeException("Decorated frame location moved " +
"after setResizable(false)" + l);
}
l = panel.getLocationOnScreen();
if (!l.equals(contentLoc)) {
dialog.dispose();
throw new RuntimeException("Content location moved after " +
"setResizable(false)" + l);
}
if (panel.getLocationOnScreen().y <
dialog.getLocationOnScreen().y + dialog.getInsets().top) {
dialog.dispose();
throw new RuntimeException(
"Wrong content position after setResizable(false)");
}
dialog.setResizable(true);
robot.waitForIdle();
robot.delay(200);
l = dialog.getLocationOnScreen();
if (!l.equals(frameLoc)) {
dialog.dispose();
throw new RuntimeException("Decorated frame location moved " +
"after setResizable(true)" + l);
}
l = panel.getLocationOnScreen();
if (!l.equals(contentLoc)) {
dialog.dispose();
throw new RuntimeException("Content location moved after " +
"setResizable(true)" + l);
}
if (panel.getLocationOnScreen().y <
dialog.getLocationOnScreen().y + dialog.getInsets().top) {
dialog.dispose();
throw new RuntimeException(
"Wrong content position after setResizable(true)");
}
dialog.dispose();
}
}
示例12: btnAddTaskReferenceActionPerformed
import java.awt.Dialog; //导入方法依赖的package包/类
@NbBundle.Messages({
"CTL_SelectSubtask_ok=&Add Task",
"LBL_SelectSubtask_title=Select Task",
"MSG_SelectSubtask.error.alreadyreferenced=Selected task already referenced.",
"MSG_SelectSubtask.error.sametask=Cannot reference to the same task."
})
private void btnAddTaskReferenceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddTaskReferenceActionPerformed
referencesSection.setExpanded(true);
final JButton okButton = new JButton();
Mnemonics.setLocalizedText(okButton, Bundle.CTL_SelectSubtask_ok());
okButton.setEnabled(false);
final AddSubtaskPanel panel = new AddSubtaskPanel();
panel.addChangeListener(new ChangeListener() {
@Override
public void stateChanged (ChangeEvent e) {
boolean enabled = panel.getIssue() != null;
panel.errorLabel.setVisible(false);
if (enabled) {
String repoId = panel.getIssue().getRepository().getId();
String taskId = panel.getIssue().getID();
if (repoId.equals(LocalRepository.getInstance().getRepository().getId())
&& taskId.equals(task.getID())) {
panel.errorLabel.setText(Bundle.MSG_SelectSubtask_error_sametask());
panel.errorLabel.setVisible(true);
enabled = false;
} else {
for (TaskReference ref : task.getTaskReferences()) {
if (repoId.equals(ref.getRepositoryId()) && taskId.equals(ref.getTaskId())) {
panel.errorLabel.setText(Bundle.MSG_SelectSubtask_error_alreadyreferenced());
panel.errorLabel.setVisible(true);
enabled = false;
}
}
}
}
okButton.setEnabled(enabled);
}
});
DialogDescriptor dd = new DialogDescriptor(panel, Bundle.LBL_SelectSubtask_title(), true,
new Object[] { okButton, DialogDescriptor.CANCEL_OPTION }, okButton, DialogDescriptor.DEFAULT_ALIGN,
null, null);
Dialog dlg = DialogDisplayer.getDefault().createDialog(dd);
dlg.pack();
panel.errorLabel.setVisible(false);
dlg.setVisible(true);
Issue issue = panel.getIssue();
if (dd.getValue() == okButton && issue != null) {
unsavedFields.add(ATTRIBUTE_SUBTASKS);
updateFieldDecorations(ATTRIBUTE_SUBTASKS, referencesSection.getLabelComponent());
task.addTaskReference(issue);
refreshViewData();
}
}
示例13: performContextAction
import java.awt.Dialog; //导入方法依赖的package包/类
@Override
protected void performContextAction(Node[] nodes) {
VCSContext context = HgUtils.getCurrentContext(nodes);
final File roots[] = HgUtils.getActionRoots(context);
if (roots == null || roots.length == 0) return;
final File root = Mercurial.getInstance().getRepositoryRoot(roots[0]);
final PropertiesPanel panel = new PropertiesPanel();
final PropertiesTable propTable;
propTable = new PropertiesTable(panel.labelForTable, PropertiesTable.PROPERTIES_COLUMNS);
panel.setPropertiesTable(propTable);
JComponent component = propTable.getComponent();
panel.propsPanel.setLayout(new BorderLayout());
panel.propsPanel.add(component, BorderLayout.CENTER);
HgProperties hgProperties = new HgProperties(panel, propTable, root);
DialogDescriptor dd = new DialogDescriptor(panel, org.openide.util.NbBundle.getMessage(PropertiesAction.class, "CTL_PropertiesDialog_Title", null), true, null); // NOI18N
JButton okButton = new JButton();
org.openide.awt.Mnemonics.setLocalizedText(okButton, org.openide.util.NbBundle.getMessage(PropertiesAction.class, "CTL_Properties_Action_OK"));
okButton.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PropertiesAction.class, "ACSN_Properties_Action_OK")); // NOI18N
okButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PropertiesAction.class, "ACSD_Properties_Action_OK"));
JButton cancelButton = new JButton();
org.openide.awt.Mnemonics.setLocalizedText(cancelButton, org.openide.util.NbBundle.getMessage(PropertiesAction.class, "CTL_Properties_Action_Cancel"));
cancelButton.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(PropertiesAction.class, "ACSN_Properties_Action_Cancel")); // NOI18N
cancelButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PropertiesAction.class, "ACSD_Properties_Action_Cancel"));
dd.setOptions(new Object[] {okButton, cancelButton});
dd.setHelpCtx(new HelpCtx(PropertiesAction.class));
panel.putClientProperty("contentTitle", null); // NOI18N
panel.putClientProperty("DialogDescriptor", dd); // NOI18N
Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
dialog.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(PropertiesAction.class, "ACSD_Properties_Dialog")); // NOI18N
dialog.pack();
dialog.setVisible(true);
if (dd.getValue() == okButton) {
hgProperties.updateLastSelection();
hgProperties.setProperties();
}
}