javax.swing.JLabel.getVerticalAlignment()方法的使用及代码示例

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

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

JLabel.getVerticalAlignment介绍

暂无

代码示例

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu

public int getVerticalAlignment()
{
 if((delegate_==this)||(delegate_==null))
  return super.getVerticalAlignment();
  return delegate_.getVerticalAlignment();
}

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@ScriptFunction(jsDoc = ""
    + "/**\n"
    + " * Vertical position of the text with the icon relative to the component's size.\n"
    + " */")
@Override
public int getVerticalAlignment() {
  return super.getVerticalAlignment();
}

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

private static int getLabelBaselineResizeBehavior(JLabel label) {
  if (label.getClientProperty("html") != null) {
    return BRB_OTHER;
  }
  switch(label.getVerticalAlignment()) {
  case JLabel.TOP:
    return BRB_CONSTANT_ASCENT;
  case JLabel.BOTTOM:
    return BRB_CONSTANT_DESCENT;
  case JLabel.CENTER:
    return BRB_CENTER_OFFSET;
  }
  return BRB_OTHER;
}

代码示例来源:origin: violetumleditor/violetumleditor

protected LineText(LineText lineText) throws CloneNotSupportedException
{
  getLabel().setHorizontalAlignment(lineText.getLabel().getHorizontalAlignment());
  getLabel().setVerticalAlignment(lineText.getLabel().getVerticalAlignment());
  getLabel().setForeground(lineText.getLabel().getForeground());
  getLabel().setBorder(lineText.getLabel().getBorder());
  getLabel().setText(lineText.getLabel().getText());
  converter = lineText.converter;
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop

switch (label.getVerticalAlignment()) {
  case SwingConstants.TOP:
    yOffset = 0;

代码示例来源: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: stackoverflow.com

label.getText(),
icon,
label.getVerticalAlignment(),
label.getHorizontalAlignment(),
label.getVerticalTextPosition(),

代码示例来源:origin: org.swinglabs.swingx/swingx-core

/**
 * {@inheritDoc} <p>
 * 
 *  Paints a diagonal cross over the text if the comp is of type JLabel, 
 *  does nothing otherwise.
 */
@Override
protected void doPaint(Graphics2D g, JComponent comp, int width,
    int height) {
  if (!(comp instanceof JLabel)) return;
  JLabel label = (JLabel) comp;
  Insets insets = label.getInsets(insetss);
  paintViewR.x = insets.left;
  paintViewR.y = insets.top;
  paintViewR.width = width - (insets.left + insets.right);
  paintViewR.height = height - (insets.top + insets.bottom);
  paintIconR.x = paintIconR.y = paintIconR.width = paintIconR.height = 0;
  paintTextR.x = paintTextR.y = paintTextR.width = paintTextR.height = 0;
  SwingUtilities.layoutCompoundLabel(label, 
      label.getFontMetrics(label.getFont()), label.getText(), null,
      label.getVerticalAlignment(), label.getHorizontalAlignment(), 
      label.getVerticalTextPosition(), label.getHorizontalTextPosition(),
      paintViewR, paintIconR, paintTextR, label.getIconTextGap());
  doPaint(g, paintTextR);
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop

/**
 * {@inheritDoc} <p>
 * 
 *  Paints a diagonal cross over the text if the comp is of type JLabel, 
 *  does nothing otherwise.
 */
@Override
protected void doPaint(Graphics2D g, JComponent comp, int width,
    int height) {
  if (!(comp instanceof JLabel)) return;
  JLabel label = (JLabel) comp;
  Insets insets = label.getInsets(insetss);
  paintViewR.x = insets.left;
  paintViewR.y = insets.top;
  paintViewR.width = width - (insets.left + insets.right);
  paintViewR.height = height - (insets.top + insets.bottom);
  paintIconR.x = paintIconR.y = paintIconR.width = paintIconR.height = 0;
  paintTextR.x = paintTextR.y = paintTextR.width = paintTextR.height = 0;
  SwingUtilities.layoutCompoundLabel(label, 
      label.getFontMetrics(label.getFont()), label.getText(), null,
      label.getVerticalAlignment(), label.getHorizontalAlignment(), 
      label.getVerticalTextPosition(), label.getHorizontalTextPosition(),
      paintViewR, paintIconR, paintTextR, label.getIconTextGap());
  doPaint(g, paintTextR);
}

代码示例来源:origin: org.swinglabs.swingx/swingx-all

/**
 * {@inheritDoc} <p>
 * 
 *  Paints a diagonal cross over the text if the comp is of type JLabel, 
 *  does nothing otherwise.
 */
@Override
protected void doPaint(Graphics2D g, JComponent comp, int width,
    int height) {
  if (!(comp instanceof JLabel)) return;
  JLabel label = (JLabel) comp;
  Insets insets = label.getInsets(insetss);
  paintViewR.x = insets.left;
  paintViewR.y = insets.top;
  paintViewR.width = width - (insets.left + insets.right);
  paintViewR.height = height - (insets.top + insets.bottom);
  paintIconR.x = paintIconR.y = paintIconR.width = paintIconR.height = 0;
  paintTextR.x = paintTextR.y = paintTextR.width = paintTextR.height = 0;
  SwingUtilities.layoutCompoundLabel(label, 
      label.getFontMetrics(label.getFont()), label.getText(), null,
      label.getVerticalAlignment(), label.getHorizontalAlignment(), 
      label.getVerticalTextPosition(), label.getHorizontalTextPosition(),
      paintViewR, paintIconR, paintTextR, label.getIconTextGap());
  doPaint(g, paintTextR);
}

代码示例来源:origin: com.haulmont.thirdparty/swingx-core

/**
 * {@inheritDoc} <p>
 * 
 *  Paints a diagonal cross over the text if the comp is of type JLabel, 
 *  does nothing otherwise.
 */
@Override
protected void doPaint(Graphics2D g, JComponent comp, int width,
    int height) {
  if (!(comp instanceof JLabel)) return;
  JLabel label = (JLabel) comp;
  Insets insets = label.getInsets(insetss);
  paintViewR.x = insets.left;
  paintViewR.y = insets.top;
  paintViewR.width = width - (insets.left + insets.right);
  paintViewR.height = height - (insets.top + insets.bottom);
  paintIconR.x = paintIconR.y = paintIconR.width = paintIconR.height = 0;
  paintTextR.x = paintTextR.y = paintTextR.width = paintTextR.height = 0;
  SwingUtilities.layoutCompoundLabel(label, 
      label.getFontMetrics(label.getFont()), label.getText(), null,
      label.getVerticalAlignment(), label.getHorizontalAlignment(), 
      label.getVerticalTextPosition(), label.getHorizontalTextPosition(),
      paintViewR, paintIconR, paintTextR, label.getIconTextGap());
  doPaint(g, paintTextR);
}

代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core

/**
 * {@inheritDoc} <p>
 * 
 *  Paints a diagonal cross over the text if the comp is of type JLabel, 
 *  does nothing otherwise.
 */
@Override
protected void doPaint(Graphics2D g, JComponent comp, int width,
    int height) {
  if (!(comp instanceof JLabel)) return;
  JLabel label = (JLabel) comp;
  Insets insets = label.getInsets(insetss);
  paintViewR.x = insets.left;
  paintViewR.y = insets.top;
  paintViewR.width = width - (insets.left + insets.right);
  paintViewR.height = height - (insets.top + insets.bottom);
  paintIconR.x = paintIconR.y = paintIconR.width = paintIconR.height = 0;
  paintTextR.x = paintTextR.y = paintTextR.width = paintTextR.height = 0;
  SwingUtilities.layoutCompoundLabel(label, 
      label.getFontMetrics(label.getFont()), label.getText(), null,
      label.getVerticalAlignment(), label.getHorizontalAlignment(), 
      label.getVerticalTextPosition(), label.getHorizontalTextPosition(),
      paintViewR, paintIconR, paintTextR, label.getIconTextGap());
  doPaint(g, paintTextR);
}

代码示例来源: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: khuxtable/seaglass

FontMetrics fm = context.getComponent().getFontMetrics(context.getStyle().getFont(context));
context.getStyle().getGraphicsUtils(context).layoutText(context, fm, label.getText(), label.getIcon(),
  label.getHorizontalAlignment(), label.getVerticalAlignment(), label.getHorizontalTextPosition(),
  label.getVerticalTextPosition(), viewRect, iconRect, textRect, label.getIconTextGap());
View view = (View) label.getClientProperty(BasicHTML.propertyKey);

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

/**
 * Forwards the call to SwingUtilities.layoutCompoundLabel().
 * This method is here so that a subclass could do Label specific
 * layout and to shorten the method name a little.
 *
 * @see SwingUtilities#layoutCompoundLabel
 */
@Override
protected String layoutCL(
    JLabel label,
    FontMetrics fontMetrics,
    String text,
    Icon icon,
    Rectangle viewR,
    Rectangle iconR,
    Rectangle textR) {
  return SwingUtilities.layoutCompoundLabel(
      (JComponent) label,
      fontMetrics,
      text,
      icon,
      label.getVerticalAlignment(),
      label.getHorizontalAlignment(),
      label.getVerticalTextPosition(),
      label.getHorizontalTextPosition(),
      viewR,
      iconR,
      textR,
      label.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;
}

相关文章

微信公众号

最新文章

更多

JLabel类方法