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

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

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

JComponent.getMaximumSize介绍

暂无

代码示例

代码示例来源: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: org.bidib.jbidib.eu.hansolo/SteelSeries

@Override
public Dimension getMaximumSize() {
  Dimension dim = super.getMaximumSize();
  if (dim.width > 1920 || dim.height > 720) {
    dim = new Dimension(1920, 720);
  }
  return dim;
}

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

@Override
public Dimension getMaximumSize() {
  Dimension dim = super.getMaximumSize();
  if (dim.width > 1920 || dim.height > 864) {
    dim = new Dimension(1920, 864);
  }
  return dim;
}

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

@Override
public Dimension getMaximumSize() {
  Dimension dim = super.getMaximumSize();
  if (dim.width > 1920 || dim.height > 864) {
    dim = new Dimension(1920, 864);
  }
  return dim;
}

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

@Override
public Dimension getMaximumSize() {
  Dimension dim = super.getMaximumSize();
  if (dim.width > 1920 || dim.height > 720) {
    dim = new Dimension(1920, 720);
  }
  return dim;
}

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

@Override
public Dimension getMaximumSize() {
  Dimension dim = super.getMaximumSize();
  if (dim.width > 1080 || dim.height > 1080) {
    dim = new Dimension(1080, 1080);
  }
  return dim;
}

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

@Override
public Dimension getMaximumSize() {
  Dimension dim = super.getMaximumSize();
  if (dim.width > 1920 || dim.height > 720) {
    dim = new Dimension(1920, 720);
  }
  return dim;
}

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

@Override
public Dimension getMaximumSize() {
  Dimension dim = super.getMaximumSize();
  if (dim.width > 1080 || dim.height > 1080) {
    dim = new Dimension(1080, 1080);
  }
  return dim;
}

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

@Override
public Dimension getMaximumSize() {
  Dimension dim = super.getMaximumSize();
  if (dim.width > 1080 || dim.height > 1080) {
    dim = new Dimension(1080, 1080);
  }
  return dim;
}

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

@Override
public Dimension getMaximumSize() {
  Dimension dim = super.getMaximumSize();
  if (dim.width > 1920 || dim.height > 960) {
    dim = new Dimension(1920, 960);
  }
  return dim;
}

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

@Override
public Dimension getMaximumSize() {
  Dimension dim = super.getMaximumSize();
  if (dim.width > 1920 || dim.height > 960) {
    dim = new Dimension(1920, 960);
  }
  return dim;
}

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

@Override
public Dimension getMaximumSize() {
  Dimension dim = super.getMaximumSize();
  if (dim.width > 1920 || dim.height > 720) {
    dim = new Dimension(1920, 720);
  }
  return dim;
}

代码示例来源:origin: openmicroscopy/bioformats

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

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

JPanel panel = new JPanel();
  panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));

  for ( int i = 0; i < 5; i++ ) {
    JComponent comp = new JPanel();
//      JComponent comp = new JButton("Button " + i);
    System.out.printf("Pref: %s Max: %s%n", comp.getPreferredSize(), comp.getMaximumSize());
    comp.setBackground(new Color(100 + i * 30, 0, 0));
    panel.add(comp);
  }

代码示例来源:origin: girtel/Net2Plan

private static void setMaxSize(JComponent c)
{
  final Dimension max = c.getMaximumSize();
  final Dimension pref = c.getPreferredSize();
  max.height = pref.height;
  c.setMaximumSize(max);
}

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

private int getEffectiveWidth() {
  final int w = super.getWidth();
  final int maxW = (int) super.getMaximumSize().getWidth();
  final int minW = (int) super.getMinimumSize().getWidth();
  if (w > maxW)
    return maxW;
  else if (w < minW)
    return minW;
  else
    return w;
}

代码示例来源:origin: xyz.cofe/docking-frames-core

@Override
public Dimension getMaximumSize() {
  if( contentPane == null ){
    return super.getMaximumSize();
  }
  return contentPane.getMaximumSize();
}
@Override

代码示例来源: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: org.netbeans.api/org-netbeans-modules-editor-deprecated-pre61completion

/** Returns the maximum size of this component. Maximum size is computed from
 *  javadoc's and completion's maximum size */
public Dimension getMaximumSize(){
  Dimension compDim = completion.getComponent().getMaximumSize();
  Dimension javadocDim = new Dimension();
  if (javadoc != null) {
    javadocDim = javadoc.getComponent().getMaximumSize();
  }
  return new Dimension(Math.max(compDim.width,javadocDim.width), compDim.height+javadocDim.height);
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib

/** Returns the maximum size of this component. Maximum size is computed from
 *  javadoc's and completion's maximum size */
public Dimension getMaximumSize(){
  Dimension compDim = completion.getComponent().getMaximumSize();
  Dimension javadocDim = new Dimension();
  if (javadoc != null) {
    javadocDim = javadoc.getComponent().getMaximumSize();
  }
  return new Dimension(Math.max(compDim.width,javadocDim.width), compDim.height+javadocDim.height);
}

相关文章

JComponent类方法