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

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

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

JComboBox.getInsets介绍

暂无

代码示例

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

/**
 * Gets the insets from the JComboBox.
 */
protected Insets getInsets()
{
  return comboBox.getInsets();
}

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

public Insets getInsets() {
  if ("Aqua".equals(UIManager.getLookAndFeel().getID())) {
    return new Insets(0,0,0,0);
  } else {
    return super.getInsets();
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

@Override
public Insets getInsets() {
  if ("Aqua".equals(UIManager.getLookAndFeel().getID())) {
    return new Insets(0, 0, 0, 0);
  } else {
    return super.getInsets();
  }
}

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

public Insets getInsets() {
  if ("Aqua".equals(UIManager.getLookAndFeel().getID())) {
    return new Insets(0,0,0,0);
  } else {
    return super.getInsets();
  }
}

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

@Override
public Dimension getMinimumSize(JComponent c) {
  if (!this.isMinimumSizeDirty) {
    return new Dimension(this.cachedMinimumSize);
  }
  // Dimension size = null;
  //
  // if (!this.comboBox.isEditable() && this.arrowButton != null
  // && this.arrowButton instanceof SubstanceComboBoxButton) {
  //
  SubstanceDropDownButton button = (SubstanceDropDownButton) this.arrowButton;
  Insets buttonInsets = button.getInsets();
  Insets insets = this.comboBox.getInsets();
  Dimension size = this.getDisplaySize();
  size.width += insets.left + insets.right;
  size.width += buttonInsets.left + buttonInsets.right;
  size.width += button.getMinimumSize().getWidth();
  size.height += insets.top + insets.bottom;
  // } else if (this.comboBox.isEditable() && this.arrowButton != null
  // && this.editor != null) {
  // size = super.getMinimumSize(c);
  // } else {
  // size = super.getMinimumSize(c);
  // }
  this.cachedMinimumSize.setSize(size.width, size.height);
  this.isMinimumSizeDirty = false;
  return new Dimension(this.cachedMinimumSize);
}

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

@Override
public Dimension getMinimumSize(JComponent c) {
  if (!this.isMinimumSizeDirty) {
    return new Dimension(this.cachedMinimumSize);
  }
  // Dimension size = null;
  //
  // if (!this.comboBox.isEditable() && this.arrowButton != null
  // && this.arrowButton instanceof SubstanceComboBoxButton) {
  //
  SubstanceDropDownButton button = (SubstanceDropDownButton) this.arrowButton;
  Insets buttonInsets = button.getInsets();
  Insets insets = this.comboBox.getInsets();
  Dimension size = this.getDisplaySize();
  size.width += insets.left + insets.right;
  size.width += buttonInsets.left + buttonInsets.right;
  size.width += button.getMinimumSize().getWidth();
  size.height += insets.top + insets.bottom;
  // } else if (this.comboBox.isEditable() && this.arrowButton != null
  // && this.editor != null) {
  // size = super.getMinimumSize(c);
  // } else {
  // size = super.getMinimumSize(c);
  // }
  this.cachedMinimumSize.setSize(size.width, size.height);
  this.isMinimumSizeDirty = false;
  return new Dimension(this.cachedMinimumSize);
}

代码示例来源:origin: khuxtable/seaglass

Rectangle screenBounds;
int       listWidth    = getList().getPreferredSize().width;
Insets    margin       = comboBox.getInsets();

代码示例来源: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: com.jidesoft/jide-oss

Icon icon = ((BasicJideComboBoxButton) arrowButton).getComboIcon();
Insets buttonInsets = arrowButton.getInsets();
Insets insets = comboBox.getInsets();
int buttonWidth = icon.getIconWidth() + buttonInsets.left +
    buttonInsets.right;
Insets insets = comboBox.getInsets();
int width = comboBox.getWidth();
int height = comboBox.getHeight();

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

Insets insets = comboBox.getInsets();

代码示例来源:origin: net.java.dev.swing-layout/swing-layout

private static int getComboBoxBaseline(JComboBox combobox, int height) {
  Insets insets = combobox.getInsets();
  int y = insets.top;
  height -= (insets.top + insets.bottom);

代码示例来源:origin: net.java.dev.swing-layout/swing-layout

private int getComboBoxBaseline(JComboBox combobox, int height) {
  Insets insets = combobox.getInsets();
  int y = insets.top;
  height -= (insets.top + insets.bottom);
  if (combobox.isEditable()) {
    ComboBoxEditor editor = combobox.getEditor();
    if (editor != null && (editor.getEditorComponent() instanceof
                JTextField)) {
      JTextField tf = (JTextField)editor.getEditorComponent();
      return y + getSingleLineTextBaseline(tf, height);
    }
  }
  y -= 1;
  // Use the renderer to calculate baseline
  ListCellRenderer renderer = combobox.getRenderer();
  if (renderer instanceof JLabel) {
    return y + getLabelBaseline((JLabel)renderer, height);
  }
  // Renderer isn't a label, use metrics directly.
  FontMetrics fm = combobox.getFontMetrics(combobox.getFont());
  return y + fm.getAscent();
}

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

int width = this.comboBox.getWidth();
int height = this.comboBox.getHeight();
Insets insets = this.comboBox.getInsets();

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

int width = this.comboBox.getWidth();
int height = this.comboBox.getHeight();
Insets insets = this.comboBox.getInsets();

相关文章

JComboBox类方法