Java Code Examples for javax.swing.JLabel#RIGHT

The following examples show how to use javax.swing.JLabel#RIGHT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReplayListColumnSetupDialog.java    From sc2gears with Apache License 2.0 6 votes vote down vote up
public ColumnDef( final int modelIndex ) {
	this.modelIndex = modelIndex;
	positionLabel = new JLabel( "", JLabel.RIGHT );
	positionLabel.setPreferredSize( new Dimension( 40, 0 ) );
	nameLabel     = new JLabel( ReplaySearch.RESULT_HEADER_NAMES[ modelIndex ], JLabel.LEFT );
	GuiUtils.changeFontToBold( nameLabel );
	
	wrapperBox.add( positionLabel );
	wrapperBox.add( Box.createHorizontalStrut( 10 ) );
	wrapperBox.add( Box.createHorizontalGlue() );
	wrapperBox.add( nameLabel );
	wrapperBox.add( Box.createHorizontalStrut( 20 ) );
	wrapperBox.add( moveUpButton );
	wrapperBox.add( moveDownButton );
	wrapperBox.add( Box.createHorizontalStrut( 20 ) );
	wrapperBox.add( visibleCheckBox );
}
 
Example 2
Source File: AbstractPlUmlEditor.java    From netbeans-mmd-plugin with Apache License 2.0 6 votes vote down vote up
@Nonnull
protected JLabel makeLinkLabel(@Nonnull final String text, @Nonnull final Runnable onClick,
                               @Nonnull final String toolTip, @Nonnull final Icon icon) {
  final JLabel result = new JLabel(text, icon, JLabel.RIGHT);
  final Font font = result.getFont().deriveFont(Font.BOLD);
  final Map attributes = font.getAttributes();
  attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
  result.setFont(font.deriveFont(attributes));
  result.setForeground(UiUtils.DARK_THEME ? Color.YELLOW : Color.BLUE);
  result.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
  result.setToolTipText(toolTip);
  result.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseClicked(@Nonnull final MouseEvent e) {
      onClick.run();
    }
  });
  result.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 16));
  return result;
}
 
Example 3
Source File: LabelComponentPanel.java    From swift-explorer with Apache License 2.0 5 votes vote down vote up
public LabelComponentPanel(String label, JComponent comp) {
    super(new BorderLayout(8, 0));
    setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    JLabel lbl = new JLabel(label, JLabel.RIGHT);
    lbl.setLabelFor(comp);
    lbl.setPreferredSize(new Dimension(128, 24));
    this.add(lbl, BorderLayout.WEST);
    this.add(comp, BorderLayout.CENTER);
}
 
Example 4
Source File: TableExample.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 5
Source File: IdentityInfoDialog.java    From zencash-swing-wallet-ui with MIT License 5 votes vote down vote up
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 identification T address:").getPreferredSize().width + 10;
	tempLabel.setPreferredSize(new Dimension(width, tempLabel.getPreferredSize().height));
	tempPanel.add(tempLabel);
	tempPanel.add(field);
	detailsPanel.add(tempPanel);
}
 
Example 6
Source File: MessagingOptionsEditDialog.java    From zencash-swing-wallet-ui with MIT License 5 votes vote down vote up
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);
}
 
Example 7
Source File: TableExample.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 8
Source File: TableExample.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 9
Source File: TableExample.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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);
}
 
Example 10
Source File: MetalworksDocumentFrame.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
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;

}
 
Example 11
Source File: TabPanelSponsorship.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
public void initializeUI() {
		uiDone = true;
		
		// Create general label panel.
		JPanel labelPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
		topContentPanel.add(labelPanel);

		// Prepare general label
		JLabel titleLabel = new JLabel(Msg.getString("TabPanelSponsorship.label"), JLabel.CENTER); //$NON-NLS-1$
		titleLabel.setFont(new Font("Serif", Font.BOLD, 16));
		labelPanel.add(titleLabel);

		// Prepare spring layout info panel.
		JPanel infoPanel = new JPanel(new SpringLayout());//GridLayout(2, 2, 0, 0));
//		infoPanel.setBorder(new MarsPanelBorder());
		centerContentPanel.add(infoPanel, BorderLayout.NORTH);

		// Prepare sponsor name label
		JLabel sponsorNameLabel = new JLabel(Msg.getString("TabPanelSponsorship.sponsor"), JLabel.RIGHT); //$NON-NLS-1$
		//sponsorNameLabel.setSize(2, 2);
		infoPanel.add(sponsorNameLabel);

		// Prepare sponsor label
		JTextField sponsorTF = new JTextField();
		ReportingAuthorityType sponsor = null;
		if (person.getReportingAuthority() != null) {
		    sponsor = person.getReportingAuthority().getOrg();
		    sponsorTF.setText(sponsor+""); // Conversion.capitalize(sponsor)
		}
		sponsorTF.setEditable(false);
		sponsorTF.setColumns(8);
		sponsorTF.setCaretPosition(0);
		if (person.getReportingAuthority() != null) {
			TooltipManager.setTooltip (sponsorTF, person.getReportingAuthority().getToolTipStr(), TooltipWay.down);
		}
		infoPanel.add(sponsorTF);


		// Prepare birth location name label
		JLabel objectiveNameLabel = new JLabel(Msg.getString("TabPanelSponsorship.objective"), JLabel.RIGHT); //$NON-NLS-1$
		//objectiveNameLabel.setSize(2, 2);
		infoPanel.add(objectiveNameLabel);

		// Prepare birth location label
		String objective = null;
		JTextField objectiveTF = new JTextField();
		if (person.getReportingAuthority() != null) {
			objective = person.getReportingAuthority().getMissionAgenda().getObjectiveName();
		}
		//JLabel objectiveLabel = new JLabel(objective, JLabel.RIGHT);
		objectiveTF.setText(Conversion.capitalize(objective));
		objectiveTF.setEditable(false);
		objectiveTF.setColumns(16);
		objectiveTF.setCaretPosition(0);
		infoPanel.add(objectiveTF);

		//Lay out the spring panel.
		SpringUtilities.makeCompactGrid(infoPanel,
		                                2, 2, //rows, cols
		                                20, 10,        //initX, initY
		                                10, 10);       //xPad, yPad
	}
 
Example 12
Source File: MetalworksDocumentFrame.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
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;

}
 
Example 13
Source File: ResearcherPanel.java    From mars-sim with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Constructor.
 */
public ResearcherPanel(ScienceWindow scienceWindow) {

	// Use JPanel constructor
	super();

	this.scienceWindow = scienceWindow;

	// Set card layout.
	setLayout(new CardLayout());

	// Create blank panel.
	JPanel blankPane = new JPanel();
	add(blankPane, Msg.getString("ResearcherPanel.blank")); //$NON-NLS-1$

	// Create researcher panel.
	JPanel researcherPane = new JPanel(new BorderLayout());
	researcherPane.setBorder(new MarsPanelBorder());
	add(researcherPane, Msg.getString("ResearcherPanel.researcher")); //$NON-NLS-1$

	// Create the top spring pane
	JPanel topSpringPane = new JPanel(new SpringLayout());// new GridLayout(2, 2, 0, 0));
	researcherPane.add(topSpringPane, BorderLayout.CENTER);

	// Create title label.
	researcherHeader = new JLabel(Msg.getString("ResearcherPanel.primaryResearcher"), JLabel.RIGHT); //$NON-NLS-1$
	topSpringPane.add(researcherHeader);

	// Create name button.
	nameButton = new JButton("[ TBA ]"); //$NON-NLS-1$
	nameButton.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent arg0) {
			// Open window for researcher.
			if (researcher != null)
				openResearcherWindow(researcher);
		}
	});
	topSpringPane.add(nameButton);

	// Create science label.
	JLabel scienceHeader = new JLabel(Msg.getString("ResearcherPanel.subjectHeader"), JLabel.RIGHT); //$NON-NLS-1$
	topSpringPane.add(scienceHeader);

	scienceLabel = new JLabel("[ TBA ]"); //$NON-NLS-1$
	topSpringPane.add(scienceLabel);

	// Create activity label.
	JLabel activityHeader = new JLabel(Msg.getString("ResearcherPanel.phaseHeader"), JLabel.RIGHT); //$NON-NLS-1$
	topSpringPane.add(activityHeader);// , BorderLayout.WEST);

	activityLabel = new JLabel("[ TBA ]"); //$NON-NLS-1$
	topSpringPane.add(activityLabel);// , BorderLayout.WEST);

	// Create activity bar panel.
	activityBarPane = new JPanel(new CardLayout());
	researcherPane.add(activityBarPane, BorderLayout.SOUTH);

	// Create blank activity bar panel.
	JPanel blankActivityBarPane = new JPanel();
	activityBarPane.add(blankActivityBarPane, Msg.getString("ResearcherPanel.blankActivityBar")); //$NON-NLS-1$

	// Create activity progress bar.
	activityBar = new JProgressBar(0, 100);
	activityBar.setStringPainted(true);
	activityBarPane.add(activityBar, Msg.getString("ResearcherPanel.showActivityBar")); //$NON-NLS-1$

	// Prepare SpringLayout
	SpringUtilities.makeCompactGrid(topSpringPane, 3, 2, // rows, cols
			5, 4, // initX, initY
			30, 3); // xPad, yPad
}
 
Example 14
Source File: MetalworksDocumentFrame.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
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;

}
 
Example 15
Source File: MetalworksDocumentFrame.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
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;

}
 
Example 16
Source File: MetalworksDocumentFrame.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
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;

}
 
Example 17
Source File: MetalworksDocumentFrame.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
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;

}
 
Example 18
Source File: MetalworksDocumentFrame.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
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;

}
 
Example 19
Source File: MetalworksDocumentFrame.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
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;

}
 
Example 20
Source File: MetalworksDocumentFrame.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
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;

}