本文整理汇总了Java中javax.swing.JLabel.setAlignmentY方法的典型用法代码示例。如果您正苦于以下问题:Java JLabel.setAlignmentY方法的具体用法?Java JLabel.setAlignmentY怎么用?Java JLabel.setAlignmentY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JLabel
的用法示例。
在下文中一共展示了JLabel.setAlignmentY方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ParametersPanel
import javax.swing.JLabel; //导入方法依赖的package包/类
public ParametersPanel() {
messageLabel.setLabelFor(messageTextArea);
Mnemonics.setLocalizedText(messageLabel, getMessage("CTL_CommitForm_Message")); // NOI18N
JLabel templateLink = getMessagesTemplateLink(messageTextArea, "org.netbeans.modules.versioning.util.common.TemplatePanel"); //NOI18N
JLabel recentLink = getRecentMessagesLink(messageTextArea);
messageTextArea.setColumns(60); //this determines the preferred width of the whole dialog
messageTextArea.setLineWrap(true);
messageTextArea.setRows(4);
messageTextArea.setTabSize(4);
messageTextArea.setWrapStyleWord(true);
messageTextArea.setMinimumSize(new Dimension(100, 18));
scrollpane.setViewportView(messageTextArea);
messageTextArea.getAccessibleContext().setAccessibleName(getMessage("ACSN_CommitForm_Message")); // NOI18N
messageTextArea.getAccessibleContext().setAccessibleDescription(getMessage("ACSD_CommitForm_Message")); // NOI18N
if(commitMessage != null) {
messageTextArea.setText(commitMessage);
}
JPanel topPanel = new VerticallyNonResizingPanel();
topPanel.setLayout(new BoxLayout(topPanel, BoxLayout.X_AXIS));
topPanel.add(messageLabel);
topPanel.add(Box.createHorizontalGlue());
topPanel.add(recentLink);
topPanel.add(makeHorizontalStrut(recentLink, templateLink, RELATED, this));
topPanel.add(templateLink);
messageLabel.setAlignmentX(LEFT_ALIGNMENT);
messageLabel.setAlignmentY(BOTTOM_ALIGNMENT);
recentLink.setAlignmentY(BOTTOM_ALIGNMENT);
templateLink.setAlignmentY(BOTTOM_ALIGNMENT);
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
topPanel.setAlignmentY(BOTTOM_ALIGNMENT);
add(topPanel);
add(makeVerticalStrut(messageLabel, scrollpane, RELATED, this));
add(scrollpane);
Spellchecker.register (messageTextArea);
}
示例2: setupGUI
import javax.swing.JLabel; //导入方法依赖的package包/类
protected void setupGUI()
{
inner = new JPanel();
inner.setLayout(new GridLayout(1, 1));
okButton = new JButton(CurrentLocale.get("com.dytech.edge.admin.helper.ok"));
cancelButton = new JButton(CurrentLocale.get("com.dytech.edge.admin.helper.cancel"));
okButton.addActionListener(this);
cancelButton.addActionListener(this);
JLabel heading = new JLabel("<html><b>" + title + "</b>");
heading.setAlignmentY(Component.BOTTOM_ALIGNMENT);
JPanel top = new JPanel();
top.setLayout(new BoxLayout(top, BoxLayout.X_AXIS));
top.add(Box.createRigidArea(new Dimension(5, 0)));
top.add(new JLabel(new ImageIcon(GeneralDialog.class.getResource(QUESTION_MARK))));
top.add(Box.createRigidArea(new Dimension(5, 0)));
top.add(heading);
top.add(Box.createHorizontalGlue());
JPanel bottom = new JPanel();
bottom.setLayout(new BoxLayout(bottom, BoxLayout.X_AXIS));
bottom.add(Box.createHorizontalGlue());
bottom.add(okButton);
bottom.add(Box.createRigidArea(new Dimension(5, 0)));
bottom.add(cancelButton);
bottom.setMaximumSize(bottom.getPreferredSize());
JPanel middle = new JPanel();
middle.setLayout(new BoxLayout(middle, BoxLayout.X_AXIS));
middle.add(Box.createRigidArea(new Dimension(37, 0)));
middle.add(inner);
middle.add(Box.createRigidArea(new Dimension(5, 0)));
content = new JPanel();
content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));
content.add(Box.createRigidArea(new Dimension(0, 5)));
content.add(top);
content.add(Box.createRigidArea(new Dimension(0, 5)));
content.add(middle);
content.add(Box.createRigidArea(new Dimension(0, 5)));
content.add(bottom);
content.add(Box.createRigidArea(new Dimension(0, 5)));
}