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

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

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

JLabel.setVerticalAlignment介绍

暂无

代码示例

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

private JComponent getChooserPanel() {
  JPanel p = new JPanel(new BorderLayout());
  p.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
  p.setOpaque(false);
  JLabel l = new JLabel("Please choose installation directory:");
  l.setVerticalAlignment(JLabel.NORTH);
  l.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
  p.add(l, BorderLayout.NORTH);
  table = new JTable(installations);
  table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  table.setColumnSelectionAllowed(false);
  table.setDefaultRenderer(Object.class, new InstallationTableCellRenderer());
  table.getColumnModel().getColumn(0).setHeaderValue("Directory");
  table.getColumnModel().getColumn(0).setPreferredWidth(300);
  table.getColumnModel().getColumn(1).setHeaderValue("Java Version");
  table.getColumnModel().getColumn(3).setPreferredWidth(100);
  table.getColumnModel().getColumn(2).setHeaderValue("Type");
  table.getColumnModel().getColumn(3).setPreferredWidth(100);
  table.getColumnModel().getColumn(3).setHeaderValue("Replaced by DCEVM?");
  table.getColumnModel().getColumn(3).setPreferredWidth(200);
  table.getColumnModel().getColumn(4).setHeaderValue("Installed altjvm?");
  table.getColumnModel().getColumn(4).setPreferredWidth(200);
  JScrollPane lists = new JScrollPane(table);
  lists.setPreferredSize(new Dimension(900, 200));
  p.add(lists, BorderLayout.CENTER);
  return p;
}

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

itemIcon.setVerticalAlignment(JLabel.CENTER);
itemIcon.setHorizontalAlignment(JLabel.CENTER);
itemIcon.setPreferredSize(new Dimension(45, 45));
itemName.setVerticalAlignment(JLabel.BOTTOM);
itemName.setFont(FontManager.getRunescapeSmallFont());
offerInfo.setVerticalAlignment(JLabel.TOP);
offerInfo.setFont(FontManager.getRunescapeSmallFont());
JLabel switchFaceViewIcon = new JLabel();
switchFaceViewIcon.setIcon(RIGHT_ARROW_ICON);
switchFaceViewIcon.setVerticalAlignment(JLabel.CENTER);
switchFaceViewIcon.setHorizontalAlignment(JLabel.CENTER);
switchFaceViewIcon.setPreferredSize(new Dimension(30, 45));
itemPrice.setVerticalAlignment(JLabel.BOTTOM);
itemPrice.setFont(FontManager.getRunescapeSmallFont());
offerSpent.setVerticalAlignment(JLabel.TOP);
offerSpent.setFont(FontManager.getRunescapeSmallFont());
JLabel switchDetailsViewIcon = new JLabel();
switchDetailsViewIcon.setIcon(LEFT_ARROW_ICON);
switchDetailsViewIcon.setVerticalAlignment(JLabel.CENTER);
switchDetailsViewIcon.setHorizontalAlignment(JLabel.CENTER);
switchDetailsViewIcon.setPreferredSize(new Dimension(30, 45));

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

labelRender.setForeground(symbolsTextColor);
labelRender.setSize(symbolWidth, symbolWidth);
labelRender.setVerticalAlignment(SwingConstants.CENTER);
labelRender.setHorizontalAlignment(SwingConstants.CENTER);

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

popupMenu.add(pauseSkill);
JLabel skillIcon = new JLabel(new ImageIcon(iconManager.getSkillImage(skill)));
skillIcon.setHorizontalAlignment(SwingConstants.CENTER);
skillIcon.setVerticalAlignment(SwingConstants.CENTER);
skillIcon.setPreferredSize(new Dimension(35, 35));

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

public static JXPanel getDescription(CardView card, int width, int height) {
  JXPanel descriptionPanel = new JXPanel();
  //descriptionPanel.setAlpha(.8f);
  descriptionPanel.setBounds(0, 0, width, height);
  descriptionPanel.setVisible(false);
  descriptionPanel.setLayout(null);
  //descriptionPanel.setBorder(BorderFactory.createLineBorder(Color.green));
  JButton j = new JButton("");
  j.setBounds(0, 0, width, height);
  j.setBackground(Color.black);
  j.setLayout(null);
  JLabel cardText = new JLabel();
  cardText.setBounds(5, 5, width - 10, height - 10);
  cardText.setForeground(Color.white);
  cardText.setFont(cardNameFont);
  cardText.setVerticalAlignment(SwingConstants.TOP);
  j.add(cardText);
  TextLines textLines = GuiDisplayUtil.getTextLinesfromCardView(card);
  cardText.setText(getRulefromCardView(card, textLines).toString());
  descriptionPanel.add(j);
  return descriptionPanel;
}

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

numberLabel.setHorizontalAlignment(SwingConstants.LEFT);
numberLabel.setVerticalAlignment(SwingConstants.TOP);
numberLabel.setFont(ta.getFont());
numberLabel.setOpaque(false);

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

JLabel old = new JLabel("Previous");
old.setHorizontalAlignment(JLabel.CENTER);
JLabel next = new JLabel(" Current ");
next.setHorizontalAlignment(JLabel.CENTER);
JLabel hexLabel = new JLabel("#");
hexInput.setBackground(ColorScheme.DARKER_GRAY_COLOR);
JLabel label = new JLabel("Hex color");
label.setVerticalAlignment(JLabel.BOTTOM);

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

JLabel textLabel = new JLabel("Test test test test test test test...");
textLabel.setPreferredSize(new Dimension(500, 250));
textLabel.setForeground(Color.WHITE);
textLabel.setFont(new Font("Courier", Font.BOLD, 30));

// sets the text to the upper left corner
textLabel.setVerticalAlignment(SwingConstants.NORTH);

textLabel.setBorder(new CompoundBorder( // sets two borders
BorderFactory.createMatteBorder(10, 10, 10, 10, Color.WHITE), // outer border
BorderFactory.createEmptyBorder(10, 10, 10, 10))); // inner invisible border as the margin

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

public MediaScraperComboBoxEditor() {
 label.setHorizontalAlignment(JLabel.LEFT);
 label.setVerticalAlignment(JLabel.CENTER);
 selectedItem = null;
}

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

final JLabel imageLabel = new JLabel();
imageLabel.setToolTipText(buildToolTip(item));
imageLabel.setVerticalAlignment(SwingConstants.CENTER);
imageLabel.setHorizontalAlignment(SwingConstants.CENTER);

代码示例来源:origin: org.zaproxy/zap

public ResponseImageView(HttpPanelViewModel model) {
  this.model = model;
  
  imageLabel = new JLabel();
  imageLabel.setVerticalAlignment(JLabel.TOP);
  
  mainPanel = new JPanel(new BorderLayout());
  mainPanel.add(new JScrollPane(imageLabel));
  
  this.model.addHttpPanelViewModelListener(this);
}

代码示例来源:origin: uwolfer/gerrit-intellij-plugin

@Override
  public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    if (changeInfo.starred != null && changeInfo.starred) {
      label.setIcon(Git4ideaIcons.Star);
    }
    label.setHorizontalAlignment(CENTER);
    label.setVerticalAlignment(CENTER);
    return label;
  }
};

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

iconWrapperLabel = new JLabel();
iconWrapperLabel.setPreferredSize(new Dimension(30, 0));
iconWrapperLabel.setVerticalAlignment(JLabel.CENTER);
iconWrapperLabel.setHorizontalAlignment(JLabel.CENTER);

代码示例来源:origin: google/java-photoslibrary

private JLabel getTitleLabel(String title) {
 JLabel label =
   new JLabel(
     String.format(
       "<html><div style=\"color: %s\">%s</div></html>",
       TITLE_COLOR,
       UIHelper.getFormattedText(
         title, TITLE_FONT_SIZE, TITLE_FONT_WEIGHT, TITLE_LINE_MARGIN)));
 label.setVerticalAlignment(SwingConstants.CENTER);
 return label;
}

代码示例来源:origin: Spoutcraft/LegacyLauncher

@Override
  protected void done() {
    background.setIcon(new ImageIcon(backgroundImage.getPath()));
    background.setVerticalAlignment(SwingConstants.TOP);
    background.setHorizontalAlignment(SwingConstants.LEFT);
  }
}

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

lblCount = new javax.swing.JLabel();
lblLandCount = new javax.swing.JLabel();
lblCreatureCount = new javax.swing.JLabel();
chkPiles = new javax.swing.JCheckBox();
cbSortBy = new javax.swing.JComboBox();
lblCount.setVerifyInputWhenFocusTarget(false);
lblLandCount.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
lblLandCount.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/type_land.png"))); // NOI18N
lblLandCount.setText("999");
lblLandCount.setToolTipText("Number of lands.");
lblLandCount.setVerticalAlignment(javax.swing.SwingConstants.TOP);
lblLandCount.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
lblLandCount.setFocusable(false);
lblLandCount.setVerifyInputWhenFocusTarget(false);
lblCreatureCount.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
lblCreatureCount.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/type_creatures.png"))); // NOI18N
lblCreatureCount.setText("999");
lblCreatureCount.setToolTipText("Number of creatures.");
lblCreatureCount.setVerticalAlignment(javax.swing.SwingConstants.TOP);
lblCreatureCount.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
lblCreatureCount.setFocusable(false);

代码示例来源:origin: groboclown/p4ic4idea

public static JLabel createLabelFor(String text, JComponent editComponent) {
  JLabel ret = new JLabel();
  loadLabelText(ret, text);
  ret.setVerticalAlignment(0);
  ret.setLabelFor(editComponent);
  return ret;
}

代码示例来源:origin: uwolfer/gerrit-intellij-plugin

@Override
  public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    JLabel labelComponent = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    LabelInfo labelInfo = getLabelInfo(changeInfo);
    labelComponent.setIcon(getIconForLabel(labelInfo));
    labelComponent.setToolTipText(getToolTipForLabel(labelInfo));
    labelComponent.setHorizontalAlignment(CENTER);
    labelComponent.setVerticalAlignment(CENTER);
    return labelComponent;
  }
};

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

main_card = new javax.swing.JPanel();
showCardName = new javax.swing.JCheckBox();
tooltipDelayLabel = new javax.swing.JLabel();
tooltipDelay = new javax.swing.JSlider();
showFullImagePath = new javax.swing.JCheckBox();
tooltipDelayLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
tooltipDelayLabel.setText("Delay in milliseconds for showing the card tooltip text (0 value will disable tooltip)");
tooltipDelayLabel.setToolTipText("<HTML>The time the appearance of the tooltip window for a card is delayed.<br>\nIf set to zero, the tooltip window won't be shown at all.");
guiSizeBasic.add(sliderFontSize, gridBagConstraints);
fontSizeLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
fontSizeLabel.setText("Tables");
fontSizeLabel.setToolTipText("<HTML>The size of the font used to display table text.");
guiSizeBasic.add(sliderChatFontSize, gridBagConstraints);
chatFontSizeLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
chatFontSizeLabel.setText("Chat");
chatFontSizeLabel.setToolTipText("<HTML>The size of the font used to display the chat text");
controlsDescriptionLabel.setVerticalAlignment(javax.swing.SwingConstants.TOP);

代码示例来源:origin: google/java-photoslibrary

private JLabel getSampleIconLabel(String sampleImageResource) {
 ImageIcon originalImage =
   new ImageIcon(ConnectToPhotosView.class.getResource(sampleImageResource));
 JLabel iconLabel =
   new JLabel(
     new ImageIcon(
       originalImage
         .getImage()
         .getScaledInstance(
           SAMPLE_IMAGE_WIDTH, SAMPLE_IMAGE_HEIGHT, Image.SCALE_SMOOTH)));
 iconLabel.setVerticalAlignment(SwingConstants.CENTER);
 iconLabel.setBorder(SAMPLE_IMAGE_PADDING);
 return iconLabel;
}

相关文章

JLabel类方法