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

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

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

JLabel.setHorizontalTextPosition介绍

暂无

代码示例

代码示例来源:origin: deathmarine/Luyten

protected JPanel getFontFamilyPanel() {
  if (fontNamePanel == null) {
    fontNamePanel = new JPanel();
    fontNamePanel.setLayout(new BorderLayout());
    fontNamePanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    fontNamePanel.setPreferredSize(new Dimension(180, 130));
    JScrollPane scrollPane = new JScrollPane(getFontFamilyList());
    scrollPane.getVerticalScrollBar().setFocusable(false);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    JPanel p = new JPanel();
    p.setLayout(new BorderLayout());
    p.add(getFontFamilyTextField(), BorderLayout.NORTH);
    p.add(scrollPane, BorderLayout.CENTER);
    JLabel label = new JLabel(("Font Name"));
    label.setHorizontalAlignment(JLabel.LEFT);
    label.setHorizontalTextPosition(JLabel.LEFT);
    label.setLabelFor(getFontFamilyTextField());
    label.setDisplayedMnemonic('F');
    fontNamePanel.add(label, BorderLayout.NORTH);
    fontNamePanel.add(p, BorderLayout.CENTER);
  }
  return fontNamePanel;
}

代码示例来源:origin: deathmarine/Luyten

protected JPanel getFontStylePanel() {
  if (fontStylePanel == null) {
    fontStylePanel = new JPanel();
    fontStylePanel.setLayout(new BorderLayout());
    fontStylePanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    fontStylePanel.setPreferredSize(new Dimension(140, 130));
    JScrollPane scrollPane = new JScrollPane(getFontStyleList());
    scrollPane.getVerticalScrollBar().setFocusable(false);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    JPanel p = new JPanel();
    p.setLayout(new BorderLayout());
    p.add(getFontStyleTextField(), BorderLayout.NORTH);
    p.add(scrollPane, BorderLayout.CENTER);
    JLabel label = new JLabel(("Font Style"));
    label.setHorizontalAlignment(JLabel.LEFT);
    label.setHorizontalTextPosition(JLabel.LEFT);
    label.setLabelFor(getFontStyleTextField());
    label.setDisplayedMnemonic('Y');
    fontStylePanel.add(label, BorderLayout.NORTH);
    fontStylePanel.add(p, BorderLayout.CENTER);
  }
  return fontStylePanel;
}

代码示例来源:origin: deathmarine/Luyten

protected JPanel getFontSizePanel() {
  if (fontSizePanel == null) {
    fontSizePanel = new JPanel();
    fontSizePanel.setLayout(new BorderLayout());
    fontSizePanel.setPreferredSize(new Dimension(70, 130));
    fontSizePanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    JScrollPane scrollPane = new JScrollPane(getFontSizeList());
    scrollPane.getVerticalScrollBar().setFocusable(false);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    JPanel p = new JPanel();
    p.setLayout(new BorderLayout());
    p.add(getFontSizeTextField(), BorderLayout.NORTH);
    p.add(scrollPane, BorderLayout.CENTER);
    JLabel label = new JLabel(("Font Size"));
    label.setHorizontalAlignment(JLabel.LEFT);
    label.setHorizontalTextPosition(JLabel.LEFT);
    label.setLabelFor(getFontSizeTextField());
    label.setDisplayedMnemonic('S');
    fontSizePanel.add(label, BorderLayout.NORTH);
    fontSizePanel.add(p, BorderLayout.CENTER);
  }
  return fontSizePanel;
}

代码示例来源:origin: stackoverflow.com

this.model = model;
label.setVerticalTextPosition(JLabel.BOTTOM);
label.setHorizontalTextPosition(JLabel.CENTER);
this.add(label, BorderLayout.CENTER);
this.add(genButtonPanel(), BorderLayout.SOUTH);

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

jLabel_PromptCount.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel_PromptCount.setText("1999");
jLabel_PromptCount.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
jLabel_PromptCount.setPreferredSize(new java.awt.Dimension(64, 64));
jLabel_PromptTotal.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel_PromptTotal.setText("/ 2012");
jLabel_PromptTotal.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
jLabel_PromptTotal.setPreferredSize(new java.awt.Dimension(64, 64));

代码示例来源:origin: stackoverflow.com

public class MarioListRenderer extends DefaultListCellRenderer {

  Font font = new Font("helvitica", Font.BOLD, 24);

  @Override
  public Component getListCellRendererComponent(
      JList list, Object value, int index,
      boolean isSelected, boolean cellHasFocus) {

    JLabel label = (JLabel) super.getListCellRendererComponent(
        list, value, index, isSelected, cellHasFocus);
    label.setIcon(imageMap.get((String) value));
    label.setHorizontalTextPosition(JLabel.RIGHT);
    label.setFont(font);
    return label;
  }
}

代码示例来源:origin: magefree/mage

private void setTabTitle(int tabIndex, String title, String iconResourceName) {
  // tab caption with left sided icon
  // https://stackoverflow.com/questions/1782224/jtabbedpane-icon-on-left-side-of-tabs
  JLabel lbl = new JLabel(title);
  Icon icon = new ImageIcon(getClass().getResource(iconResourceName));
  lbl.setIcon(icon);
  lbl.setIconTextGap(5);
  lbl.setHorizontalTextPosition(SwingConstants.RIGHT);
  tabsList.setTabComponentAt(tabIndex, lbl);
}

代码示例来源:origin: stackoverflow.com

list, value, index, isSelected, cellHasFocus);
label.setIcon(imageMap.get((String) value));
label.setHorizontalTextPosition(JLabel.RIGHT);
label.setFont(font);
return label;

代码示例来源:origin: stackoverflow.com

list, value, index, isSelected, cellHasFocus);
label.setIcon(imageMap.get((String) value));
label.setHorizontalTextPosition(JLabel.RIGHT);
label.setFont(font);
return label;

代码示例来源:origin: magefree/mage

jMemUsageLabel.setText("100% Free mem");
jMemUsageLabel.setFocusable(false);
jMemUsageLabel.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
mageToolbar.add(jMemUsageLabel);

代码示例来源:origin: stackoverflow.com

label.setHorizontalTextPosition(JLabel.CENTER);
label.setVerticalTextPosition(JLabel.BOTTOM);
this.add(label);

代码示例来源:origin: magefree/mage

lblTableImage.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
lblTableImage.setFocusable(false);
lblTableImage.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
lblTableImage.setOpaque(true);
lblTableImage.setRequestFocusEnabled(false);

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

/**
 * Initializes the renderer to a horizontal alignment
 * of <code>CENTER</code> and a horizontal text position
 * of <code>LEFT</code>.
 *
 */
public TinyTableHeaderRenderer() {
  setHorizontalAlignment(CENTER);
  setHorizontalTextPosition(LEFT);
}

代码示例来源:origin: magefree/mage

lblURLServerList.setText("URL server list:");
lblURLServerList.setToolTipText("");
lblURLServerList.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
lblURLServerList.setPreferredSize(new java.awt.Dimension(110, 16));
lblURLServerList.setVerticalTextPosition(javax.swing.SwingConstants.TOP);

代码示例来源:origin: stackoverflow.com

JLabel label = new JLabel("Tab1");
label.setHorizontalTextPosition(JLabel.TRAILING); // Set the text position regarding its icon
label.setIcon(UIManager.getIcon("OptionPane.informationIcon"));

JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.LEFT);
tabbedPane.addTab(null, new JPanel());
tabbedPane.setTabComponentAt(0, label); // Here set the custom tab component

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

public void setHorizontalTextPosition(int _htp)
{
 if((delegate_==this)||(delegate_==null))
  super.setHorizontalTextPosition(_htp);
 else
  delegate_.setHorizontalTextPosition(_htp);
}

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

public ServiceCellRenderer() {
  super();
  indicator.setHorizontalTextPosition(JLabel.LEFT);
  indicator.setIconTextGap(0);
  indicator.setText(" ");
  indicator.setOpaque(false);
  rowDescriptor.setOpaque(false);
  add(indicator, BorderLayout.WEST);
  add(rowDescriptor, BorderLayout.CENTER);
}

代码示例来源:origin: igniterealtime/Spark

public ChatStatePanel(ChatState state, CharSequence nickname) {
    setLayout(new FlowLayout(FlowLayout.LEFT, 1, 1));
    JLabel label = new JLabel( Res.getString( state.name(), nickname.toString() ) );
    label.setFont(new Font("Courier New", Font.PLAIN, 9));
    label.setForeground(Color.gray);
    label.setHorizontalTextPosition(JLabel.LEFT);
    label.setVerticalTextPosition(JLabel.BOTTOM);
    add( label );
  }
}

代码示例来源:origin: net.anwiba.commons/anwiba-commons-swing-core

public GridBagLayoutComponentBuilder label(final String text) {
 newline();
 final JLabel label = new JLabel(text + (text.isEmpty() ? "" : ":")); //$NON-NLS-1$ //$NON-NLS-2$
 label.setVerticalTextPosition(JLabel.TOP);
 label.setVerticalAlignment(JLabel.TOP);
 label.setHorizontalTextPosition(JLabel.LEFT);
 label.setHorizontalAlignment(JLabel.LEFT);
 this.components.add(new GridBagLayoutComponent(label, ++this.column, this.row, 1, 1, UNDEFIND_ANCHOR));
 return this;
}

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

@Override
protected JComponent createRendererComponent() {
  final JCondition renderer = new JCondition();
  final String string = toString();
  final JLabel label = ConditionFactory.createConditionLabel(string.substring(0, string.length() - 3));
  label.setIcon(STORE.getMindIcon(getIconName()).getIcon());
  label.setHorizontalTextPosition(SwingConstants.LEFT);
  renderer.add(label);
  return renderer;
}

相关文章

微信公众号

最新文章

更多

JLabel类方法