本文整理了Java中javax.swing.JLabel.getIconTextGap()
方法的一些代码示例,展示了JLabel.getIconTextGap()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JLabel.getIconTextGap()
方法的具体详情如下:
包路径:javax.swing.JLabel
类名称:JLabel
方法名:getIconTextGap
暂无
代码示例来源:origin: stackoverflow.com
int offset = 0;
if(icon != null && getText() != null)
offset = (icon.getIconWidth() + getIconTextGap());
g.fillRect(offset, 0, getWidth() - 1 - offset,
getHeight() - 1);
代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui
public Dimension getPreferredSize() {
Dimension size = label1.getPreferredSize();
if ("".equals(label1.getText())) size.width += label1.getIconTextGap(); // NOI18N
size.width += label2.getPreferredSize().width;
size.width += label3.getPreferredSize().width;
return size;
}
代码示例来源:origin: com.haulmont.thirdparty/swingx-core
/**
* @param treeComponent
*/
private void updateIconWidth(Component treeComponent) {
iconWidth = 0;
if (!(treeComponent instanceof JLabel)) return;
Icon icon = ((JLabel) treeComponent).getIcon();
if (icon != null) {
iconWidth = icon.getIconWidth() + ((JLabel) treeComponent).getIconTextGap();
}
}
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu
public int getIconTextGap()
{
if((delegate_==this)||(delegate_==null))
return super.getIconTextGap();
return delegate_.getIconTextGap();
}
代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core
/**
* @param treeComponent
*/
private void updateIconWidth(Component treeComponent) {
iconWidth = 0;
if (!(treeComponent instanceof JLabel)) return;
Icon icon = ((JLabel) treeComponent).getIcon();
if (icon != null) {
iconWidth = icon.getIconWidth() + ((JLabel) treeComponent).getIconTextGap();
}
}
代码示例来源:origin: org.swinglabs.swingx/swingx-core
/**
* @param treeComponent
*/
private void updateIconWidth(Component treeComponent) {
iconWidth = 0;
if (!(treeComponent instanceof JLabel)) return;
Icon icon = ((JLabel) treeComponent).getIcon();
if (icon != null) {
iconWidth = icon.getIconWidth() + ((JLabel) treeComponent).getIconTextGap();
}
}
代码示例来源:origin: com.eas.platypus/platypus-js-forms
@ScriptFunction(jsDoc = ""
+ "/**\n"
+ " * The amount of space between the text and the icon displayed in this label.\n"
+ " */")
@Override
public int getIconTextGap() {
return super.getIconTextGap();
}
代码示例来源:origin: org.swinglabs.swingx/swingx-all
/**
* @param treeComponent
*/
private void updateIconWidth(Component treeComponent) {
iconWidth = 0;
if (!(treeComponent instanceof JLabel)) return;
Icon icon = ((JLabel) treeComponent).getIcon();
if (icon != null) {
iconWidth = icon.getIconWidth() + ((JLabel) treeComponent).getIconTextGap();
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui
public void doLayout() {
Dimension size = getSize();
Dimension size1 = label1.getPreferredSize();
Dimension size2 = label2.getPreferredSize();
Dimension size3 = label3.getPreferredSize();
size.height = Math.max(size.height, size1.height);
size.height = Math.max(size.height, size2.height);
size.height = Math.max(size.height, size3.height);
int x = 0;
if ("".equals(label1.getText())) size1.width += label1.getIconTextGap(); // NOI18N
label1.setBounds(x, 0, size1.width, size.height);
x += size1.width;
label2.setBounds(x, 0, size2.width, size.height);
x += size2.width;
label3.setBounds(x, 0, size3.width, size.height);
}
代码示例来源:origin: org.swinglabs.swingx/swingx-core
/**
* Instantiates and configures a WrappingIconPanel with the dropHack
* property set as indicated by the boolean.
*
* @param dropHackEnabled a boolean indicating whether the drop hack should
* be enabled.
*
* @see #isVisible()
*/
public WrappingIconPanel(boolean dropHackEnabled) {
setOpaque(false);
iconLabel = new JRendererLabel();
iconLabelGap = iconLabel.getIconTextGap();
iconLabel.setOpaque(false);
updateIconBorder();
setBorder(null);
setLayout(new BorderLayout());
add(iconLabel, BorderLayout.LINE_START);
setDropHackEnabled(dropHackEnabled);
}
代码示例来源:origin: com.haulmont.thirdparty/swingx-core
/**
* Instantiates and configures a WrappingIconPanel with the dropHack
* property set as indicated by the boolean.
*
* @param dropHackEnabled a boolean indicating whether the drop hack should
* be enabled.
*
* @see #isVisible()
*/
public WrappingIconPanel(boolean dropHackEnabled) {
setOpaque(false);
iconLabel = new JRendererLabel();
iconLabelGap = iconLabel.getIconTextGap();
iconLabel.setOpaque(false);
updateIconBorder();
setBorder(null);
setLayout(new BorderLayout());
add(iconLabel, BorderLayout.LINE_START);
setDropHackEnabled(dropHackEnabled);
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-editor
protected Vector layoutCL( Graphics g, JLabel label, FontMetrics fontMetrics, String text, Icon icon, Rectangle viewR, Rectangle iconR, Rectangle textR )
{
return layoutCompoundLabel( g, (JComponent)label, fontMetrics, text, icon, label.getVerticalAlignment(), label.getHorizontalAlignment(), label.getVerticalTextPosition(), label.getHorizontalTextPosition(), viewR, iconR, textR, label.getIconTextGap() );
}
代码示例来源:origin: net.java.dev.swing-layout/swing-layout
private int getLabelBaseline(JLabel label, int height) {
Icon icon = (label.isEnabled()) ? label.getIcon() :
label.getDisabledIcon();
FontMetrics fm = label.getFontMetrics(label.getFont());
resetRects(label, height);
SwingUtilities.layoutCompoundLabel(label, fm,
"a", icon, label.getVerticalAlignment(),
label.getHorizontalAlignment(), label.getVerticalTextPosition(),
label.getHorizontalTextPosition(), viewRect, iconRect, textRect,
label.getIconTextGap());
return textRect.y + fm.getAscent();
}
代码示例来源:origin: net.java.dev.swing-layout/swing-layout
private static int getLabelBaseline(JLabel label, int height) {
Icon icon = (label.isEnabled()) ? label.getIcon() :
label.getDisabledIcon();
FontMetrics fm = label.getFontMetrics(label.getFont());
resetRects(label, height);
SwingUtilities.layoutCompoundLabel(label, fm,
"a", icon, label.getVerticalAlignment(),
label.getHorizontalAlignment(), label.getVerticalTextPosition(),
label.getHorizontalTextPosition(), viewRect, iconRect, textRect,
label.getIconTextGap());
return textRect.y + fm.getAscent();
}
代码示例来源:origin: khuxtable/seaglass
protected void paint(SeaGlassContext context, Graphics g) {
JLabel label = (JLabel) context.getComponent();
Icon icon = (label.isEnabled()) ? label.getIcon() : label.getDisabledIcon();
g.setColor(context.getStyle().getColor(context, ColorType.TEXT_FOREGROUND));
g.setFont(style.getFont(context));
context.getStyle().getGraphicsUtils(context).paintText(context, g, label.getText(), icon, label.getHorizontalAlignment(),
label.getVerticalAlignment(), label.getHorizontalTextPosition(), label.getVerticalTextPosition(),
label.getIconTextGap(), label.getDisplayedMnemonicIndex(), 0);
}
代码示例来源:origin: triplea-game/triplea
@Test
public void iconTextGap() {
final int value = 42;
final JLabel label = JLabelBuilder.builder()
.text("value")
.iconTextGap(value)
.build();
MatcherAssert.assertThat(label.getIconTextGap(), is(value));
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui
public LabelRenderer(boolean plain) {
setEnabled(true);
setHorizontalAlignment(LEADING);
setVerticalAlignment(TOP);
setSize(Integer.MAX_VALUE, Integer.MAX_VALUE);
if (plain) {
setOpaque(false);
} else {
setOpaque(true);
setMargin(3, 3, 3, 3);
}
iconTextGap = super.getIconTextGap();
}
代码示例来源:origin: khuxtable/seaglass
public Dimension getMaximumSize(JComponent c) {
JLabel label = (JLabel) c;
Icon icon = (label.isEnabled()) ? label.getIcon() : label.getDisabledIcon();
SeaGlassContext context = getContext(c);
Dimension size = context.getStyle().getGraphicsUtils(context).getMaximumSize(context, context.getStyle().getFont(context),
label.getText(), icon, label.getHorizontalAlignment(), label.getVerticalAlignment(), label.getHorizontalTextPosition(),
label.getVerticalTextPosition(), label.getIconTextGap(), label.getDisplayedMnemonicIndex());
context.dispose();
return size;
}
代码示例来源:origin: khuxtable/seaglass
public Dimension getMinimumSize(JComponent c) {
JLabel label = (JLabel) c;
Icon icon = (label.isEnabled()) ? label.getIcon() : label.getDisabledIcon();
SeaGlassContext context = getContext(c);
Dimension size = context.getStyle().getGraphicsUtils(context).getMinimumSize(context, context.getStyle().getFont(context),
label.getText(), icon, label.getHorizontalAlignment(), label.getVerticalAlignment(), label.getHorizontalTextPosition(),
label.getVerticalTextPosition(), label.getIconTextGap(), label.getDisplayedMnemonicIndex());
context.dispose();
return size;
}
代码示例来源:origin: khuxtable/seaglass
public Dimension getPreferredSize(JComponent c) {
JLabel label = (JLabel) c;
Icon icon = (label.isEnabled()) ? label.getIcon() : label.getDisabledIcon();
SeaGlassContext context = getContext(c);
Dimension size = context.getStyle().getGraphicsUtils(context).getPreferredSize(context,
context.getStyle().getFont(context), label.getText(), icon, label.getHorizontalAlignment(),
label.getVerticalAlignment(), label.getHorizontalTextPosition(), label.getVerticalTextPosition(),
label.getIconTextGap(), label.getDisplayedMnemonicIndex());
context.dispose();
return size;
}
内容来源于网络,如有侵权,请联系作者删除!