javax.swing.JButton.setMaximumSize()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(10.0k)|赞(0)|评价(0)|浏览(143)

本文整理了Java中javax.swing.JButton.setMaximumSize()方法的一些代码示例,展示了JButton.setMaximumSize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JButton.setMaximumSize()方法的具体详情如下:
包路径:javax.swing.JButton
类名称:JButton
方法名:setMaximumSize

JButton.setMaximumSize介绍

暂无

代码示例

代码示例来源:origin: runelite/runelite

/**
 * Creates an empty JButton to be used as the scroll bar's arrows (to disable the arrows).
 */
protected JButton createEmptyButton()
{
  JButton button = new JButton();
  Dimension zeroDim = new Dimension(0, 0);
  button.setPreferredSize(zeroDim);
  button.setMinimumSize(zeroDim);
  button.setMaximumSize(zeroDim);
  return button;
}

代码示例来源:origin: marytts/marytts

jButton_Record.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jButton_Record.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
jButton_Record.setMaximumSize(new java.awt.Dimension(95, 25));
jButton_Record.setMinimumSize(new java.awt.Dimension(95, 25));
jButton_Record.setPreferredSize(new java.awt.Dimension(95, 25));
jButton_Play.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jButton_Play.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
jButton_Play.setMaximumSize(new java.awt.Dimension(95, 25));
jButton_Play.setMinimumSize(new java.awt.Dimension(95, 25));
jButton_Play.setPreferredSize(new java.awt.Dimension(95, 25));

代码示例来源:origin: marytts/marytts

jButton_Record.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jButton_Record.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
jButton_Record.setMaximumSize(new java.awt.Dimension(95, 25));
jButton_Record.setMinimumSize(new java.awt.Dimension(95, 25));
jButton_Record.setPreferredSize(new java.awt.Dimension(95, 25));
jButton_Play.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
jButton_Play.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
jButton_Play.setMaximumSize(new java.awt.Dimension(95, 25));
jButton_Play.setMinimumSize(new java.awt.Dimension(95, 25));
jButton_Play.setPreferredSize(new java.awt.Dimension(95, 25));

代码示例来源:origin: magefree/mage

private void setGUISize() {
  Font font = GUISizeHelper.gameRequestsFont;
  lblText.setFont(font);
  lblText.setMaximumSize(new Dimension(300 + font.getSize() * 15, 20 + font.getSize() * 5));
  lblText.setMinimumSize(new Dimension(300 + font.getSize() * 15, 20 + font.getSize() * 5));
  lblText.setPreferredSize(new Dimension(300 + font.getSize() * 15, 20 + font.getSize() * 5));
  btn1.setFont(font);
  btn1.setMinimumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
  btn1.setMaximumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
  btn1.setPreferredSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
  btn2.setFont(font);
  btn2.setMinimumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
  btn2.setMaximumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
  btn2.setPreferredSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
  btn3.setFont(font);
  btn3.setMinimumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
  btn3.setMaximumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
  btn3.setPreferredSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
  JComponent c = ((BasicInternalFrameUI) this.getUI()).getNorthPane();
  c.setMinimumSize(new Dimension(c.getMinimumSize().width, font.getSize() + 10));
  c.setMaximumSize(new Dimension(c.getMaximumSize().width, font.getSize() + 10));
  c.setPreferredSize(new Dimension(c.getPreferredSize().width, font.getSize() + 10));
  c.setFont(font);
}

代码示例来源:origin: magefree/mage

btn3.setMaximumSize(new java.awt.Dimension(150, 50));
btn3.setMinimumSize(new java.awt.Dimension(75, 25));
btn3.setPreferredSize(new java.awt.Dimension(150, 50));
btn2.setMaximumSize(new java.awt.Dimension(150, 50));
btn2.setMinimumSize(new java.awt.Dimension(75, 25));
btn2.setPreferredSize(new java.awt.Dimension(150, 50));
btn1.setMaximumSize(new java.awt.Dimension(150, 50));
btn1.setMinimumSize(new java.awt.Dimension(75, 25));
btn1.setPreferredSize(new java.awt.Dimension(150, 50));

代码示例来源:origin: magefree/mage

searchButton.setMinimumSize(new java.awt.Dimension(24, 24));
searchButton.setPreferredSize(new java.awt.Dimension(32, 32));
searchButton.setMaximumSize(new java.awt.Dimension(32, 32));
searchButton.addActionListener(new java.awt.event.ActionListener() {
  public void actionPerformed(java.awt.event.ActionEvent evt) {

代码示例来源:origin: magefree/mage

btnFindMain.setAlignmentY(0.0F);
btnFindMain.setMargin(new java.awt.Insets(2, 2, 2, 2));
btnFindMain.setMaximumSize(new java.awt.Dimension(42, 23));
btnFindMain.setMinimumSize(new java.awt.Dimension(42, 23));
btnFindMain.setName("connectXmageDeBtn"); // NOI18N

代码示例来源:origin: magefree/mage

btnSetFastSearch.setMinimumSize(new java.awt.Dimension(24, 24));
btnSetFastSearch.setPreferredSize(new java.awt.Dimension(32, 32));
btnSetFastSearch.setMaximumSize(new java.awt.Dimension(32, 32));
btnSetFastSearch.addActionListener(new java.awt.event.ActionListener() {
  @Override

代码示例来源:origin: magefree/mage

jButtonAddToMain.setToolTipText("<html>Add selected cards to deck.<br/>\nAlternative: <strong>Double click</strong> the card in card selector to move a card to the deck.");
jButtonAddToMain.setMargin(null);
jButtonAddToMain.setMaximumSize(new java.awt.Dimension(35, 23));
jButtonAddToMain.setMinimumSize(new java.awt.Dimension(35, 23));
jButtonAddToMain.setPreferredSize(new java.awt.Dimension(30, 28));
jButtonRemoveFromMain.setToolTipText("Remove selected cards from deck");
jButtonRemoveFromMain.setMargin(null);
jButtonRemoveFromMain.setMaximumSize(new java.awt.Dimension(42, 23));
jButtonRemoveFromMain.setMinimumSize(new java.awt.Dimension(42, 23));
jButtonRemoveFromMain.setPreferredSize(new java.awt.Dimension(30, 28));
jButtonAddToSideboard.setToolTipText("<html>Add selected cards to sideboard.<br/>\nAlternative: <strong>ALT key + Double click</strong> the card in card selector to move a card to the sideboard.");
jButtonAddToSideboard.setMargin(new java.awt.Insets(2, 0, 2, 0));
jButtonAddToSideboard.setMaximumSize(new java.awt.Dimension(100, 30));
jButtonAddToSideboard.setMinimumSize(new java.awt.Dimension(10, 30));
jButtonAddToSideboard.setPreferredSize(new java.awt.Dimension(30, 28));
jButtonRemoveFromSideboard.setToolTipText("Remove selected cards from sideboard.");
jButtonRemoveFromSideboard.setMargin(new java.awt.Insets(2, 0, 2, 0));
jButtonRemoveFromSideboard.setMaximumSize(new java.awt.Dimension(10, 30));
jButtonRemoveFromSideboard.setMinimumSize(new java.awt.Dimension(100, 30));
jButtonRemoveFromSideboard.setPreferredSize(new java.awt.Dimension(30, 28));

代码示例来源:origin: org.netbeans.api/org-openide-awt

int w = getOrientation() == HORIZONTAL ? overflowButton.getIcon().getIconWidth() + 4 : getWidth() - getInsets().left - getInsets().right;
int h = getOrientation() == HORIZONTAL ? getHeight() - getInsets().top - getInsets().bottom : overflowButton.getIcon().getIconHeight() + 4;
overflowButton.setMaximumSize(new Dimension(w, h));
overflowButton.setMinimumSize(new Dimension(w, h));
overflowButton.setPreferredSize(new Dimension(w, h));

代码示例来源:origin: winder/Universal-G-Code-Sender

saveButton.setMaximumSize(new java.awt.Dimension(88, 29));
saveButton.setMinimumSize(new java.awt.Dimension(88, 29));
saveButton.addActionListener(new java.awt.event.ActionListener() {

代码示例来源:origin: magefree/mage

saveButton.setMaximumSize(new java.awt.Dimension(100, 30));
saveButton.setMinimumSize(new java.awt.Dimension(100, 30));
saveButton.setPreferredSize(new java.awt.Dimension(100, 30));
exitButton.setMaximumSize(new java.awt.Dimension(100, 30));
exitButton.setMinimumSize(new java.awt.Dimension(100, 30));
exitButton.setPreferredSize(new java.awt.Dimension(100, 30));

代码示例来源:origin: protegeproject/protege

private JButton createZeroSizeButton() {
    JButton button = new JButton();
    button.setMaximumSize(new Dimension(0, 0));
    button.setPreferredSize(new Dimension(0, 0));
    button.setMinimumSize(new Dimension(0, 0));
    return button;
  }
}

代码示例来源:origin: stackoverflow.com

example.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
JButton findNext = new JButton("Find Next");
JButton cancel = new JButton("Cancel");
Dimension d = findNext.getMaximumSize();
cancel.setMaximumSize(new Dimension(d));
example.add(findNext);
example.add(cancel);

代码示例来源:origin: apache/felix

public MyButton(char c, String name, BundlesProbesTabUI listener, JPanel panel) {
  super.setText(name);
  super.setMnemonic(c);
  super.setMinimumSize(new Dimension(W, H));
  super.setPreferredSize(new Dimension(W, H));
  super.setMaximumSize(new Dimension(W, H));
  super.addActionListener(listener);
  panel.add(this);
 }
}

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui

public JButton getButton() {
 if (jb == null) {
  jb = new JButton(ScrollPaneSelector.LAUNCH_SELECTOR_ICON);
  jb.setFocusable(false);
  jb.setPreferredSize(new Dimension(16, 16));
  jb.setMaximumSize(jb.getPreferredSize());
  jb.addActionListener(createActionActionListener());
 }
 return jb;
}

代码示例来源:origin: datacleaner/DataCleaner

private JButton createChangeButton() {
  final JButton changeButton = new JButton("Select");
  changeButton.addActionListener(e -> _settingDialog.setVisible(true));
  final Dimension buttonSize = new Dimension(100, 25);
  changeButton.setMinimumSize(buttonSize);
  changeButton.setPreferredSize(buttonSize);
  changeButton.setMaximumSize(buttonSize);
  return changeButton;
}

代码示例来源:origin: net.java.abeille/abeille

/**
 * Creates a button for the toolbar
 */
private Component _createButton(String imageName, String cmdId) {
  JButton btn = new JButton(FormDesignerUtils.loadImage(imageName));
  btn.setActionCommand(cmdId);
  btn.setName(cmdId);
  Dimension d = new Dimension(24, 24);
  btn.setPreferredSize(d);
  btn.setMaximumSize(d);
  return btn;
}

代码示例来源:origin: freeplane/freeplane

private JButton createButton(final String key, final CloseAction closeAction) {
  final JButton button = new JButton();
  LabelAndMnemonicSetter.setLabelAndMnemonic(button, TextUtils.getRawText(key));
  button.addActionListener(closeAction);
  button.setMaximumSize(new Dimension(1000, 1000));
  return button;
}

代码示例来源:origin: freeplane/freeplane

private JButton addAction(AFreeplaneAction action, boolean enabled) {
  JButton button = TranslatedElementFactory.createButtonWithIcon(action, action.getIconKey(), action.getTextKey());
  button.setMaximumSize(UITools.MAX_BUTTON_DIMENSION);
  conditionButtonBox.add(Box.createVerticalStrut(GAP_BETWEEN_BUTTONS));
  conditionButtonBox.add(button);
  if(! enabled)
    button.setEnabled(false);
  return button;
}

相关文章

JButton类方法