本文整理了Java中javax.swing.JDialog.setMinimumSize()
方法的一些代码示例,展示了JDialog.setMinimumSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JDialog.setMinimumSize()
方法的具体详情如下:
包路径:javax.swing.JDialog
类名称:JDialog
方法名:setMinimumSize
暂无
代码示例来源:origin: stackoverflow.com
final JDialog waitForTrans = new JDialog((JFrame) null, true);
SwingWorker worker = new SwingWorker() {
public String doInBackground() throws Exception {
Thread.sleep(5000);
return null;
}
public void done() {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
waitForTrans.setVisible(false);
waitForTrans.dispose();
}
});
}
};
worker.execute();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
waitForTrans.add(new JLabel("Please Wait..."));
waitForTrans.setMinimumSize(new Dimension(300, 100));
waitForTrans.setVisible(true);
}
});
代码示例来源:origin: MegaMek/mekhq
/**
* Set minimum size for the drop-down that will appear.
*
* @param size
* Minimum size of the drop-down list
*/
public void setMinimumSuggestSize(Dimension size) {
d.setMinimumSize(size);
}
代码示例来源:origin: datacleaner/DataCleaner
@Override
protected JDialog createDialog(final Component parent) throws HeadlessException {
final JDialog dialog = super.createDialog(parent);
dialog.setMinimumSize(new Dimension(400, 400));
return dialog;
}
代码示例来源:origin: org.cytoscape/vizmap-gui-impl
private void initComponents(final JDialog dialog) {
dialog.setLayout(new BorderLayout());
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.getContentPane().add(editorPanel, BorderLayout.CENTER);
dialog.setPreferredSize(DEF_SIZE);
dialog.setMinimumSize(MIN_SIZE);
dialog.pack();
}
});
代码示例来源:origin: senbox-org/snap-desktop
protected void initContent() {
final JPanel content = new JPanel();
content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));
final ButtonGroup group = new ButtonGroup();
for (String name : items.keySet()) {
final JToggleButton btn;
if (singleSelection) {
btn = new JRadioButton(name);
group.add(btn);
} else {
btn = new JCheckBox(name);
}
toggleList.add(btn);
content.add(btn);
btn.setSelected(items.get(name));
}
getJDialog().setMinimumSize(new Dimension(200, 100));
setContent(content);
}
代码示例来源:origin: stackoverflow.com
JDialog jDialog = new JDialog();
jDialog.setLayout(new GridBagLayout());
jDialog.add(new JLabel("Please wait..."));
jDialog.setMinimumSize(new Dimension(150, 50));
jDialog.setResizable(false);
jDialog.setModal(false);
jDialog.setUndecorated(true);
jDialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
jDialog.setLocationRelativeTo(null);
jDialog.setVisible(true);
代码示例来源:origin: GoldenGnu/jeveassets
public TreeSelectDialog(final Program program, final String title) {
super(program, title);
dialog = getDialog();
dialog.setResizable(true);
dialog.setMinimumSize(new Dimension(300, 400));
leafFilterLabel = new JLabel();
leafFilterTextField = new JTextField();
filterInfoLabel = new JLabel();
filterInfoResultLabel = new JLabel();
selectedLeafLabel = new JLabel();
selectedLeafValueLabel = new JLabel();
cancelButton = new JButton();
addButton = new JButton();
tree = new JTree();
treeScrollPane = new JScrollPane(tree);
layoutComponents();
}
代码示例来源:origin: jaltekruse/OpenNotebook
public void createProbelmDialog() {
if (problemDialog != null){
problemDialog.dispose();
}
problemDialog = new JDialog();
ProblemListPanel listPanel = new ProblemListPanel(this);
problemDialog.add(listPanel);
problemDialog.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
problemDialog.pack();
problemDialog.setMinimumSize(new Dimension(300, 450));
listPanel.adjustProblemList();
problemDialog.validate();
}
代码示例来源:origin: senbox-org/snap-desktop
public StringSelectorDialog(final String title, final String[] itemNames) {
super(SnapApp.getDefault().getMainFrame(), title, ModalDialog.ID_OK_CANCEL, null);
final JPanel content = new JPanel(new GridBagLayout());
final GridBagConstraints gbc = DialogUtils.createGridBagConstraints();
list = new JComboBox(itemNames);
list.setMinimumSize(new Dimension(50, 4));
content.add(list, gbc);
getJDialog().setMinimumSize(new Dimension(200, 100));
setContent(content);
}
代码示例来源:origin: senbox-org/s2tbx
private void insertMessageLabel() {
Container parent = getDefaultIOParametersPanel().getParent();
JScrollPane scrollPane = (JScrollPane) parent.getComponent(1);
JViewport viewport = (JViewport) scrollPane.getComponent(0);
JPanel initial = (JPanel) viewport.getComponent(0);
Dimension preferredSize = initial.getPreferredSize();
JPanel wrapper = new JPanel(new BorderLayout());
wrapper.add(initial, BorderLayout.NORTH);
wrapper.add(messagePanel, BorderLayout.SOUTH);
messagePanel.setVisible(false);
wrapper.setPreferredSize(preferredSize);
viewport.remove(initial);
viewport.add(wrapper);
final Dimension windowSize = this.getJDialog().getPreferredSize();
this.getJDialog().setMinimumSize(new Dimension(windowSize.width, windowSize.height + 30));
}
代码示例来源:origin: senbox-org/snap-desktop
public AttributeDialog(final String title, final String[] listData, final String defaultValue) {
super(SnapApp.getDefault().getMainFrame(), title, ModalDialog.ID_OK, null);
listControl = new JList<>(listData);
if(defaultValue != null) {
listControl.setSelectedValue(defaultValue, true);
}
final JPanel content = GridBagUtils.createPanel();
final GridBagConstraints gbc = DialogUtils.createGridBagConstraints();
gbc.insets.top = 2;
JScrollPane scrollPane = new JScrollPane();
scrollPane.setViewportView(listControl);
content.add(scrollPane, gbc);
getJDialog().setMinimumSize(new Dimension(400, 100));
setContent(content);
}
代码示例来源:origin: bcdev/beam
@Override
public int show() {
setButtonID(0);
final JDialog dialog = getJDialog();
if (!shown) {
dialog.pack();
center();
}
dialog.setMinimumSize(dialog.getSize());
dialog.setVisible(true);
shown = true;
return getButtonID();
}
代码示例来源:origin: triplea-game/triplea
/**
* Opens the settings Swing window.
*/
public void open() {
Preconditions.checkState(SwingUtilities.isEventDispatchThread());
if (dialog == null) {
dialog = GameRunner.newDialog("Settings");
dialog.setContentPane(newContentPane());
dialog.setMinimumSize(new Dimension(400, 50));
dialog.pack();
dialog.setLocationRelativeTo(dialog.getOwner());
dialog.setVisible(true);
SwingComponents.addWindowClosingListener(dialog, this::close);
SwingComponents.addEscapeKeyListener(dialog, this::close);
} else {
// window is already visible, bring it to the front
dialog.toFront();
}
}
代码示例来源:origin: ribomation/DroidAtScreen1
dlg.add(scaleSlider);
dlg.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
dlg.setMinimumSize(new Dimension(100, 200));
dlg.setSize(scaleSlider.getSize().width, labels.size() * lblHt + 2 * vMarg);
代码示例来源:origin: senbox-org/snap-desktop
protected void initContent() {
final JPanel content = new JPanel(new GridBagLayout());
final GridBagConstraints gbc = DialogUtils.createGridBagConstraints();
DialogUtils.addComponent(content, gbc, "Mission:", missionJList);
gbc.gridy++;
DialogUtils.addComponent(content, gbc, "Minus (days):", daysMinus).setToolTipText("0 or +ve integer");
gbc.gridy++;
DialogUtils.addComponent(content, gbc, "Plus (days):", daysPlus).setToolTipText("0 or +ve integer");
gbc.gridy++;
DialogUtils.addComponent(content, gbc, "Cloud Cover %:", cloudCoverField).setToolTipText("Specify single integer value or a range, e.g., 10-70");
gbc.gridy++;
DialogUtils.addComponent(content, gbc, "Acquisition Mode: ", acquisitionModeCombo);
gbc.gridy++;
DialogUtils.addComponent(content, gbc, "Product Type: ", new JScrollPane(productTypeJList));
DialogUtils.fillPanel(content, gbc);
getJDialog().setMinimumSize(new Dimension(250, 100));
setContent(content);
}
代码示例来源:origin: GoldenGnu/jeveassets
public void setVisible(final boolean b) {
if (b) {
LOG.info("Showing: {} Dialog", dialog.getTitle());
dialog.pack();
if (dialog.isResizable()) {
dialog.setMinimumSize(dialog.getSize());
}
//Get the parent size
Dimension screenSize = parent.getSize();
//Calculate the frame location
int x = (screenSize.width - dialog.getWidth()) / 2;
int y = (screenSize.height - dialog.getHeight()) / 2;
//Set the new frame location
dialog.setLocation(x, y);
dialog.setLocationRelativeTo(parent);
firstActivating = true;
firstFocus = true;
} else {
LOG.info("Hiding: {} Dialog", dialog.getTitle());
}
dialog.setVisible(b);
}
代码示例来源:origin: senbox-org/snap-desktop
public PromptDialog(final String title, final Descriptor[] descriptorList) {
super(SnapApp.getDefault().getMainFrame(), title, ModalDialog.ID_OK_CANCEL, null);
final JPanel content = GridBagUtils.createPanel();
final GridBagConstraints gbc = DialogUtils.createGridBagConstraints();
gbc.insets.right = 4;
gbc.insets.top = 2;
for(Descriptor descriptor : descriptorList) {
final JComponent prompt = addComponent(content, gbc, descriptor.label, descriptor.defaultValue, descriptor.type);
componentMap.put(descriptor.label, prompt);
gbc.gridy++;
}
getJDialog().setMinimumSize(new Dimension(400, 100));
setContent(content);
}
代码示例来源:origin: senbox-org/snap-desktop
private ToolAdaptersManagementDialog(AppContext appContext, String title, String helpID) {
super(appContext.getApplicationWindow(), title, 0, helpID);
this.appContext = appContext;
JPanel contentPanel = createContentPanel();
setContent(contentPanel);
super.getJDialog().setMinimumSize(contentPanel.getPreferredSize());
EscapeAction.register(super.getJDialog());
ToolAdapterRegistry.INSTANCE.addListener(new ToolAdapterListener() {
@Override
public void adapterAdded(ToolAdapterOperatorDescriptor operatorDescriptor) {
refreshContent();
}
@Override
public void adapterRemoved(ToolAdapterOperatorDescriptor operatorDescriptor) {
refreshContent();
}
@Override
public void adapterUpdated(ToolAdapterOperatorDescriptor operatorDescriptor) {
((OperatorsTableModel) operatorsTable.getModel()).fireTableDataChanged();
}
});
}
代码示例来源:origin: senbox-org/snap-desktop
private void initialize(ToolAdapterOperatorDescriptor descriptor) {
//this.operatorDescriptor = new ToolAdapterOperatorDescriptor(descriptor);
this.operatorDescriptor = descriptor;
//add paraeters of template parameters
artificiallyAddedParams = new ArrayList<>();
Arrays.stream(this.operatorDescriptor.getToolParameterDescriptors().toArray()).filter(p -> ((ToolParameterDescriptor)p).isTemplateParameter()).
forEach(p -> artificiallyAddedParams.addAll(((TemplateParameterDescriptor)p).getParameterDescriptors()));
this.operatorDescriptor.getToolParameterDescriptors().addAll(artificiallyAddedParams);
this.parameterSupport = new OperatorParameterSupport(this.operatorDescriptor);
Arrays.stream(this.operatorDescriptor.getToolParameterDescriptors().toArray()).
filter(p -> ToolAdapterConstants.FOLDER_PARAM_MASK.equals(((ToolParameterDescriptor)p).getParameterType())).
forEach(p -> parameterSupport.getPropertySet().getProperty(((ToolParameterDescriptor)p).getName()).getDescriptor().setAttribute("directory", true));
form = new ToolExecutionForm(appContext, this.operatorDescriptor, parameterSupport.getPropertySet(),
getTargetProductSelector());
OperatorMenu operatorMenu = new OperatorMenu(this.getJDialog(),
this.operatorDescriptor,
parameterSupport,
appContext,
descriptor.getHelpID() != null ? descriptor.getHelpID() : helpID);
getJDialog().setJMenuBar(operatorMenu.createDefaultMenu());
EscapeAction.register(getJDialog());
this.getJDialog().addWindowListener(new WindowAdapter() {
public void windowOpened(WindowEvent e) {form.refreshDimension();}
});
this.getJDialog().addComponentListener(new ComponentAdapter() {
public void componentResized(ComponentEvent e) {form.refreshDimension();}
});
this.getJDialog().setMinimumSize(new Dimension(250, 250));
}
代码示例来源:origin: senbox-org/snap-desktop
public BatchGraphDialog(final AppContext theAppContext, final String title, final String helpID,
final boolean closeOnDone) {
super(theAppContext.getApplicationWindow(), title, ID_YES | ID_APPLY_CLOSE_HELP, helpID);
this.appContext = theAppContext;
this.baseTitle = title;
this.closeOnDone = closeOnDone;
openProcessedProducts = true;
setContent(createUI());
if (getJDialog().getJMenuBar() == null) {
final GraphsMenu operatorMenu = new GraphsMenu(getJDialog(), this);
getJDialog().setJMenuBar(operatorMenu.createDefaultMenu());
}
super.getJDialog().setMinimumSize(new Dimension(400, 300));
}
内容来源于网络,如有侵权,请联系作者删除!