javax.swing.JComboBox.getWidth()方法的使用及代码示例

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

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

JComboBox.getWidth介绍

暂无

代码示例

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/skinlf

/**
 * Description of the Method
 *
 * @return   Description of the Returned Value
 */
protected Rectangle rectangleForCurrentValue() {
 int width = comboBox.getWidth();
 int height = comboBox.getHeight();
 Insets insets = getInsets();
 return new Rectangle(insets.left, insets.top,
            width - (insets.left + insets.right),
            height - (insets.top + insets.bottom));
}

代码示例来源:origin: com.github.insubstantial/substance

@Override
protected Rectangle rectangleForCurrentValue() {
  int width = this.comboBox.getWidth();
  int height = this.comboBox.getHeight();
  Insets insets = this.layoutInsets;
  int buttonWidth = SubstanceSizeUtils
      .getScrollBarWidth(SubstanceSizeUtils
          .getComponentFontSize(comboBox));
  if (this.comboBox.getComponentOrientation().isLeftToRight()) {
    return new Rectangle(insets.left, insets.top, width - insets.left
        - insets.right - buttonWidth, height - insets.top
        - insets.bottom);
  } else {
    int startX = insets.left + buttonWidth;
    return new Rectangle(startX, insets.top, width - startX
        - insets.right, height - insets.top - insets.bottom);
  }
}

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

@Override
protected Rectangle rectangleForCurrentValue() {
  int width = this.comboBox.getWidth();
  int height = this.comboBox.getHeight();
  Insets insets = this.layoutInsets;
  int buttonWidth = SubstanceSizeUtils
      .getScrollBarWidth(SubstanceSizeUtils
          .getComponentFontSize(comboBox));
  if (this.comboBox.getComponentOrientation().isLeftToRight()) {
    return new Rectangle(insets.left, insets.top, width - insets.left
        - insets.right - buttonWidth, height - insets.top
        - insets.bottom);
  } else {
    int startX = insets.left + buttonWidth;
    return new Rectangle(startX, insets.top, width - startX
        - insets.right, height - insets.top - insets.bottom);
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

/**
 * Returns the area that is reserved for drawing the currently selected item.
 */
protected Rectangle rectangleForCurrentValue()
{
  int width= comboBox.getWidth();
  int height= comboBox.getHeight();
  Insets insets= getInsets();
  int buttonSize= height - (insets.top + insets.bottom);
  if (arrowButton != null)
  {
    buttonSize= arrowButton.getWidth();
  }
  if (isLeftToRight(comboBox))
  {
    return new Rectangle(
      insets.left,
      insets.top,
      width - (insets.left + insets.right + buttonSize),
      height - (insets.top + insets.bottom));
  }
  else
  {
    return new Rectangle(
      insets.left + buttonSize,
      insets.top,
      width - (insets.left + insets.right + buttonSize),
      height - (insets.top + insets.bottom));
  }
}

代码示例来源:origin: com.github.arnabk/pgslookandfeel

protected Rectangle rectangleForCurrentValue() {
  int width = comboBox.getWidth();
  int height = comboBox.getHeight();
  Insets insets = getInsets();
  int buttonSize = height - (insets.top + insets.bottom);
  if (arrowButton != null) {
    if (arrowButton instanceof PgsComboBoxButtonUI) {
      Icon icon = ((PgsComboBoxButtonUI) arrowButton).getComboIcon();
      Insets buttonInsets = arrowButton.getInsets();
      buttonSize = icon.getIconWidth() + buttonInsets.left +
          buttonInsets.right;
    } else {
      buttonSize = arrowButton.getWidth();
    }
  }
  if(PgsUtils.isLeftToRight(comboBox)) {
    return new Rectangle(insets.left+2, insets.top+1,
               width - (insets.left + insets.right + buttonSize + 4),
               height - (insets.top + insets.bottom)-2);
  } else {
    return new Rectangle(insets.left + buttonSize + 2, insets.top+1,
               width - (insets.left + insets.right + buttonSize + 4),
               height - (insets.top + insets.bottom)-2);
  }
}

代码示例来源:origin: cytoscape/application

w = (int)fm.stringWidth(wsp.getWidest());
h = (int)scrollPane.getMinimumSize().getHeight();
d = new Dimension(Math.max((int)((double)w + scrollPane.getVerticalScrollBar().getMinimumSize().getWidth()), box.getWidth()), h);
scrollPane.setPreferredSize(d);
scrollPane.setMaximumSize(d);

代码示例来源:origin: net.sf.mmax2/mmax2

tempBox.add(Box.createHorizontalStrut(10));
analyseInfile = new JButton("Analyse File");
analyseInfile.setSize(inputEncodings.getWidth(),analyseInfile.getHeight());
analyseInfile.setActionCommand("analyse_infile");
analyseInfile.addActionListener(this);

代码示例来源:origin: com.github.arnabk/pgslookandfeel

public void layoutComboBox(Container parent, MetalComboBoxLayoutManager manager) {
  if (arrowButton != null) {
    if (arrowButton instanceof PgsComboBoxButtonUI) {
      Icon icon = ((PgsComboBoxButtonUI) arrowButton).getComboIcon();
      Insets buttonInsets = arrowButton.getInsets();
      Insets insets = comboBox.getInsets();
      int buttonWidth = icon.getIconWidth() + buttonInsets.left +
          buttonInsets.right;
      arrowButton.setBounds(
          PgsUtils.isLeftToRight(comboBox)
              ? (comboBox.getWidth() - insets.right - buttonWidth)
              : insets.left+2,
          insets.top + 2, buttonWidth - 2,
          comboBox.getHeight() - insets.top - insets.bottom - 4);
    } else {
      Insets insets = comboBox.getInsets();
      int width = comboBox.getWidth();
      int height = comboBox.getHeight();
      arrowButton.setBounds(
          insets.left, insets.top,
          width - (insets.left + insets.right),
          height - (insets.top + insets.bottom));
    }
  }
  if (editor != null) {
    Rectangle cvb = rectangleForCurrentValue();
    editor.setBounds(cvb);
  }
}

代码示例来源:origin: igvteam/igv

int rendererWidth = box.getWidth();
for (int index = 0; index < box.getItemCount(); index++) {
  Object value = box.getItemAt(index);

代码示例来源:origin: net.sf.nimrod/nimrod-laf

protected void refresh() {
 if ( comboBox != null && comboBox.getParent() != null ) {
  comboBox.getParent().repaint( comboBox.getX()-5, comboBox.getY()-5, 
                 comboBox.getWidth()+10, comboBox.getHeight()+10);
 }
}

代码示例来源:origin: com.jidesoft/jide-oss

arrowButton.setBounds(
    comboBox.getComponentOrientation().isLeftToRight()
        ? (comboBox.getWidth() - insets.right - buttonWidth)
        : insets.left,
    insets.top, buttonWidth,
int width = comboBox.getWidth();
int height = comboBox.getHeight();
arrowButton.setBounds(

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

public void layoutContainer(Container parent)
  int width= cb.getWidth();
  int height= cb.getHeight();

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

@Override
public void paint(Graphics g, JComponent c) {
  Graphics2D graphics = (Graphics2D) g.create();
  int width = this.comboBox.getWidth();
  int height = this.comboBox.getHeight();
  Insets insets = this.comboBox.getInsets();

代码示例来源:origin: com.github.insubstantial/substance

return;
int width = combo.getWidth();
int height = combo.getHeight();
int y = 0;

代码示例来源:origin: com.github.insubstantial/substance

@Override
public void paint(Graphics g, JComponent c) {
  Graphics2D graphics = (Graphics2D) g.create();
  int width = this.comboBox.getWidth();
  int height = this.comboBox.getHeight();
  Insets insets = this.comboBox.getInsets();

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

return;
int width = combo.getWidth();
int height = combo.getHeight();
int y = 0;

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

JComboBox cb = (JComboBox) parent;
int width = cb.getWidth();
int height = cb.getHeight();

代码示例来源:origin: com.github.insubstantial/substance

JComboBox cb = (JComboBox) parent;
int width = cb.getWidth();
int height = cb.getHeight();

相关文章

JComboBox类方法