Package java.awt

Examples of java.awt.Dimension


  public String getToolTip() {
    return null;
  }
 
  public Dimension getDimension(Object orientation) {
    return new Dimension(size, size);
  }
View Full Code Here


    JPanel buttonPanel = new JPanel();
    buttonPanel.add(close);
    close.addActionListener(myListener);

    Container contents = getContentPane();
    tabbedPane.setPreferredSize(new Dimension(450, 300));
    contents.add(tabbedPane, BorderLayout.CENTER);
    contents.add(buttonPanel, BorderLayout.SOUTH);
   
    if (intlIndex >= 0) tabbedPane.setSelectedIndex(intlIndex);
View Full Code Here

    return item;
  }

  @Override
  public Dimension getPreferredSize() {
    Dimension dim = item.getDimension(toolbar.getOrientation());
    dim.width += 2 * BORDER;
    dim.height += 2 * BORDER;
    return dim;
  }
View Full Code Here

  }
 
  @Override
  public void paintComponent(Graphics g) {
    if (toolbar.getPressed() == this) {
      Dimension dim = item.getDimension(toolbar.getOrientation());
      Color defaultColor = g.getColor();
      GraphicsUtil.switchToWidth(g, 2);
      g.setColor(Color.GRAY);
      g.fillRect(BORDER, BORDER, dim.width, dim.height);
      GraphicsUtil.switchToWidth(g, 1);
      g.setColor(defaultColor);
    }

    Graphics g2 = g.create();
    g2.translate(BORDER, BORDER);
    item.paintIcon(ToolbarButton.this, g2);
    g2.dispose();

    // draw selection indicator
    if (toolbar.getToolbarModel().isSelected(item)) {
      Dimension dim = item.getDimension(toolbar.getOrientation());
      GraphicsUtil.switchToWidth(g, 2);
      g.setColor(Color.BLACK);
      g.drawRect(BORDER, BORDER, dim.width, dim.height);
      GraphicsUtil.switchToWidth(g, 1);
    }
View Full Code Here

    field.setText(initialValue);
    JLabel error = new JLabel(" ");
    GridBagLayout gb = new GridBagLayout();
    GridBagConstraints gc = new GridBagConstraints();
    JPanel strut = new JPanel(null);
    strut.setPreferredSize(new Dimension(3 * field.getPreferredSize().width / 2, 0));
    JPanel panel = new JPanel(gb);
    gc.gridx = 0;
    gc.gridy = GridBagConstraints.RELATIVE;
    gc.weightx = 1.0;
    gc.fill = GridBagConstraints.NONE;
View Full Code Here

    public Dimension preferredLayoutSize(Container parent) {
      if (fraction <= 0.0) return comp1.getPreferredSize();
      if (fraction >= 1.0) return comp0.getPreferredSize();
      Insets in = parent.getInsets();
      Dimension d0 = comp0.getPreferredSize();
      Dimension d1 = comp1.getPreferredSize();
      return new Dimension(in.left + Math.max(d0.width, d1.width) + in.right,
          in.top + d0.height + d1.height + in.bottom);
    }
View Full Code Here

    public Dimension minimumLayoutSize(Container parent) {
      if (fraction <= 0.0) return comp1.getMinimumSize();
      if (fraction >= 1.0) return comp0.getMinimumSize();
      Insets in = parent.getInsets();
      Dimension d0 = comp0.getMinimumSize();
      Dimension d1 = comp1.getMinimumSize();
      return new Dimension(in.left + Math.max(d0.width, d1.width) + in.right,
          in.top + d0.height + d1.height + in.bottom);
    }
View Full Code Here

      slider.setMajorTickSpacing(10);
      slider.addChangeListener(this);
      curScale = new JLabel("222%");
      curScale.setHorizontalAlignment(SwingConstants.RIGHT);
      curScale.setVerticalAlignment(SwingConstants.CENTER);
      curScaleDim = new Dimension(curScale.getPreferredSize());
      curScaleDim.height = Math.max(curScaleDim.height,
          slider.getPreferredSize().height);
      stateChanged(null);

      printerView = new JCheckBox();
View Full Code Here

    } else {
      bounds = circState.getCircuit().getAppearance().getAbsoluteBounds();
    }
    int width = bounds.getX() + bounds.getWidth() + BOUNDS_BUFFER;
    int height = bounds.getY() + bounds.getHeight() + BOUNDS_BUFFER;
    Dimension dim;
    if (canvasPane == null) {
      dim = new Dimension(width, height);
    } else {
      dim = canvasPane.supportPreferredSize(width, height);
    }
    if (!immediate) {
      Bounds old = oldPreferredSize;
View Full Code Here

    }
  }
 
  public Dimension getDimension(Object orientation) {
    if (icon == null) {
      return new Dimension(16, 16);
    } else {
      int w = icon.getIconWidth();
      int h = icon.getIconHeight();
      return new Dimension(w, h + 2);
    }
  }
View Full Code Here

TOP

Related Classes of java.awt.Dimension

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.