Java Code Examples for javax.swing.JLabel.setAlignmentY()

The following are Jave code examples for showing how to use setAlignmentY() of the javax.swing.JLabel class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: incubator-netbeans   File: VCSCommitParameters.java   View Source Code Vote up 4 votes
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);    
}
 
Example 2
Project: Equella   File: GeneralDialog.java   View Source Code Vote up 4 votes
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)));
}