@Override
  public void updateMinimumSize() {
    final Dimension min;
    if (getTarget().isMinimumSizeSet()) {
      min = getTarget().getMinimumSize();
      min.width = Math.max(min.width, MINIMUM_WIDTH);
      min.height = Math.max(min.height, MINIMUM_HEIGHT);
    } else {
      min = new Dimension(MINIMUM_WIDTH, MINIMUM_HEIGHT);
    }

    final int maxW, maxH;
    if (graphicsConfig instanceof TextureSizeConstraining) {
      maxW = ((TextureSizeConstraining) graphicsConfig).getMaxTextureWidth();
      maxH = ((TextureSizeConstraining) graphicsConfig).getMaxTextureHeight();
    } else {
      maxW = maxH = Integer.MAX_VALUE;
    }

    final Dimension max;
    if (getTarget().isMaximumSizeSet()) {
      max = getTarget().getMaximumSize();
      max.width = Math.min(max.width, maxW);
      max.height = Math.min(max.height, maxH);
    } else {
      max = new Dimension(maxW, maxH);
    }

    platformWindow.setSizeConstraints(min.width, min.height, max.width, max.height);
  }
 public Dimension getMinimumSize() {
   FontMetrics fm = getFontMetrics(target.getFont());
   Choice c = (Choice) target;
   int w = 0;
   for (int i = c.countItems(); i-- > 0; ) {
     w = Math.max(fm.stringWidth(c.getItem(i)), w);
   }
   return new Dimension(32 + w, Math.max(fm.getHeight() + 8, 15) + 5);
 }
Exemple #3
0
 public Dimension preferredSize(int v) {
   if (fm == null) {
     List li = (List) target;
     fm = getFontMetrics(li.getFont());
   }
   Dimension d = minimumSize(v);
   d.width = Math.max(d.width, getMaxWidth() + 20);
   return d;
 }
  @Override
  public void updateMinimumSize() {
    final Dimension min;
    if (getTarget().isMinimumSizeSet()) {
      min = getTarget().getMinimumSize();
      min.width = Math.max(min.width, MINIMUM_WIDTH);
      min.height = Math.max(min.height, MINIMUM_HEIGHT);
    } else {
      min = new Dimension(MINIMUM_WIDTH, MINIMUM_HEIGHT);
    }

    final Dimension max;
    if (getTarget().isMaximumSizeSet()) {
      max = getTarget().getMaximumSize();
      max.width = Math.min(max.width, getLWGC().getMaxTextureWidth());
      max.height = Math.min(max.height, getLWGC().getMaxTextureHeight());
    } else {
      max = new Dimension(getLWGC().getMaxTextureWidth(), getLWGC().getMaxTextureHeight());
    }

    platformWindow.setSizeConstraints(min.width, min.height, max.width, max.height);
  }