Java Code Examples for javax.swing.JLabel.TRAILING

The following are Jave code examples for showing how to use TRAILING 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: MaxSim   File: CFGOptionsPanel.java   View Source Code Vote up 6 votes
private void addColorChooser(JComponent c, String displayName, ColorChooser chooser) {
    GridBagLayout layout = (GridBagLayout)c.getLayout();
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.insets = new Insets(3, 3, 3, 3);
    constraints.weightx = 0.0;
    constraints.fill = GridBagConstraints.NONE;
    constraints.anchor = GridBagConstraints.EAST;
    JLabel label = new JLabel(displayName, JLabel.TRAILING);
    layout.setConstraints(label, constraints);
    c.add(label);
    constraints.anchor = GridBagConstraints.WEST;
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    layout.setConstraints(chooser, constraints);
    c.add(chooser);
    elements.add(chooser);
    label.setLabelFor(chooser);
}
 
Example 2
Project: MaxSim   File: CFGOptionsPanel.java   View Source Code Vote up 6 votes
private void addFontChooser(JComponent c, String displayName, FontChooser chooser) {
    GridBagLayout layout = (GridBagLayout)c.getLayout();
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.insets = new Insets(3, 3, 3, 3);
    constraints.weightx = 0.0;
    constraints.fill = GridBagConstraints.NONE;
    constraints.anchor = GridBagConstraints.EAST;
    JLabel label = new JLabel(displayName, JLabel.TRAILING);
    layout.setConstraints(label, constraints);
    c.add(label);
    constraints.insets = new Insets(3, 3, 3, 1);
    constraints.weightx = 1.0;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.anchor = GridBagConstraints.CENTER;
    layout.setConstraints(chooser.getPreview(), constraints);
    c.add(chooser.getPreview());
    constraints.insets = new Insets(3, 1, 3, 3);
    constraints.weightx = 0.0;
    constraints.fill = GridBagConstraints.NONE;
    constraints.anchor = GridBagConstraints.EAST;
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    layout.setConstraints(chooser.getButton(), constraints);
    c.add(chooser.getButton());
    elements.add(chooser);
    label.setLabelFor(chooser.getButton());
}
 
Example 3
Project: MaxSim   File: CFGOptionsPanel.java   View Source Code Vote up 6 votes
private void addFlagsEditor(JComponent c, String displayName) {
    GridBagLayout layout = (GridBagLayout)c.getLayout();
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.insets = new Insets(3, 3, 3, 3);
    constraints.weightx = 0.0;
    constraints.fill = GridBagConstraints.NONE;
    constraints.anchor = GridBagConstraints.NORTHEAST;
    FlagsEditor flagsEditor = new FlagsEditor();
    JLabel flagsLabel = new JLabel(displayName, JLabel.TRAILING);
    flagsLabel.setVerticalAlignment(SwingConstants.TOP);
    layout.setConstraints(flagsLabel, constraints);
    c.add(flagsLabel);
    constraints.weightx = 1.0;
    constraints.weighty = 1.0;
    constraints.fill = GridBagConstraints.BOTH;
    constraints.anchor = GridBagConstraints.CENTER;
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    layout.setConstraints(flagsEditor, constraints);
    c.add(flagsEditor);
    elements.add(flagsEditor);
    flagsLabel.setLabelFor(flagsEditor);
}
 
Example 4
Project: incubator-netbeans   File: LockContentionPanel.java   View Source Code Vote up 5 votes
private void initColumnsData() {
        columnCount = 3;
        
        columnWidths = new int[columnCount - 1]; // Width of the first column fits to width
        columnNames = new String[columnCount];
        columnToolTips = new String[columnCount];
        columnRenderers = new TableCellRenderer[columnCount];

        columnNames[0] = LOCKS_THREADS_COLUMN_NAME;
        columnToolTips[0] = LOCKS_THREADS_COLUMN_TOOLTIP;

//        columnNames[1] = TIME_COLUMN_NAME;
//        columnToolTips[1] = TIME_COLUMN_TOOLTIP;
        
        columnNames[1] = TIME_REL_COLUMN_NAME;
        columnToolTips[1] = TIME_REL_COLUMN_TOOLTIP;
        
        columnNames[2] = WAITS_COLUMN_NAME;
        columnToolTips[2] = WAITS_COLUMN_TOOLTIP;

        int maxWidth = getFontMetrics(getFont()).charWidth('W') * 12; // NOI18N // initial width of data columns

        columnRenderers[0] = null;

//        columnWidths[1 - 1] = maxWidth;
//        columnRenderers[1] = new CustomBarCellRenderer(0, 100);
        
        columnWidths[1 - 1] = maxWidth;
        columnRenderers[1] = new LabelBracketTableCellRenderer(JLabel.TRAILING);

        columnWidths[2 - 1] = maxWidth;
        columnRenderers[2] = new LabelTableCellRenderer(JLabel.TRAILING);
    }
 
Example 5
Project: freecol   File: ReportTradePanel.java   View Source Code Vote up 5 votes
private JLabel createNumberLabel(int value, boolean alwaysAddSign) {
    JLabel result = new JLabel(String.valueOf(value), JLabel.TRAILING);
    result.setBorder(Utility.CELLBORDER);
    if (value < 0) {
        result.setForeground(Color.RED);
    } else if (alwaysAddSign && value > 0) {
        result.setText("+" + value);
    }
    return result;
}
 
Example 6
Project: FreeCol   File: ReportTradePanel.java   View Source Code Vote up 5 votes
private JLabel createNumberLabel(int value, boolean alwaysAddSign) {
    JLabel result = new JLabel(String.valueOf(value), JLabel.TRAILING);
    result.setBorder(Utility.CELLBORDER);
    if (value < 0) {
        result.setForeground(Color.RED);
    } else if (alwaysAddSign && value > 0) {
        result.setText("+" + value);
    }
    return result;
}
 
Example 7
Project: incubator-netbeans   File: FieldsBrowserControllerUI.java   View Source Code Vote up 4 votes
private void initColumnsData() {
        columnWidths = new int[columnCount - 1]; // Width of the first column fits to width
        columnNames = new String[columnCount];
        columnToolTips = new String[columnCount];
        columnRenderers = new TableCellRenderer[columnCount];

        columnNames[0] = Bundle.FieldsBrowserControllerUI_FieldColumnName();
        columnToolTips[0] = Bundle.FieldsBrowserControllerUI_FieldColumnDescr();

        columnNames[1] = Bundle.FieldsBrowserControllerUI_TypeColumnName();
        columnToolTips[1] = Bundle.FieldsBrowserControllerUI_TypeColumnDescr();

        columnNames[2] = Bundle.FieldsBrowserControllerUI_FullTypeColumnName();
        columnToolTips[2] = Bundle.FieldsBrowserControllerUI_FullTypeColumnDescr();

        columnNames[3] = Bundle.FieldsBrowserControllerUI_ValueColumnName();
        columnToolTips[3] = Bundle.FieldsBrowserControllerUI_ValueColumnDescr();

        columnNames[4] = Bundle.FieldsBrowserControllerUI_SizeColumnName();
        columnToolTips[4] = Bundle.FieldsBrowserControllerUI_SizeColumnDescr();

        if (retainedSizeSupported) {
            columnNames[5] = Bundle.FieldsBrowserControllerUI_RetainedSizeColumnName();
            columnToolTips[5] = Bundle.FieldsBrowserControllerUI_RetainedSizeColumnDescr();
        }

        int unitWidth = getFontMetrics(getFont()).charWidth('W'); // NOI18N // initial width of data columns

//        FieldTreeCellRenderer treeCellRenderer = new FieldTreeCellRenderer(false);
//        treeCellRenderer.setLeafIcon(null);
//        treeCellRenderer.setClosedIcon(null);
//        treeCellRenderer.setOpenIcon(null);

        LabelTableCellRenderer dataCellRendererL = new LabelTableCellRenderer(JLabel.LEADING);
        LabelTableCellRenderer dataCellRendererT = new LabelTableCellRenderer(JLabel.TRAILING);

        // method / class / package name
        columnRenderers[0] = null;

        columnWidths[1 - 1] = unitWidth * 18;
        columnRenderers[1] = dataCellRendererL;

        columnWidths[2 - 1] = unitWidth * 28;
        columnRenderers[2] = dataCellRendererL;

        columnWidths[3 - 1] = unitWidth * 20;
        columnRenderers[3] = new FieldTableCellRenderer();

        columnWidths[4 - 1] = unitWidth * 7;
        columnRenderers[4] = dataCellRendererT;

        if (retainedSizeSupported) {
            columnWidths[5 - 1] = unitWidth * 7;
            columnRenderers[5] = dataCellRendererT;
        }
    }
 
Example 8
Project: incubator-netbeans   File: ReferencesBrowserControllerUI.java   View Source Code Vote up 4 votes
private void initColumnsData() {
        columnWidths = new int[columnCount - 1]; // Width of the first column fits to width
        columnNames = new String[columnCount];
        columnToolTips = new String[columnCount];
        columnRenderers = new TableCellRenderer[columnCount];

        columnNames[0] = Bundle.ReferencesBrowserControllerUI_FieldColumnName();
        columnToolTips[0] = Bundle.ReferencesBrowserControllerUI_FieldColumnDescr();

        columnNames[1] = Bundle.ReferencesBrowserControllerUI_TypeColumnName();
        columnToolTips[1] = Bundle.ReferencesBrowserControllerUI_TypeColumnDescr();

        columnNames[2] = Bundle.ReferencesBrowserControllerUI_FullTypeColumnName();
        columnToolTips[2] = Bundle.ReferencesBrowserControllerUI_FullTypeColumnDescr();

        columnNames[3] = Bundle.ReferencesBrowserControllerUI_ValueColumnName();
        columnToolTips[3] = Bundle.ReferencesBrowserControllerUI_ValueColumnDescr();

        columnNames[4] = Bundle.ReferencesBrowserControllerUI_SizeColumnName();
        columnToolTips[4] = Bundle.ReferencesBrowserControllerUI_SizeColumnDescr();

        if (retainedSizeSupported) {
            columnNames[5] = Bundle.ReferencesBrowserControllerUI_RetainedSizeColumnName();
            columnToolTips[5] = Bundle.ReferencesBrowserControllerUI_RetainedSizeColumnDescr();
        }

        int unitWidth = getFontMetrics(getFont()).charWidth('W'); // NOI18N // initial width of data columns

//        FieldTreeCellRenderer treeCellRenderer = new FieldTreeCellRenderer();
//        treeCellRenderer.setLeafIcon(null);
//        treeCellRenderer.setClosedIcon(null);
//        treeCellRenderer.setOpenIcon(null);

        LabelTableCellRenderer dataCellRendererL = new LabelTableCellRenderer(JLabel.LEADING);
        LabelTableCellRenderer dataCellRendererT = new LabelTableCellRenderer(JLabel.TRAILING);

        // method / class / package name
        columnRenderers[0] = null;

        columnWidths[1 - 1] = unitWidth * 18;
        columnRenderers[1] = dataCellRendererL;

        columnWidths[2 - 1] = unitWidth * 28;
        columnRenderers[2] = dataCellRendererL;

        columnWidths[3 - 1] = unitWidth * 20;
        columnRenderers[3] = new FieldTableCellRenderer();

        columnWidths[4 - 1] = unitWidth * 7;
        columnRenderers[4] = dataCellRendererT;

        if (retainedSizeSupported) {
            columnWidths[5 - 1] = unitWidth * 7;
            columnRenderers[5] = dataCellRendererT;
        }
    }
 
Example 9
Project: incubator-netbeans   File: ClassesListControllerUI.java   View Source Code Vote up 4 votes
private void initColumnsData() {
    columnWidths = new int[columnCount - 1]; // Width of the first column fits to width
    columnNames = new String[columnCount];
    columnToolTips = new String[columnCount];
    columnRenderers = new javax.swing.table.TableCellRenderer[columnCount];

    columnNames[0] = Bundle.ClassesListControllerUI_ClassNameColumnText();
    columnToolTips[0] = Bundle.ClassesListControllerUI_ClassNameColumnDescr();

    columnNames[1] = Bundle.ClassesListControllerUI_InstancesRelColumnText();
    columnToolTips[1] = Bundle.ClassesListControllerUI_InstancesRelColumnDescr();

    columnNames[2] = Bundle.ClassesListControllerUI_InstancesColumnText();
    columnToolTips[2] = Bundle.ClassesListControllerUI_InstancesColumnDescr();

    columnNames[3] = Bundle.ClassesListControllerUI_SizeColumnText();
    columnToolTips[3] = Bundle.ClassesListControllerUI_SizeColumnDescr();

    if (retainedSizeSupported) {
        columnNames[4] = Bundle.ClassesListControllerUI_RetainedSizeColumnName();
        columnToolTips[4] = Bundle.ClassesListControllerUI_RetainedSizeColumnDescr();
    }

    int maxWidth = getFontMetrics(getFont()).charWidth('W') * 12; // NOI18N // initial width of data columns

    ClassNameTableCellRenderer classNameCellRenderer = new ClassNameTableCellRenderer();
    CustomBarCellRenderer customBarCellRenderer = new CustomBarCellRenderer(0, 100);
    LabelBracketTableCellRenderer dataCellRenderer = new LabelBracketTableCellRenderer(JLabel.TRAILING);

    // method / class / package name
    columnRenderers[0] = classNameCellRenderer;

    columnWidths[1 - 1] = maxWidth;
    columnRenderers[1] = customBarCellRenderer;

    columnWidths[2 - 1] = maxWidth;
    columnRenderers[2] = dataCellRenderer;

    columnWidths[3 - 1] = maxWidth;
    columnRenderers[3] = dataCellRenderer;

    if (retainedSizeSupported) {
        columnWidths[4 - 1] = maxWidth;
        columnRenderers[4] = dataCellRenderer;
    }
}
 
Example 10
Project: incubator-netbeans   File: InstancesListControllerUI.java   View Source Code Vote up 4 votes
private void initColumnsData() {
        columnWidths = new int[columnCount - 1]; // Width of the first column fits to width
        columnNames = new String[columnCount];
        columnToolTips = new String[columnCount];
        columnRenderers = new TableCellRenderer[columnCount];

        columnNames[0] = Bundle.InstancesListControllerUI_InstanceColumnName();
        columnToolTips[0] = Bundle.InstancesListControllerUI_InstanceColumnDescr();

        columnNames[1] = Bundle.InstancesListControllerUI_ObjidColumnName();
        columnToolTips[1] = Bundle.InstancesListControllerUI_ObjidColumnDescr();
        
        columnNames[2] = Bundle.InstancesListControllerUI_SizeColumnName();
        columnToolTips[2] = Bundle.InstancesListControllerUI_SizeColumnDescr();

        if (retainedSizeSupported) {
            columnNames[3] = Bundle.InstancesListControllerUI_RetainedSizeColumnName();
            columnToolTips[3] = Bundle.InstancesListControllerUI_RetainedSizeColumnDescr();
        }

        // TODO: uncomment once reachable size implemented
        //    columnNames[3] = REACHABLE_SIZE_COLUMN_NAME;
        //    columnToolTips[3] = REACHABLE_SIZE_COLUMN_DESCR;
        int maxWidth = getFontMetrics(getFont()).charWidth('W') * 7; // NOI18N // initial width of data columns

//        FieldTreeCellRenderer treeCellRenderer = new FieldTreeCellRenderer();
//        treeCellRenderer.setLeafIcon(null);
//        treeCellRenderer.setClosedIcon(null);
//        treeCellRenderer.setOpenIcon(null);

        LabelTableCellRenderer dataCellRenderer = new LabelTableCellRenderer(JLabel.TRAILING);

        // method / class / package name
        columnRenderers[0] = null;

        // objectid
        columnWidths[1 - 1] = maxWidth;
        columnRenderers[1] = dataCellRenderer;
        
        columnWidths[2 - 1] = maxWidth;
        columnRenderers[2] = dataCellRenderer;

        if (retainedSizeSupported) {
            columnWidths[3 - 1] = maxWidth;
            columnRenderers[3] = dataCellRenderer;
        }
        
        // TODO: uncomment once reachable size implemented
        //    columnWidths[3 - 1] = maxWidth;
        //    columnRenderers[3] = dataCellRenderer;
    }
 
Example 11
Project: incubator-netbeans   File: DiffCCTDisplay.java   View Source Code Vote up 4 votes
protected void initColumnsData() {
    super.initColumnsData();
    columnRenderers[1] = new DiffBarCellRenderer(0, 0);
    columnRenderers[2] = new LabelTableCellRenderer(JLabel.TRAILING);
}
 
Example 12
Project: incubator-netbeans   File: DiffFlatProfilePanel.java   View Source Code Vote up 4 votes
protected void initColumnsData() {
    super.initColumnsData();
    columnRenderers[1] = new DiffBarCellRenderer(0, 0);
    columnRenderers[2] = new LabelTableCellRenderer(JLabel.TRAILING);
}
 
Example 13
Project: dracoon-dropzone   File: SettingsDialog.java   View Source Code Vote up 4 votes
private JPanel createHotCorners() {
	// main body
	JPanel main = new JPanel();
	main.setBorder(new EmptyBorder(10, 0, 0, 0));
	main.setLayout(new BoxLayout(main, BoxLayout.Y_AXIS));

	// Create and populate the panel.
	JPanel generalSettingsPanel = new JPanel(new SpringLayout());

	MatteBorder mb = new MatteBorder(1, 0, 0, 0, Color.LIGHT_GRAY);
	TitledBorder tb = new TitledBorder(mb, I18n.get("settings.hotcornertitle"), TitledBorder.LEFT,
			TitledBorder.DEFAULT_POSITION);
	generalSettingsPanel.setBorder(tb);

	JLabel cornerLabel = new JLabel(I18n.get("settings.hotcorner"), JLabel.TRAILING);
	generalSettingsPanel.add(cornerLabel);
	hotCornerBox = new JComboBox<>();
	cornerLabel.setLabelFor(hotCornerBox);
	generalSettingsPanel.add(hotCornerBox);
	DefaultComboBoxModel<ScreenPosition> cornerBoxModel = new DefaultComboBoxModel<ScreenPosition>(
			(ScreenPosition[]) Util.getScreenPositions());
	hotCornerBox.setModel(cornerBoxModel);

	JLabel userLabel = new JLabel(I18n.get("settings.hotcornerscreen"), JLabel.TRAILING);
	generalSettingsPanel.add(userLabel);
	screenBox = new JComboBox<>();

	DefaultComboBoxModel<ScreenModel> screenBoxModel = new DefaultComboBoxModel<ScreenModel>(
			(ScreenModel[]) Util.getScreens());
	screenBox.setModel(screenBoxModel);
	generalSettingsPanel.add(screenBox);
	

	JLabel darkIconLabel = new JLabel(I18n.get("settings.darkicon"), JLabel.TRAILING);
	generalSettingsPanel.add(darkIconLabel);
	darkIconInput = new JCheckBox();
	darkIconInput.setSelected(false);
	darkIconLabel.setLabelFor(darkIconInput);
	generalSettingsPanel.add(darkIconInput);

	

	// Lay out the panel.
	SwingUtil.makeCompactGrid(generalSettingsPanel, 3, 2, // rows, cols
			6, 6, // initX, initY
			6, 6); // xPad, yPad

	main.add(generalSettingsPanel);
	return main;
}
 
Example 14
Project: dracoon-dropzone   File: SettingsDialog.java   View Source Code Vote up 4 votes
private JPanel createCredentialsInput() {
	// main body
	JPanel main = new JPanel();
	main.setBorder(new EmptyBorder(10, 0, 10, 0));
	main.setLayout(new BoxLayout(main, BoxLayout.Y_AXIS));

	// Create and populate the panel.
	JPanel credentialsPanel = new JPanel(new SpringLayout());

	MatteBorder mb = new MatteBorder(1, 0, 0, 0, Color.LIGHT_GRAY);
	TitledBorder tb = new TitledBorder(mb, I18n.get("settings.credentials"), TitledBorder.LEFT,
			TitledBorder.DEFAULT_POSITION);
	credentialsPanel.setBorder(tb);

	JLabel serverLabel = new JLabel(I18n.get("settings.server"), JLabel.TRAILING);
	credentialsPanel.add(serverLabel);
	serverInput = new JTextField();
	serverLabel.setLabelFor(serverInput);
	credentialsPanel.add(serverInput);

	JLabel authLabel = new JLabel(I18n.get("settings.authmethod"), JLabel.TRAILING);
	credentialsPanel.add(authLabel);
	authBox = new JComboBox<>();
	authLabel.setLabelFor(authBox);
	credentialsPanel.add(authBox);

	JLabel pathLabel = new JLabel(I18n.get("settings.remotepath"), JLabel.TRAILING);
	credentialsPanel.add(pathLabel);
	pathInput = new JTextField();
	pathLabel.setLabelFor(pathInput);
	credentialsPanel.add(pathInput);

	JLabel userLabel = new JLabel(I18n.get("settings.username"), JLabel.TRAILING);
	credentialsPanel.add(userLabel);
	userInput = new JTextField();
	userLabel.setLabelFor(userInput);
	credentialsPanel.add(userInput);

	JLabel pwdLabel = new JLabel(I18n.get("settings.password"), JLabel.TRAILING);
	credentialsPanel.add(pwdLabel);
	pwdInput = new JPasswordField();
	pwdLabel.setLabelFor(pwdInput);
	credentialsPanel.add(pwdInput);

	JLabel enableMasterPwdLabel = new JLabel(I18n.get("settings.usemasterpwd"), JLabel.TRAILING);
	credentialsPanel.add(enableMasterPwdLabel);
	useMasterPasswordInput = new JCheckBox();
	useMasterPasswordInput.setSelected(false);
	useMasterPasswordInput.setToolTipText(I18n.get("settings.masterpwddesc"));
	enableMasterPwdLabel.setLabelFor(useMasterPasswordInput);
	credentialsPanel.add(useMasterPasswordInput);
	useMasterPasswordInput.addActionListener(new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			setMasterPwdInputEnabled(useMasterPasswordInput.isSelected());
		}
	});

	masterPwdLabel = new JLabel(I18n.get("settings.masterpwd"), JLabel.TRAILING);
	masterPwdLabel.setEnabled(false);
	credentialsPanel.add(masterPwdLabel);
	masterPwdInput = new JPasswordField();
	masterPwdInput.setToolTipText(I18n.get("settings.masterpwddesc"));
	masterPwdInput.setEnabled(false);
	masterPwdLabel.setLabelFor(masterPwdInput);
	credentialsPanel.add(masterPwdInput);

	// Lay out the panel.
	SwingUtil.makeCompactGrid(credentialsPanel, 7, 2, // rows, cols
			6, 6, // initX, initY
			6, 6); // xPad, yPad

	main.add(credentialsPanel);
	return main;
}