本文整理匯總了Java中javax.swing.JLabel.RIGHT屬性的典型用法代碼示例。如果您正苦於以下問題:Java JLabel.RIGHT屬性的具體用法?Java JLabel.RIGHT怎麽用?Java JLabel.RIGHT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類javax.swing.JLabel
的用法示例。
在下文中一共展示了JLabel.RIGHT屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addFormField
private void addFormField(JPanel detailsPanel, String name, JComponent field)
{
JPanel tempPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 4, 2));
JLabel tempLabel = new JLabel(name, JLabel.RIGHT);
// TODO: hard sizing of labels may not scale!
final int width = new JLabel("ZEN amount to send with every message:").getPreferredSize().width + 30;
tempLabel.setPreferredSize(new Dimension(width, tempLabel.getPreferredSize().height));
tempPanel.add(tempLabel);
tempPanel.add(field);
detailsPanel.add(tempPanel);
}
示例2: addFormField
private void addFormField(JPanel detailsPanel, String name, JComponent field)
{
JPanel tempPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 4, 2));
JLabel tempLabel = new JLabel(name, JLabel.RIGHT);
// TODO: hard sizing of labels may not scale!
final int width = new JLabel("Sender identiication T address:").getPreferredSize().width + 10;
tempLabel.setPreferredSize(new Dimension(width, tempLabel.getPreferredSize().height));
tempPanel.add(tempLabel);
tempPanel.add(field);
detailsPanel.add(tempPanel);
}
示例3: addNameValue
private void addNameValue(JPanel container, String name, String value) {
JPanel panel = new JPanel();
panel.setLayout(new FlowLayout(FlowLayout.LEFT, 6, 0));
container.add(panel);
JLabel label = new JLabel(name + ":", JLabel.RIGHT);
label.setPreferredSize(new Dimension(100, label.getPreferredSize().height));
panel.add(label);
panel.add(GuiTricks.unboldLabel(new JLabel(value, JLabel.LEFT)));
}
示例4: createConnectionDialog
/**
* Creates the connectionPanel, which will contain all the fields for
* the connection information.
*/
public void createConnectionDialog() {
// Create the labels and text fields.
userNameLabel = new JLabel("User name: ", JLabel.RIGHT);
userNameField = new JTextField("app");
passwordLabel = new JLabel("Password: ", JLabel.RIGHT);
passwordField = new JTextField("app");
serverLabel = new JLabel("Database URL: ", JLabel.RIGHT);
serverField = new JTextField("jdbc:derby://localhost:1527/sample");
driverLabel = new JLabel("Driver: ", JLabel.RIGHT);
driverField = new JTextField("org.apache.derby.jdbc.ClientDriver");
connectionPanel = new JPanel(false);
connectionPanel.setLayout(new BoxLayout(connectionPanel,
BoxLayout.X_AXIS));
JPanel namePanel = new JPanel(false);
namePanel.setLayout(new GridLayout(0, 1));
namePanel.add(userNameLabel);
namePanel.add(passwordLabel);
namePanel.add(serverLabel);
namePanel.add(driverLabel);
JPanel fieldPanel = new JPanel(false);
fieldPanel.setLayout(new GridLayout(0, 1));
fieldPanel.add(userNameField);
fieldPanel.add(passwordField);
fieldPanel.add(serverField);
fieldPanel.add(driverField);
connectionPanel.add(namePanel);
connectionPanel.add(fieldPanel);
}
示例5: buildAddressPanel
private JPanel buildAddressPanel() {
JPanel p = new JPanel();
p.setLayout(new LabeledPairLayout());
JLabel toLabel = new JLabel("To: ", JLabel.RIGHT);
JTextField toField = new JTextField(25);
p.add(toLabel, "label");
p.add(toField, "field");
JLabel subLabel = new JLabel("Subj: ", JLabel.RIGHT);
JTextField subField = new JTextField(25);
p.add(subLabel, "label");
p.add(subField, "field");
JLabel ccLabel = new JLabel("cc: ", JLabel.RIGHT);
JTextField ccField = new JTextField(25);
p.add(ccLabel, "label");
p.add(ccField, "field");
return p;
}