Java Code Examples for javax.swing.JLabel#TRAILING

The following examples show how to use javax.swing.JLabel#TRAILING . 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: LockContentionPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
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 2
Source File: ReportTradePanel.java    From freecol with GNU General Public License v2.0 5 votes vote down vote up
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 3
Source File: AccountsPanel.java    From btdex with GNU General Public License v3.0 5 votes vote down vote up
private void createFields(HashMap<String,String> fields, boolean editable) {
	formPanel.removeAll();
	formFields.clear();

	for (String key : market.getFieldKeys()) {
		JLabel l = new JLabel(market.getFieldDescription(key), JLabel.TRAILING);
		formPanel.add(l);
		JComponent editor = market.getFieldEditor(key, editable, fields);
		formFields.put(key, editor);
		l.setLabelFor(editor);
		formPanel.add(editor);
	}			
	SpringUtilities.makeCompactGrid(formPanel, fields.size(), 2, 0, 0, PAD, PAD);
	validate();
}
 
Example 4
Source File: GenericTagPanel.java    From jpexs-decompiler with GNU General Public License v3.0 5 votes vote down vote up
private void addRow(String name, Component editor, Field field) {
    JLabel label = new JLabel(name + ":", JLabel.TRAILING);
    label.setVerticalAlignment(JLabel.TOP);
    genericTagPropertiesEditPanel.add(label);
    label.setLabelFor(editor);
    labels.put(name, label);
    genericTagPropertiesEditPanel.add(editor);
    JLabel typeLabel = new JLabel(swfTypeToString(field.getAnnotation(SWFType.class)), JLabel.TRAILING);
    typeLabel.setVerticalAlignment(JLabel.TOP);
    genericTagPropertiesEditPanel.add(typeLabel);
    types.put(name, typeLabel);
    keys.add(name);
}
 
Example 5
Source File: ReferencesBrowserControllerUI.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
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 6
Source File: CreateIFrame.java    From JavaMainRepo with Apache License 2.0 4 votes vote down vote up
/**
 * 
 * @param title
 *            Title of the frame.
 */
public CreateIFrame(final String title) {
	super(title);

	// Sets up the view and adds the components
	contentPanel.setLayout(new GridLayout(2, 7, 0, 0));
	JPanel calcPanel = new JPanel();
	contentPanel.add(calcPanel);
	SpringLayout slPanel = new SpringLayout();
	calcPanel.setLayout(slPanel);
	JLabel l = new JLabel("Name:", JLabel.TRAILING);
	calcPanel.add(l);
	slPanel.putConstraint(SpringLayout.NORTH, l, 25, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l, 0, SpringLayout.WEST, calcPanel);
	l.setLabelFor(name);
	calcPanel.add(name);
	slPanel.putConstraint(SpringLayout.NORTH, name, 25, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, name, 127, SpringLayout.WEST, calcPanel);
	JLabel l1 = new JLabel("Number of legs:", JLabel.TRAILING);
	calcPanel.add(l1);
	l1.setLabelFor(nrOfLegs);
	slPanel.putConstraint(SpringLayout.NORTH, l1, 45, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l1, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(nrOfLegs);
	slPanel.putConstraint(SpringLayout.NORTH, nrOfLegs, 45, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, nrOfLegs, 127, SpringLayout.WEST, calcPanel);
	JLabel l2 = new JLabel("Is dangerous?:", JLabel.TRAILING);
	calcPanel.add(l2);
	l2.setLabelFor(dangerousT);
	slPanel.putConstraint(SpringLayout.NORTH, l2, 65, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l2, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(dangerousT);
	slPanel.putConstraint(SpringLayout.NORTH, dangerousT, 65, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, dangerousT, 127, SpringLayout.WEST, calcPanel);
	calcPanel.add(dangerousF);
	slPanel.putConstraint(SpringLayout.NORTH, dangerousF, 65, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, dangerousF, 177, SpringLayout.WEST, calcPanel);
	ButtonGroup group = new ButtonGroup();
	group.add(dangerousT);
	group.add(dangerousF);
	JLabel l4 = new JLabel("Danger percentage:", JLabel.TRAILING);
	calcPanel.add(l4);
	l4.setLabelFor(dangerPerc);
	slPanel.putConstraint(SpringLayout.NORTH, l4, 107, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l4, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(dangerPerc);
	slPanel.putConstraint(SpringLayout.NORTH, dangerPerc, 110, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, dangerPerc, 127, SpringLayout.WEST, calcPanel);

	JLabel l5 = new JLabel("Maintenance cost:", JLabel.TRAILING);
	calcPanel.add(l5);
	l5.setLabelFor(maintenanceCost);
	slPanel.putConstraint(SpringLayout.NORTH, l5, 127, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l5, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(maintenanceCost);
	slPanel.putConstraint(SpringLayout.NORTH, maintenanceCost, 127, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, maintenanceCost, 127, SpringLayout.WEST, calcPanel);
	calcPanel.add(createButton);
	slPanel.putConstraint(SpringLayout.NORTH, createButton, 155, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, createButton, 160, SpringLayout.WEST, calcPanel);
	JLabel l3 = new JLabel("Can fly?:", JLabel.TRAILING);
	calcPanel.add(l3);
	l3.setLabelFor(canFlyT);

	slPanel.putConstraint(SpringLayout.NORTH, l3, 86, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l3, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(canFlyT);
	slPanel.putConstraint(SpringLayout.NORTH, canFlyT, 86, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, canFlyT, 127, SpringLayout.WEST, calcPanel);
	calcPanel.add(canFlyF);
	slPanel.putConstraint(SpringLayout.NORTH, canFlyF, 86, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, canFlyF, 177, SpringLayout.WEST, calcPanel);
	ButtonGroup group1 = new ButtonGroup();
	group1.add(canFlyT);
	group1.add(canFlyF);
	JLabel l6 = new JLabel("Choose insect:", JLabel.TRAILING);
	calcPanel.add(l6);
	l6.setLabelFor(butterfly);

	slPanel.putConstraint(SpringLayout.NORTH, l6, 0, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l6, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(butterfly);
	slPanel.putConstraint(SpringLayout.NORTH, butterfly, 0, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, butterfly, 120, SpringLayout.WEST, calcPanel);
	calcPanel.add(cockroach);
	slPanel.putConstraint(SpringLayout.NORTH, cockroach, 0, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, cockroach, 195, SpringLayout.WEST, calcPanel);
	calcPanel.add(spider);
	slPanel.putConstraint(SpringLayout.NORTH, spider, 0, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, spider, 280, SpringLayout.WEST, calcPanel);
	ButtonGroup group2 = new ButtonGroup();
	group2.add(butterfly);
	group2.add(cockroach);
	group2.add(spider);
}
 
Example 7
Source File: CreateBFrame.java    From JavaMainRepo with Apache License 2.0 4 votes vote down vote up
/**
 * 
 * @param title
 *            Title of the frame.
 */
public CreateBFrame(final String title) {
	super(title);

	// Sets up the view and adds the components
	contentPanel.setLayout(new GridLayout(2, 7, 0, 0));
	JPanel calcPanel = new JPanel();
	contentPanel.add(calcPanel);
	SpringLayout slPanel = new SpringLayout();
	calcPanel.setLayout(slPanel);
	JLabel l = new JLabel("Name:", JLabel.TRAILING);
	calcPanel.add(l);
	slPanel.putConstraint(SpringLayout.NORTH, l, 25, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l, 0, SpringLayout.WEST, calcPanel);
	l.setLabelFor(name);
	calcPanel.add(name);
	slPanel.putConstraint(SpringLayout.NORTH, name, 25, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, name, 127, SpringLayout.WEST, calcPanel);
	JLabel l1 = new JLabel("Number of legs:", JLabel.TRAILING);
	calcPanel.add(l1);
	l1.setLabelFor(nrOfLegs);
	slPanel.putConstraint(SpringLayout.NORTH, l1, 45, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l1, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(nrOfLegs);
	slPanel.putConstraint(SpringLayout.NORTH, nrOfLegs, 45, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, nrOfLegs, 127, SpringLayout.WEST, calcPanel);
	JLabel l2 = new JLabel("Average flight altitude:", JLabel.TRAILING);
	calcPanel.add(l2);
	l2.setLabelFor(avgFlightAltitude);
	slPanel.putConstraint(SpringLayout.NORTH, l2, 65, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l2, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(avgFlightAltitude);
	slPanel.putConstraint(SpringLayout.NORTH, avgFlightAltitude, 65, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, avgFlightAltitude, 127, SpringLayout.WEST, calcPanel);
	JLabel l4 = new JLabel("Danger percentage:", JLabel.TRAILING);
	calcPanel.add(l4);
	l4.setLabelFor(dangerPerc);
	slPanel.putConstraint(SpringLayout.NORTH, l4, 107, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l4, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(dangerPerc);
	slPanel.putConstraint(SpringLayout.NORTH, dangerPerc, 110, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, dangerPerc, 127, SpringLayout.WEST, calcPanel);
	JLabel l5 = new JLabel("Maintenance cost:", JLabel.TRAILING);
	calcPanel.add(l5);
	l5.setLabelFor(maintenanceCost);
	slPanel.putConstraint(SpringLayout.NORTH, l5, 127, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l5, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(maintenanceCost);
	slPanel.putConstraint(SpringLayout.NORTH, maintenanceCost, 127, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, maintenanceCost, 127, SpringLayout.WEST, calcPanel);
	calcPanel.add(createButton);
	slPanel.putConstraint(SpringLayout.NORTH, createButton, 155, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, createButton, 160, SpringLayout.WEST, calcPanel);
	JLabel l3 = new JLabel("Migrates:", JLabel.TRAILING);
	calcPanel.add(l3);
	l3.setLabelFor(migratesT);

	slPanel.putConstraint(SpringLayout.NORTH, l3, 85, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l3, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(migratesT);
	slPanel.putConstraint(SpringLayout.NORTH, migratesT, 85, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, migratesT, 127, SpringLayout.WEST, calcPanel);
	slPanel.putConstraint(SpringLayout.NORTH, migratesF, 85, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, migratesF, 187, SpringLayout.WEST, calcPanel);
	calcPanel.add(migratesF);
	ButtonGroup group = new ButtonGroup();
	group.add(migratesT);
	group.add(migratesF);
	JLabel l6 = new JLabel("Choose bird:", JLabel.TRAILING);
	calcPanel.add(l6);
	l6.setLabelFor(pelican);

	slPanel.putConstraint(SpringLayout.NORTH, l6, 0, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l6, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(pelican);
	slPanel.putConstraint(SpringLayout.NORTH, pelican, 0, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, pelican, 120, SpringLayout.WEST, calcPanel);
	calcPanel.add(whitestork);
	slPanel.putConstraint(SpringLayout.NORTH, whitestork, 0, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, whitestork, 190, SpringLayout.WEST, calcPanel);
	calcPanel.add(eagle);
	slPanel.putConstraint(SpringLayout.NORTH, eagle, 0, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, eagle, 280, SpringLayout.WEST, calcPanel);
	ButtonGroup group1 = new ButtonGroup();
	group1.add(pelican);
	group1.add(whitestork);
	group1.add(eagle);
}
 
Example 8
Source File: SharedFunctions.java    From zap-extensions with Apache License 2.0 4 votes vote down vote up
public static void createLabel(JPanel pnl, String str, Font font) {
    JLabel lbl = new JLabel(str, JLabel.TRAILING);
    lbl.setFont(font);
    pnl.add(lbl);
}
 
Example 9
Source File: HttpFuzzerMessageProcessorTagUIPanel.java    From zap-extensions with Apache License 2.0 4 votes vote down vote up
private void addLabelWithTextField(JTextField textField, String labelName) {
    JLabel label = new JLabel(labelName, JLabel.TRAILING);
    fieldsPanel.add(label);
    label.setLabelFor(textField);
    fieldsPanel.add(textField);
}
 
Example 10
Source File: CreateRFrame.java    From JavaMainRepo with Apache License 2.0 4 votes vote down vote up
/**
 * 
 * @param title
 */
public CreateRFrame(final String title) {
	super(title);

	// Sets up the view and adds the components
	contentPanel.setLayout(new GridLayout(2, 7, 0, 0));
	JPanel calcPanel = new JPanel();
	contentPanel.add(calcPanel);
	SpringLayout slPanel = new SpringLayout();
	calcPanel.setLayout(slPanel);
	JLabel l = new JLabel("Name:", JLabel.TRAILING);
	calcPanel.add(l);
	slPanel.putConstraint(SpringLayout.NORTH, l, 25, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l, 0, SpringLayout.WEST, calcPanel);
	l.setLabelFor(name);
	calcPanel.add(name);
	slPanel.putConstraint(SpringLayout.NORTH, name, 25, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, name, 120, SpringLayout.WEST, calcPanel);
	JLabel l1 = new JLabel("Number of legs:", JLabel.TRAILING);
	calcPanel.add(l1);
	l1.setLabelFor(nrOfLegs);
	slPanel.putConstraint(SpringLayout.NORTH, l1, 45, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l1, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(nrOfLegs);
	slPanel.putConstraint(SpringLayout.NORTH, nrOfLegs, 45, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, nrOfLegs, 120, SpringLayout.WEST, calcPanel);
	JLabel l4 = new JLabel("Danger percentage:", JLabel.TRAILING);
	calcPanel.add(l4);
	l4.setLabelFor(dangerPerc);
	slPanel.putConstraint(SpringLayout.NORTH, l4, 90, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l4, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(dangerPerc);
	slPanel.putConstraint(SpringLayout.NORTH, dangerPerc, 90, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, dangerPerc, 120, SpringLayout.WEST, calcPanel);
	JLabel l5 = new JLabel("Maintenance cost:", JLabel.TRAILING);
	calcPanel.add(l5);
	l5.setLabelFor(maintenanceCost);
	slPanel.putConstraint(SpringLayout.NORTH, l5, 110, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l5, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(maintenanceCost);
	slPanel.putConstraint(SpringLayout.NORTH, maintenanceCost, 110, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, maintenanceCost, 120, SpringLayout.WEST, calcPanel);
	calcPanel.add(createButton);
	slPanel.putConstraint(SpringLayout.NORTH, createButton, 130, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, createButton, 160, SpringLayout.WEST, calcPanel);
	JLabel l3 = new JLabel("Lays eggs?:", JLabel.TRAILING);
	calcPanel.add(l3);
	l3.setLabelFor(layEggsT);

	slPanel.putConstraint(SpringLayout.NORTH, l3, 64, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l3, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(layEggsT);
	slPanel.putConstraint(SpringLayout.NORTH, layEggsT, 64, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, layEggsT, 120, SpringLayout.WEST, calcPanel);
	calcPanel.add(layEggsF);
	slPanel.putConstraint(SpringLayout.NORTH, layEggsF, 64, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, layEggsF, 170, SpringLayout.WEST, calcPanel);
	ButtonGroup group1 = new ButtonGroup();
	group1.add(layEggsT);
	group1.add(layEggsF);

	JLabel l6 = new JLabel("Choose reptile:", JLabel.TRAILING);
	calcPanel.add(l6);
	l6.setLabelFor(boomslang);

	slPanel.putConstraint(SpringLayout.NORTH, l6, 0, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l6, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(boomslang);
	slPanel.putConstraint(SpringLayout.NORTH, boomslang, 0, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, boomslang, 120, SpringLayout.WEST, calcPanel);
	calcPanel.add(tuatara);
	slPanel.putConstraint(SpringLayout.NORTH, tuatara, 0, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, tuatara, 210, SpringLayout.WEST, calcPanel);
	calcPanel.add(turtle);
	slPanel.putConstraint(SpringLayout.NORTH, turtle, 0, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, turtle, 280, SpringLayout.WEST, calcPanel);
	ButtonGroup group = new ButtonGroup();
	group.add(boomslang);
	group.add(tuatara);
	group.add(turtle);

}
 
Example 11
Source File: CreateCFrame.java    From JavaMainRepo with Apache License 2.0 4 votes vote down vote up
/**
 * 
 * @param title
 *            The title of the frame.
 */
public CreateCFrame(final String title) {
	super(title);

	// Sets up the view and adds the components
	contentPanel.setLayout(new GridLayout(2, 5, 0, 0));
	JPanel calcPanel = new JPanel();
	contentPanel.add(calcPanel);
	SpringLayout slPanel = new SpringLayout();
	calcPanel.setLayout(slPanel);
	JLabel l = new JLabel("Name:", JLabel.TRAILING);
	calcPanel.add(l);
	slPanel.putConstraint(SpringLayout.NORTH, l, 0, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l, 0, SpringLayout.WEST, calcPanel);
	l.setLabelFor(name);
	calcPanel.add(name);
	slPanel.putConstraint(SpringLayout.NORTH, name, 0, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, name, 90, SpringLayout.WEST, calcPanel);
	JLabel l1 = new JLabel("ID:", JLabel.TRAILING);
	calcPanel.add(l1);
	l1.setLabelFor(id);
	slPanel.putConstraint(SpringLayout.NORTH, l1, 20, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l1, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(id);
	slPanel.putConstraint(SpringLayout.NORTH, id, 20, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, id, 90, SpringLayout.WEST, calcPanel);
	id.setText(UUID.randomUUID().toString());
	JLabel l4 = new JLabel("Salary:", JLabel.TRAILING);
	calcPanel.add(l4);
	l4.setLabelFor(salary);
	slPanel.putConstraint(SpringLayout.NORTH, l4, 40, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l4, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(salary);
	slPanel.putConstraint(SpringLayout.NORTH, salary, 40, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, salary, 90, SpringLayout.WEST, calcPanel);
	JLabel l5 = new JLabel("Working hours:", JLabel.TRAILING);
	calcPanel.add(l5);
	l5.setLabelFor(workingHours);
	slPanel.putConstraint(SpringLayout.NORTH, l5, 60, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l5, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(workingHours);
	slPanel.putConstraint(SpringLayout.NORTH, workingHours, 60, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, workingHours, 90, SpringLayout.WEST, calcPanel);
	calcPanel.add(createButton);
	slPanel.putConstraint(SpringLayout.NORTH, createButton, 105, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, createButton, 150, SpringLayout.WEST, calcPanel);
	JLabel l3 = new JLabel("Alive?:", JLabel.TRAILING);
	calcPanel.add(l3);
	l3.setLabelFor(alive);
	alive.setSelected(true);
	slPanel.putConstraint(SpringLayout.NORTH, l3, 80, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l3, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(alive);
	slPanel.putConstraint(SpringLayout.NORTH, alive, 80, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, alive, 90, SpringLayout.WEST, calcPanel);

}
 
Example 12
Source File: DiffCCTDisplay.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
protected void initColumnsData() {
    super.initColumnsData();
    columnRenderers[1] = new DiffBarCellRenderer(0, 0);
    columnRenderers[2] = new LabelTableCellRenderer(JLabel.TRAILING);
}
 
Example 13
Source File: ClassesListControllerUI.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
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 14
Source File: CreateMFrame.java    From JavaMainRepo with Apache License 2.0 4 votes vote down vote up
/**
 * 
 * @param title
 *            Title of the frame.
 */
public CreateMFrame(final String title) {
	super(title);

	// Sets up the view and adds the components
	contentPanel.setLayout(new GridLayout(2, 7, 0, 0));
	JPanel calcPanel = new JPanel();
	contentPanel.add(calcPanel);
	SpringLayout slPanel = new SpringLayout();
	calcPanel.setLayout(slPanel);
	JLabel l = new JLabel("Name:", JLabel.TRAILING);
	calcPanel.add(l);
	slPanel.putConstraint(SpringLayout.NORTH, l, 25, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l, 0, SpringLayout.WEST, calcPanel);
	l.setLabelFor(name);
	calcPanel.add(name);
	slPanel.putConstraint(SpringLayout.NORTH, name, 25, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, name, 130, SpringLayout.WEST, calcPanel);
	JLabel l1 = new JLabel("Number of legs:", JLabel.TRAILING);
	calcPanel.add(l1);
	l1.setLabelFor(nrOfLegs);
	slPanel.putConstraint(SpringLayout.NORTH, l1, 45, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l1, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(nrOfLegs);
	slPanel.putConstraint(SpringLayout.NORTH, nrOfLegs, 45, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, nrOfLegs, 130, SpringLayout.WEST, calcPanel);
	JLabel l2 = new JLabel("Percentage body hair:", JLabel.TRAILING);
	calcPanel.add(l2);
	l2.setLabelFor(percBodyHair);
	slPanel.putConstraint(SpringLayout.NORTH, l2, 65, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l2, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(percBodyHair);
	slPanel.putConstraint(SpringLayout.NORTH, percBodyHair, 65, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, percBodyHair, 130, SpringLayout.WEST, calcPanel);
	JLabel l3 = new JLabel("Normal body temp:", JLabel.TRAILING);
	calcPanel.add(l3);
	slPanel.putConstraint(SpringLayout.NORTH, l3, 85, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l3, 0, SpringLayout.WEST, calcPanel);
	l3.setLabelFor(normalBodyTemp);
	calcPanel.add(normalBodyTemp);
	slPanel.putConstraint(SpringLayout.NORTH, normalBodyTemp, 85, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, normalBodyTemp, 130, SpringLayout.WEST, calcPanel);
	JLabel l4 = new JLabel("Danger percentage:", JLabel.TRAILING);
	calcPanel.add(l4);
	l4.setLabelFor(dangerPerc);
	slPanel.putConstraint(SpringLayout.NORTH, l4, 105, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l4, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(dangerPerc);
	slPanel.putConstraint(SpringLayout.NORTH, dangerPerc, 105, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, dangerPerc, 130, SpringLayout.WEST, calcPanel);
	JLabel l5 = new JLabel("Maintenance cost:", JLabel.TRAILING);
	calcPanel.add(l5);
	l5.setLabelFor(maintenanceCost);
	slPanel.putConstraint(SpringLayout.NORTH, l5, 125, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l5, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(maintenanceCost);
	slPanel.putConstraint(SpringLayout.NORTH, maintenanceCost, 125, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, maintenanceCost, 130, SpringLayout.WEST, calcPanel);
	calcPanel.add(createButton);
	slPanel.putConstraint(SpringLayout.NORTH, createButton, 165, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, createButton, 150, SpringLayout.WEST, calcPanel);
	JLabel l6 = new JLabel("Choose mammal:", JLabel.TRAILING);
	calcPanel.add(l6);
	l6.setLabelFor(cow);

	slPanel.putConstraint(SpringLayout.NORTH, l6, 0, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l6, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(cow);
	slPanel.putConstraint(SpringLayout.NORTH, cow, 0, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, cow, 120, SpringLayout.WEST, calcPanel);
	calcPanel.add(monkey);
	slPanel.putConstraint(SpringLayout.NORTH, monkey, 0, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, monkey, 180, SpringLayout.WEST, calcPanel);
	calcPanel.add(tiger);
	slPanel.putConstraint(SpringLayout.NORTH, tiger, 0, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, tiger, 250, SpringLayout.WEST, calcPanel);
	ButtonGroup group = new ButtonGroup();
	group.add(cow);
	group.add(monkey);
	group.add(tiger);

}
 
Example 15
Source File: DiffFlatProfilePanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
protected void initColumnsData() {
    super.initColumnsData();
    columnRenderers[1] = new DiffBarCellRenderer(0, 0);
    columnRenderers[2] = new LabelTableCellRenderer(JLabel.TRAILING);
}
 
Example 16
Source File: DiffCCTDisplay.java    From netbeans with Apache License 2.0 4 votes vote down vote up
protected void initColumnsData() {
    super.initColumnsData();
    columnRenderers[1] = new DiffBarCellRenderer(0, 0);
    columnRenderers[2] = new LabelTableCellRenderer(JLabel.TRAILING);
}
 
Example 17
Source File: FilterDialog.java    From WhiteRabbit with Apache License 2.0 4 votes vote down vote up
public FilterDialog(Window parentWindow){
	
	super(parentWindow,"Filter",ModalityType.MODELESS);		
	this.setResizable(false);
	this.setLocation(parentWindow.getX()+parentWindow.getWidth()/2, parentWindow.getY()+100);

	contentPane.setLayout(layout);
	sourceSearchField = new JTextField(30);
	sourceSearchField.setName("Source");
	
	targetSearchField = new JTextField(30);
	targetSearchField.setName("Target");

	
	// Add key listener to send search string as it's being typed
	sourceSearchField.addKeyListener(new SearchListener() );
	sourceSearchField.addFocusListener(new SearchFocusListener());		
	JLabel sourceLabel = new JLabel("Filter Source:",JLabel.TRAILING);
	JButton sourceClearBtn = new JButton("Clear");
	contentPane.add(sourceLabel);
	contentPane.add(sourceSearchField);
	sourceClearBtn.addActionListener(this);
	sourceClearBtn.setActionCommand("Clear Source");
	sourceClearBtn.setFocusable(false);
	contentPane.add(sourceClearBtn);
	
	targetSearchField.addKeyListener(new SearchListener() );
	targetSearchField.addFocusListener(new SearchFocusListener());
	JLabel targetLabel = new JLabel("Filter Target:",JLabel.TRAILING);
	JButton targetClearBtn = new JButton("Clear");
	contentPane.add(targetLabel);
	contentPane.add(targetSearchField);		
	targetClearBtn.addActionListener(this);
	targetClearBtn.setActionCommand("Clear Target");
	targetClearBtn.setFocusable(false);
	contentPane.add(targetClearBtn);
	
	layout.putConstraint(SpringLayout.WEST, sourceLabel, 5, SpringLayout.WEST, contentPane);
	layout.putConstraint(SpringLayout.NORTH, sourceLabel, 5, SpringLayout.NORTH, contentPane);
	
	layout.putConstraint(SpringLayout.WEST, sourceSearchField, 5, SpringLayout.EAST, sourceLabel);
	layout.putConstraint(SpringLayout.NORTH, sourceSearchField, 5, SpringLayout.NORTH, contentPane);
	
	layout.putConstraint(SpringLayout.WEST, sourceClearBtn, 5, SpringLayout.EAST, sourceSearchField);
	layout.putConstraint(SpringLayout.NORTH, sourceClearBtn, 5, SpringLayout.NORTH, contentPane);
	
	layout.putConstraint(SpringLayout.WEST, targetLabel, 5, SpringLayout.WEST, contentPane);
	layout.putConstraint(SpringLayout.NORTH, targetLabel, 10, SpringLayout.SOUTH, sourceLabel);
		
	layout.putConstraint(SpringLayout.WEST, targetSearchField, 0, SpringLayout.WEST, sourceSearchField);
	layout.putConstraint(SpringLayout.NORTH, targetSearchField, 0, SpringLayout.NORTH, targetLabel);
	
	layout.putConstraint(SpringLayout.WEST, targetClearBtn, 5, SpringLayout.EAST, targetSearchField);
	layout.putConstraint(SpringLayout.NORTH, targetClearBtn, 0, SpringLayout.NORTH, targetSearchField);		

	
	layout.putConstraint(SpringLayout.SOUTH, contentPane, 5, SpringLayout.SOUTH, targetLabel);
	layout.putConstraint(SpringLayout.NORTH, contentPane, 5, SpringLayout.NORTH, sourceLabel);
	layout.putConstraint(SpringLayout.WEST, contentPane, 5, SpringLayout.WEST, sourceLabel);
	layout.putConstraint(SpringLayout.EAST, contentPane, 5, SpringLayout.EAST, targetClearBtn);
	
	this.pack();
}
 
Example 18
Source File: ClassesListControllerUI.java    From netbeans with Apache License 2.0 4 votes vote down vote up
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 19
Source File: CreateAFrame.java    From JavaMainRepo with Apache License 2.0 4 votes vote down vote up
/**
 * 
 * @param title
 *            The title of the frame.
 */
public CreateAFrame(final String title) {
	super(title);

	// Sets up the view and adds the components
	contentPanel.setLayout(new GridLayout(2, 7, 0, 0));
	JPanel calcPanel = new JPanel();
	contentPanel.add(calcPanel);
	SpringLayout slPanel = new SpringLayout();
	calcPanel.setLayout(slPanel);
	JLabel l = new JLabel("Name:", JLabel.TRAILING);
	calcPanel.add(l);
	slPanel.putConstraint(SpringLayout.NORTH, l, 25, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l, 0, SpringLayout.WEST, calcPanel);
	l.setLabelFor(name);
	calcPanel.add(name);
	slPanel.putConstraint(SpringLayout.NORTH, name, 25, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, name, 120, SpringLayout.WEST, calcPanel);
	JLabel l1 = new JLabel("Number of legs:", JLabel.TRAILING);
	calcPanel.add(l1);
	l1.setLabelFor(nrOfLegs);
	slPanel.putConstraint(SpringLayout.NORTH, l1, 45, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l1, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(nrOfLegs);
	slPanel.putConstraint(SpringLayout.NORTH, nrOfLegs, 45, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, nrOfLegs, 120, SpringLayout.WEST, calcPanel);
	JLabel l2 = new JLabel("Average swim depth:", JLabel.TRAILING);
	calcPanel.add(l2);
	l2.setLabelFor(avgSwimDepth);
	slPanel.putConstraint(SpringLayout.NORTH, l2, 65, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l2, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(avgSwimDepth);
	slPanel.putConstraint(SpringLayout.NORTH, avgSwimDepth, 65, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, avgSwimDepth, 120, SpringLayout.WEST, calcPanel);
	JLabel l3 = new JLabel("Water type:", JLabel.TRAILING);
	calcPanel.add(l3);
	slPanel.putConstraint(SpringLayout.NORTH, l3, 89, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l3, 0, SpringLayout.WEST, calcPanel);
	l3.setLabelFor(fwater);
	calcPanel.add(fwater);
	slPanel.putConstraint(SpringLayout.NORTH, fwater, 87, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, fwater, 120, SpringLayout.WEST, calcPanel);
	calcPanel.add(swater);
	slPanel.putConstraint(SpringLayout.NORTH, swater, 87, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, swater, 220, SpringLayout.WEST, calcPanel);
	ButtonGroup group = new ButtonGroup();
	group.add(fwater);
	group.add(swater);
	JLabel l4 = new JLabel("Danger percentage:", JLabel.TRAILING);
	calcPanel.add(l4);
	l4.setLabelFor(dangerPerc);
	slPanel.putConstraint(SpringLayout.NORTH, l4, 115, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l4, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(dangerPerc);
	slPanel.putConstraint(SpringLayout.NORTH, dangerPerc, 115, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, dangerPerc, 120, SpringLayout.WEST, calcPanel);
	JLabel l5 = new JLabel("Maintenance cost:", JLabel.TRAILING);
	calcPanel.add(l5);
	l5.setLabelFor(maintenanceCost);
	slPanel.putConstraint(SpringLayout.NORTH, l5, 135, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l5, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(maintenanceCost);
	slPanel.putConstraint(SpringLayout.NORTH, maintenanceCost, 135, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, maintenanceCost, 120, SpringLayout.WEST, calcPanel);
	calcPanel.add(createButton);
	slPanel.putConstraint(SpringLayout.NORTH, createButton, 160, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, createButton, 150, SpringLayout.WEST, calcPanel);
	JLabel l6 = new JLabel("Choose aquatic:", JLabel.TRAILING);
	calcPanel.add(l6);
	l6.setLabelFor(shark);

	slPanel.putConstraint(SpringLayout.NORTH, l6, 0, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, l6, 0, SpringLayout.WEST, calcPanel);
	calcPanel.add(shark);
	slPanel.putConstraint(SpringLayout.NORTH, shark, 0, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, shark, 120, SpringLayout.WEST, calcPanel);
	calcPanel.add(northernPike);
	slPanel.putConstraint(SpringLayout.NORTH, northernPike, 0, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, northernPike, 183, SpringLayout.WEST, calcPanel);
	calcPanel.add(tuna);
	slPanel.putConstraint(SpringLayout.NORTH, tuna, 0, SpringLayout.NORTH, calcPanel);
	slPanel.putConstraint(SpringLayout.WEST, tuna, 280, SpringLayout.WEST, calcPanel);
	ButtonGroup group1 = new ButtonGroup();
	group1.add(shark);
	group1.add(northernPike);
	group1.add(tuna);

}
 
Example 20
Source File: FieldsBrowserControllerUI.java    From netbeans with Apache License 2.0 4 votes vote down vote up
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;
        }
    }