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

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

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

JComponent.setMaximumSize介绍

暂无

代码示例

代码示例来源:origin: ballerina-platform/ballerina-lang

/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL
 */
private void $$$setupUI$$$() {
  rootPanel = new JPanel();
  rootPanel.setLayout(new GridLayoutManager(2, 3, new Insets(0, 0, 0, 0), -1, -1));
  repositoriesLabel = new JLabel();
  repositoriesLabel.setText("Additional repositories");
  rootPanel.add(repositoriesLabel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
  final Spacer spacer1 = new Spacer();
  rootPanel.add(spacer1, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
  final Spacer spacer2 = new Spacer();
  rootPanel.add(spacer2, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
  final JScrollPane scrollPane1 = new JScrollPane();
  rootPanel.add(scrollPane1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
  repositoriesTextArea = new JTextArea();
  repositoriesTextArea.setMaximumSize(new Dimension(420, 2147483647));
  repositoriesTextArea.setMinimumSize(new Dimension(300, 10));
  repositoriesTextArea.setPreferredSize(new Dimension(300, 50));
  repositoriesTextArea.setText(ResourceBundle.getBundle("com/github/gtache/lsp/LSPBundle").getString("coursier.settings.textarea.basetext"));
  repositoriesTextArea.setToolTipText("Insert one resolver by line");
  scrollPane1.setViewportView(repositoriesTextArea);
}

代码示例来源:origin: camunda/camunda-bpm-platform

protected JComboBox createLogLevelCombo() {
 JComboBox result = new JComboBox();
 Iterator levels = getLogLevels();
 while (levels.hasNext()) {
  result.addItem(levels.next());
 }
 result.setSelectedItem(_leastSevereDisplayedLogLevel);
 result.addActionListener(new ActionListener() {
  public void actionPerformed(ActionEvent e) {
   JComboBox box = (JComboBox) e.getSource();
   LogLevel level = (LogLevel) box.getSelectedItem();
   setLeastSevereDisplayedLogLevel(level);
  }
 });
 result.setMaximumSize(result.getPreferredSize());
 return result;
}

代码示例来源: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: stackoverflow.com

button.setMaximumSize(new Dimension(Integer.MAX_VALUE, button.getMinimumSize().height));
add(button);
button.setMaximumSize(new Dimension(Integer.MAX_VALUE, button.getMinimumSize().height));
add(button);
button.setMaximumSize(new Dimension(Integer.MAX_VALUE, button.getMinimumSize().height));
add(button);
label.setMaximumSize(new Dimension(Integer.MAX_VALUE, label.getMinimumSize().height));
add(label);
textField.setMaximumSize(new Dimension(Integer.MAX_VALUE, textField.getMinimumSize().height));
add(textField);
button.setMaximumSize(new Dimension(Integer.MAX_VALUE, button.getMinimumSize().height));
add(button);

代码示例来源:origin: camunda/camunda-bpm-platform

newButton.setAlignmentX(0.5f);
fontCombo.setMaximumSize(fontCombo.getPreferredSize());
fontSizeCombo.setMaximumSize(
  fontSizeCombo.getPreferredSize());

代码示例来源:origin: edu.toronto.cs.medsavant/medsavant-client

public static void fixSize(JComponent c, Dimension d) {
  c.setMaximumSize(d);
  c.setPreferredSize(d);
  c.setMaximumSize(d);
  c.revalidate();
}

代码示例来源:origin: ome/formats-bsd

private void limitHeight(JComponent jc) {
 int w = jc.getMaximumSize().width;
 int h = jc.getPreferredSize().height;
 jc.setMaximumSize(new Dimension(w, h));
}

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

public class CenteringPanel {
  public CenteringPanel(JComponent child) {
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    GridBagConstraints c = new GridBagConstraints();
    child.setMaximumSize(child.getPreferredSize());
    child.setAlignmentX(Component.CENTER_ALIGNMENT);
    add(Box.createVerticalGlue());
    add(child);
    add(Box.createVerticalGlue());
  }
}

代码示例来源:origin: org.cytoscape/work-swing-impl

public RoundedProgressBar() {
  final int h = (int) Math.ceil(HEIGHT);
  super.setMinimumSize(new Dimension(50, h));
  super.setMaximumSize(new Dimension(10000, h));
  super.setPreferredSize(new Dimension(250, h));
}

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

public void doLayout()
{
 //synchronized (getTreeLock())
 {
  final Component[] c=getComponents();
  for(int i=0;i<c.length;i++)
   if(c[i] instanceof JComponent)
    ((JComponent)c[i]).setMaximumSize(c[i].getPreferredSize());
 }
 super.doLayout();
}

代码示例来源:origin: nativelibs4java/JavaCL

private void detailsButtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_detailsButtActionPerformed
  CLPlatform platform = (CLPlatform)platformCombo.getSelectedItem();
  if (platform != null) {
    JComponent c = HardwareReport.getHardwareReportComponent(platform);
    c.setMaximumSize(new Dimension(600, 600));
    c.setPreferredSize(new Dimension(600, 600));
    JOptionPane.showMessageDialog(this, c, "HardwareReport for platform '" + platform.getName() + "'", JOptionPane.INFORMATION_MESSAGE);
  }
}//GEN-LAST:event_detailsButtActionPerformed

代码示例来源:origin: robo-code/robocode

public static void setFixedSize(JComponent component, Dimension size) {
  component.setPreferredSize(size);
  component.setMinimumSize(size);
  component.setMaximumSize(size);
}

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@ScriptFunction(jsDoc = REMOVE_JSDOC, params = {"component"})
@Override
public void remove(JComponent aComp) {
  if (aComp != null) {
    aComp.removePropertyChangeListener(resizer);
    aComp.setMaximumSize(null);
    aComp.setPreferredSize(null);
  }
  super.remove(aComp);
}

代码示例来源:origin: eu.mihosoft.vrl/vrl

@Override
  public void frameStarted(double time) {

    int x = (int) resizeX.getValue();
    int y = (int) resizeY.getValue();

//        System.out.println("SIZE: x=" + x + ", y=" + y);

    component.setPreferredSize(new Dimension(x, y));
    component.setMinimumSize(new Dimension(x, y));
    component.setMaximumSize(new Dimension(x, y));
    component.setSize(new Dimension(x, y)); // TODO do we need this?
    component.revalidate();
  }
}

代码示例来源:origin: org.bidib.jbidib.eu.hansolo/SteelSeries

@Override
public void setMaximumSize(final Dimension DIM) {
  int width = DIM.width > 1920 ? 1920 : DIM.width;
  int height = DIM.height > 864 ? 864 : DIM.height;
  super.setMaximumSize(new Dimension(width, height));
  calcInnerBounds();
  init(INNER_BOUNDS.width, (int) (0.45 * INNER_BOUNDS.width));
  invalidate();
  repaint();
}

代码示例来源:origin: org.bidib.jbidib.eu.hansolo/SteelSeries

@Override
public void setMaximumSize(final Dimension DIM) {
  int  width = DIM.width > 1080 ? 1080 : DIM.width;
  int height = DIM.height > 1080 ? 1080 : DIM.height;
  final int SIZE = width <= height ? width : height;
  super.setMaximumSize(new Dimension(SIZE, SIZE));
  calcInnerBounds();
  init(INNER_BOUNDS.width);
  initialized = true;
  invalidate();
  repaint();
}

代码示例来源:origin: org.bidib.jbidib.eu.hansolo/SteelSeries

@Override
public void setMaximumSize(final Dimension DIM) {
  int  width = DIM.width > 1080 ? 1080 : DIM.width;
  int height = DIM.height > 1080 ? 1080 : DIM.height;
  final int SIZE = width <= height ? width : height;
  super.setMaximumSize(new Dimension(SIZE, SIZE));
  calcInnerBounds();
  init(INNER_BOUNDS.width, INNER_BOUNDS.height);
  invalidate();
  repaint();
}

代码示例来源:origin: HanSolo/SteelSeries-Swing

@Override
public void setMaximumSize(final Dimension DIM) {
  int width = DIM.width > 1920 ? 1920 : DIM.width;
  int height = DIM.height > 864 ? 864 : DIM.height;
  super.setMaximumSize(new Dimension(width, height));
  calcInnerBounds();
  init(INNER_BOUNDS.width, (int) (0.45 * INNER_BOUNDS.width));
  invalidate();
  repaint();
}

代码示例来源:origin: HanSolo/SteelSeries-Swing

@Override
public void setMaximumSize(final Dimension DIM) {
  int width = DIM.width > 1920 ? 1920 : DIM.width;
  int height = DIM.height > 960 ? 960 : DIM.height;
  super.setMaximumSize(new Dimension(width, height));
  calcInnerBounds();
  init(getInnerBounds().width, getInnerBounds().height);
  invalidate();
  repaint();
}

代码示例来源:origin: org.bidib.jbidib.eu.hansolo/SteelSeries

@Override
public void setMaximumSize(final Dimension DIM) {
  int width = DIM.width > 1920 ? 1920 : DIM.width;
  int height = DIM.height > 960 ? 960 : DIM.height;
  super.setMaximumSize(new Dimension(width, height));
  calcInnerBounds();
  init(getInnerBounds().width, getInnerBounds().height);
  invalidate();
  repaint();
}

相关文章

JComponent类方法