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

The following are Jave code examples for showing how to use setLabelFor() 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: UIUtil.java   View Source Code Vote up 6 votes
@Messages("LBL_IconInfo=Selected icon [size]:")
private static JPanel getAccesoryPanel(final JTextField iconInfo) {
    iconInfo.setColumns(15);
    iconInfo.setEditable(false);
    
    JPanel accessoryPanel = new JPanel();
    JPanel inner = new JPanel();
    JLabel iconInfoLabel = new JLabel();
    accessoryPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 6, 0));
    
    inner.setLayout(new GridLayout(2, 1, 0, 6));
    
    iconInfoLabel.setLabelFor(iconInfo);
    Mnemonics.setLocalizedText(iconInfoLabel, LBL_IconInfo());
    inner.add(iconInfoLabel);
    
    inner.add(iconInfo);
    
    accessoryPanel.add(inner);
    return accessoryPanel;
}
 
Example 2
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 3
Project: jmt   File: AddingSitePanel.java   View Source Code Vote up 6 votes
public AddingSitePanel() {
	this.setLayout(new GridLayout(0,1));
	
	JLabel siteName = new JLabel("Site Name: ");
	JLabel siteAddress = new JLabel("Site Address: ");
	
	name = new JTextField();
	address = new JTextField("http://");
	
	siteName.setLabelFor(name);
	siteAddress.setLabelFor(address);
	
	this.add(siteName);
	this.add(name);
	this.add(siteAddress);
	this.add(address);
}
 
Example 4
Project: FreeCol   File: MapSizeDialog.java   View Source Code Vote up 6 votes
/**
 * Creates a dialog to choose the map size.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 * @param frame The owner frame.
 */
public MapSizeDialog(FreeColClient freeColClient, JFrame frame) {
    super(freeColClient, frame);

    JLabel widthLabel = Utility.localizedLabel("width");
    widthLabel.setLabelFor(inputWidth);
    JLabel heightLabel = Utility.localizedLabel("height");
    heightLabel.setLabelFor(inputHeight);

    MigPanel panel = new MigPanel(new MigLayout("wrap 2"));
    
    panel.add(Utility.localizedHeader("mapSizeDialog.mapSize", true),
              "span, align center");
    panel.add(widthLabel, "newline 20");
    panel.add(inputWidth);
    panel.add(heightLabel);
    panel.add(inputHeight);

    initializeInputDialog(frame, true, panel, null, "ok", "cancel");
}
 
Example 5
Project: jmt   File: DefaultsEditor.java   View Source Code Vote up 5 votes
/**
 * Adds an input field to insert a String
 * @param text text to be shown on a label
 * @param property property to be changed in Defaults
 * @param cont container where input field must be added
 */
protected void addInputString(String text, String property, Container cont) {
	JLabel label = new JLabel(text + ":");
	JTextField field = new JTextField(10);
	field.setName(property);
	label.setLabelFor(field);
	field.setText(Defaults.get(property));
	// Sets maximum size to minimal one, otherwise springLayout will stretch this
	field.setMaximumSize(new Dimension(field.getMaximumSize().width, field.getMinimumSize().height));
	field.addKeyListener(stringListener);
	field.addFocusListener(stringListener);
	registeredStringListener.add(field);
	cont.add(label);
	cont.add(field);
}
 
Example 6
Project: javaportfolio   File: AccountTransferDialog.java   View Source Code Vote up 5 votes
/**
 * Set up and show the dialog. The first Component argument determines which
 * frame the dialog depends on; it should be a component in the dialog's
 * controlling frame. The second Component argument should be null if you
 * want the dialog to come up with its left corner in the center of the
 * screen; otherwise, it should be the component on top of which the dialog
 * should appear.
 */

public AccountTransferDialog(Component frameComp, Component locationComp,
		String title,  Object[] brokers,I_TickerManager tickerManager) {
	super(frameComp, locationComp, title, tickerManager);

	
	brokerList = new JComboBox(brokers);
	brokerList.setEditable(true);
	brokerList.setSelectedIndex(0);
	
	newBrokerField = new JTextField(FIELD_LEN);
	newBrokerField.setEditable(true);
	newBrokerField.setText("");		
	newBrokerField.addKeyListener(this);
	
	dateFieldLabel = new JLabel("Siirtopäivä: ");
	dateFieldLabel.setLabelFor(dateChooser);
	
	brokerFieldLabel = new JLabel("Vanha välittäjä: ");
	brokerFieldLabel.setLabelFor(brokerList);
	
	newBrokerFieldLabel = new JLabel("Uusi välittäjä: ");
	newBrokerFieldLabel.setLabelFor(newBrokerField);
	
	init(getDialogLabels(), getDialogComponents());
}
 
Example 7
Project: JavaGraph   File: LayoutKind.java   View Source Code Vote up 5 votes
void createSpinner(Method methodToCall, double value, double min, double max, double step,
    String label) {
    JSpinner spinner =
        new MySpinner(methodToCall, this.layout, this.item, value, min, max, step);
    spinner.addChangeListener(this);
    JLabel l = new JLabel(label);
    this.add(l);
    l.setLabelFor(spinner);
    this.add(spinner);
}
 
Example 8
Project: etomica   File: ViewAlkaneLengthSelection.java   View Source Code Vote up 5 votes
public ViewAlkaneLengthSelection(String frameTitle){
	super(frameTitle);
	this.setMinimumSize(new Dimension(500,200));
	
	alkaneSpherePanel = new JPanel();
	this.add(alkaneSpherePanel);
	closeWindow = new JButton("Cancel");
	saveValues = new JButton("Save");
	GridBagLayout gridbagOtherParam = new GridBagLayout();
	alkaneSpherePanel.setLayout(gridbagOtherParam);
    
	NoOfSpheres = new JTextField();
	NoOfSpheres.setColumns(10);
	NoOfSpheres.setSize(new Dimension(5,20));
	NoOfSpheres.setText("4");
	JLabel NLabel = new JLabel("Cn (where n is 4 or greater)");
	NLabel.setLabelFor(NoOfSpheres);
	
	
	Border compoundField1;
	compoundField1 = BorderFactory.createCompoundBorder(
    		BorderFactory.createRaisedBevelBorder(), BorderFactory.createLoweredBevelBorder());
	NoOfSpheres.setBorder(compoundField1);
	
	JComponent[] OtherParamLeft= {NLabel,saveValues};
	JComponent[] OtherParamRight = { NoOfSpheres,closeWindow};
    addLeftRightComponents(OtherParamLeft,OtherParamRight,gridbagOtherParam,alkaneSpherePanel);
	
	
}
 
Example 9
Project: incubator-netbeans   File: ResolveDeclarationsPanel.java   View Source Code Vote up 5 votes
private void initComponentsMore() {
    contentPanel.setLayout(new GridBagLayout());
    contentPanel.setBackground(UIManager.getColor("Table.background")); //NOI18N
    
    int row = 0;
    combos = new ArrayList<>(items.size());

    Font monoSpaced = new Font("Monospaced", Font.PLAIN, new JLabel().getFont().getSize()); //NOI18N
    FocusListener focusListener = new FocusAdapter() {

        @Override
        public void focusGained(FocusEvent e) {
            Component c = e.getComponent();
            Rectangle r = c.getBounds();
            contentPanel.scrollRectToVisible(r);
        }

    };
    for (int i = 0; i < items.size(); i++) {
        ResolveDeclarationItem item = items.get(i);
        JComboBox jComboBox = createComboBox(item, monoSpaced, focusListener);
        combos.add(jComboBox);

        JLabel lblSimpleName = new JLabel(item.getName());
        lblSimpleName.setOpaque(false);
        lblSimpleName.setFont(monoSpaced);
        lblSimpleName.setLabelFor(jComboBox);

        contentPanel.add(lblSimpleName, new GridBagConstraints(0, row, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(3, 5, 2, 5), 0, 0));
        contentPanel.add(jComboBox, new GridBagConstraints(1, row++, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(3, 5, 2, 5), 0, 0));
    }

    contentPanel.add(new JLabel(), new GridBagConstraints(2, row, 2, 1, 0.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));

    Dimension d = contentPanel.getPreferredSize();
    d.height = getRowHeight() * Math.min(combos.size(), 6);

}
 
Example 10
Project: QN-ACTR-Release   File: DefaultsEditor.java   View Source Code Vote up 5 votes
/**
 * Adds an input field to insert a String
 * @param text text to be shown on a label
 * @param property property to be changed in Defaults
 * @param cont container where input field must be added
 */
protected void addInputString(String text, String property, Container cont) {
	JLabel label = new JLabel(text + ":");
	JTextField field = new JTextField(10);
	field.setName(property);
	label.setLabelFor(field);
	field.setText(Defaults.get(property));
	// Sets maximum size to minimal one, otherwise springLayout will stretch this
	field.setMaximumSize(new Dimension(field.getMaximumSize().width, field.getMinimumSize().height));
	field.addKeyListener(stringListener);
	field.addFocusListener(stringListener);
	registeredStringListener.add(field);
	cont.add(label);
	cont.add(field);
}
 
Example 11
Project: QN-ACTR-Release   File: GraphPanel.java   View Source Code Vote up 4 votes
/**
 * Initialize GUI of this panel
 */
private void initGraphics() {
	setLayout(new BorderLayout(10, 10));
	setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
	mainPanel = new JPanel(new BorderLayout(5, 5));
	mainPanel.setBorder(BorderFactory.createEtchedBorder());

	// Adds description label
	JLabel descrLabel = new JLabel(DESCRIPTION_GRAPH);
	add(descrLabel, BorderLayout.NORTH);
	add(mainPanel, BorderLayout.CENTER);

	// Creates left panel with options
	left = new JPanel(new BorderLayout(3, 3));
	// Adds performance index selection
	JPanel indexPanel = new JPanel();
	JLabel pIndex = new JLabel("Burstiness factor: ");
	index = new JComboBox(INDICES_TYPES);
	pIndex.setLabelFor(index);
	JPanel formulaPanel = new JPanel();
	JPanel formula2Panel = new JPanel();
	JLabel formula = new JLabel("b = (number of epochs for which lambda(k)>lambda) / n");
	JLabel formula2 = new JLabel("a = lambda+ / lambda");
	formulaPanel.add(formula);
	formula2Panel.add(formula2);
	indexPanel.add(pIndex);
	indexPanel.add(index);
	JPanel totPanel = new JPanel(new BorderLayout(4, 4));
	totPanel.add(indexPanel, BorderLayout.NORTH);
	totPanel.add(formulaPanel, BorderLayout.CENTER);
	totPanel.add(formula2Panel, BorderLayout.SOUTH);
	left.add(totPanel, BorderLayout.NORTH);
	// left.add(formulaPanel, BorderLayout.NORTH);
	// Adds panel for bounds selection
	JPanel boundsPanel = new JPanel(new GridLayout(2, 4, 1, 1));
	boundsPanel.add(new JLabel("Xmin: ", SwingConstants.RIGHT));
	Xmin = new JSpinner(new SpinnerNumberModel(0.0, 0, engine.getEpochRange(), 0.01));
	Xmin.setPreferredSize(DIM_SPINNER);
	boundsPanel.add(Xmin);
	boundsPanel.add(new JLabel("Xmax: ", SwingConstants.RIGHT));
	Xmax = new JSpinner(new SpinnerNumberModel(0.0, 0, engine.getEpochRange(), 0.01));
	Xmax.setPreferredSize(DIM_SPINNER);
	boundsPanel.add(Xmax);
	boundsPanel.add(new JLabel("Ymin: ", SwingConstants.RIGHT));
	Ymin = new JSpinner(new SpinnerNumberModel(0.0, 0.0, 1e10, 0.01));
	Ymin.setPreferredSize(DIM_SPINNER);
	boundsPanel.add(Ymin);
	boundsPanel.add(new JLabel("Ymax: ", SwingConstants.RIGHT));
	Ymax = new JSpinner(new SpinnerNumberModel(0.0, 0.0, 1e10, 0.01));
	Ymax.setPreferredSize(DIM_SPINNER);
	boundsPanel.add(Ymax);
	left.add(boundsPanel, BorderLayout.SOUTH);

	mainPanel.add(left, BorderLayout.WEST);

	// Puts graph in the right panel
	// Creates label for X-axis
	String xLabel = "";
	graph = new NewPlot();
	xLabel = "Number of epochs";
	graph.setXLabel(xLabel);
	graph.setXRange(0, 30);
	graph.setYLabel("Burstiness factor " + currentIndex);
	mainPanel.add(graph, BorderLayout.CENTER);
	columnHeads = new Vector();
	columnHeads.add("Epoch");
	columnHeads.add("Factor b");
	columnHeads.add("Factor a");
	table = new JTable(rows, columnHeads);

	tableScrollPane = new JScrollPane(table);
	tableScrollPane.setPreferredSize(new Dimension(160, tableScrollPane.getPreferredSize().height));
	left.add(tableScrollPane, BorderLayout.CENTER);
	updateSpinners();
	addActions();

}
 
Example 12
Project: FreeCol   File: ScaleMapSizeDialog.java   View Source Code Vote up 4 votes
/**
 * Create a ScaleMapSizeDialog.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 * @param frame The owner frame.
 */
public ScaleMapSizeDialog(final FreeColClient freeColClient, JFrame frame) {
    super(freeColClient, frame);

    /*
     * FIXME: Extend this dialog. It should be possible to specify
     * the sizes using percentages.
     *
     * Add a panel containing information about the scaling (old
     * size, new size etc).
     */

    MigPanel panel = new MigPanel(new MigLayout("wrap 1, center"));
    JPanel widthPanel = new JPanel(new FlowLayout());
    JPanel heightPanel = new JPanel(new FlowLayout());
    String str;

    oldMap = freeColClient.getGame().getMap();
    str = Integer.toString(oldMap.getWidth());
    inputWidth = new JTextField(str, COLUMNS);
    str = Integer.toString(oldMap.getHeight());
    inputHeight = new JTextField(str, COLUMNS);

    JLabel widthLabel = Utility.localizedLabel("width");
    widthLabel.setLabelFor(inputWidth);
    JLabel heightLabel = Utility.localizedLabel("height");
    heightLabel.setLabelFor(inputHeight);

    widthPanel.setOpaque(false);
    widthPanel.add(widthLabel);
    widthPanel.add(inputWidth);
    heightPanel.setOpaque(false);
    heightPanel.add(heightLabel);
    heightPanel.add(inputHeight);

    panel.add(widthPanel);
    panel.add(heightPanel);
    panel.setSize(panel.getPreferredSize());

    final ActionListener al = (ActionEvent ae) -> {
        ScaleMapSizeDialog.this.checkFields();
    };

    inputWidth.addActionListener(al);
    inputHeight.addActionListener(al);

    final Dimension fake = null;
    List<ChoiceItem<Dimension>> c = choices();
    c.add(new ChoiceItem<>(Messages.message("ok"), fake).okOption());
    c.add(new ChoiceItem<>(Messages.message("cancel"), fake)
        .cancelOption().defaultOption());
    initializeDialog(frame, DialogType.QUESTION, true, panel, null, c);
}
 
Example 13
Project: chipKIT-importer   File: SerialMonitorConfigPane.java   View Source Code Vote up 4 votes
private JLabel createLabel( String name, JComponent targetComponent ) {
    JLabel label = new JLabel( getLocalizedText(name) );
    label.setLabelFor( targetComponent );
    return label;
}
 
Example 14
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 15
Project: freecol   File: ScaleMapSizeDialog.java   View Source Code Vote up 4 votes
/**
 * Create a ScaleMapSizeDialog.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 * @param frame The owner frame.
 */
public ScaleMapSizeDialog(final FreeColClient freeColClient, JFrame frame) {
    super(freeColClient, frame);

    /*
     * FIXME: Extend this dialog. It should be possible to specify
     * the sizes using percentages.
     *
     * Add a panel containing information about the scaling (old
     * size, new size etc).
     */

    MigPanel panel = new MigPanel(new MigLayout("wrap 1, center"));
    JPanel widthPanel = new JPanel(new FlowLayout());
    JPanel heightPanel = new JPanel(new FlowLayout());
    String str;

    oldMap = freeColClient.getGame().getMap();
    str = Integer.toString(oldMap.getWidth());
    inputWidth = new JTextField(str, COLUMNS);
    str = Integer.toString(oldMap.getHeight());
    inputHeight = new JTextField(str, COLUMNS);

    JLabel widthLabel = Utility.localizedLabel("width");
    widthLabel.setLabelFor(inputWidth);
    JLabel heightLabel = Utility.localizedLabel("height");
    heightLabel.setLabelFor(inputHeight);

    widthPanel.setOpaque(false);
    widthPanel.add(widthLabel);
    widthPanel.add(inputWidth);
    heightPanel.setOpaque(false);
    heightPanel.add(heightLabel);
    heightPanel.add(inputHeight);

    panel.add(widthPanel);
    panel.add(heightPanel);
    panel.setSize(panel.getPreferredSize());

    final ActionListener al = (ActionEvent ae) -> {
        ScaleMapSizeDialog.this.checkFields();
    };

    inputWidth.addActionListener(al);
    inputHeight.addActionListener(al);

    final Dimension fake = null;
    List<ChoiceItem<Dimension>> c = choices();
    c.add(new ChoiceItem<>(Messages.message("ok"), fake).okOption());
    c.add(new ChoiceItem<>(Messages.message("cancel"), fake)
        .cancelOption().defaultOption());
    initializeDialog(frame, DialogType.QUESTION, true, panel, null, c);
}
 
Example 16
Project: etomica   File: ViewSimEnvironmentSelection.java   View Source Code Vote up 4 votes
public ViewSimEnvironmentSelection(ModelSimulationEnvironment simEnvironmentObj){
		super();
		this.setMinimumSize(new Dimension(500,400));
		
		SimEnvParamPanel = new JPanel();
		GridBagLayout gridbagOtherParam = new GridBagLayout();
		SimEnvParamPanel.setLayout(gridbagOtherParam);
	    this.add(SimEnvParamPanel);
		
		closeWindow = new JButton("Cancel");
		saveValues = new JButton("Save");
		
	    temperatureField = new JTextField();
		temperatureField.setColumns(10);
		temperatureField.setSize(new Dimension((int)temperatureField.getSize().getWidth(),20));
		temperatureField.setText(Double.toString(simEnvironmentObj.getTemperature()));
		JLabel temperatureLabel = new JLabel("Temperature(K)");
		temperatureLabel.setLabelFor(temperatureField);
		
		Border compoundField1;
		compoundField1 = BorderFactory.createCompoundBorder(
	    		BorderFactory.createRaisedBevelBorder(), BorderFactory.createLoweredBevelBorder());
		temperatureField.setBorder(compoundField1);

		
		noOfStepsField = new JTextField();
		noOfStepsField.setColumns(10);
		JLabel NoOfStepsLabel = new JLabel("Steps");
		noOfStepsField.setText(Integer.toString(simEnvironmentObj.getNoOfSteps()));
		NoOfStepsLabel.setLabelFor(noOfStepsField);
		
		
		Border compoundField2;
		compoundField2 = BorderFactory.createCompoundBorder(
	    		BorderFactory.createRaisedBevelBorder(), BorderFactory.createLoweredBevelBorder());
		noOfStepsField.setBorder(compoundField2);
		
		sigmaHSRefField = new JTextField[10];
		sigmaHSRefLabel = new JLabel[10];
		sigmaHSRefBorder = new Border[10];
		for(int i=0;i<10;i++){
			sigmaHSRefField[i] = new JTextField();
			sigmaHSRefField[i].setColumns(10);
			String index = Integer.toString(i+1);
			sigmaHSRefLabel[i] = new JLabel("SigmaHSRef"+index);
			sigmaHSRefLabel[i].setLabelFor(sigmaHSRefField[i]);
			if(simEnvironmentObj.getSigmaHSRef(i) == 0.0){
				sigmaHSRefField[i].setText("0.0");
				sigmaHSRefField[i].setVisible(false);
				sigmaHSRefLabel[i].setVisible(false);
			}else{
				sigmaHSRefField[i].setText(Double.toString(simEnvironmentObj.getSigmaHSRef(i)));
			}
			
			sigmaHSRefBorder[i] = BorderFactory.createCompoundBorder(
		    		BorderFactory.createRaisedBevelBorder(), BorderFactory.createLoweredBevelBorder());
			sigmaHSRefField[i].setBorder(sigmaHSRefBorder[i]);
		}
		

		
		JComponent[] OtherParamLeft= {temperatureLabel, NoOfStepsLabel, sigmaHSRefLabel[0],sigmaHSRefLabel[1],sigmaHSRefLabel[2],sigmaHSRefLabel[3],
										sigmaHSRefLabel[4],sigmaHSRefLabel[5],sigmaHSRefLabel[6],sigmaHSRefLabel[7],
											sigmaHSRefLabel[8],sigmaHSRefLabel[9],saveValues};
		JComponent[] OtherParamRight = { temperatureField,noOfStepsField,sigmaHSRefField[0],sigmaHSRefField[1],sigmaHSRefField[2],sigmaHSRefField[3],
											sigmaHSRefField[4],sigmaHSRefField[5],sigmaHSRefField[6],sigmaHSRefField[7],
												sigmaHSRefField[8],sigmaHSRefField[8],closeWindow};
	    addLeftRightComponents(OtherParamLeft,OtherParamRight,gridbagOtherParam,SimEnvParamPanel);
	    

	    Border compound2;
	    compound2 = BorderFactory.createCompoundBorder(
	    		BorderFactory.createRaisedBevelBorder(), BorderFactory.createLoweredBevelBorder());
	    SimEnvParamPanel.setBorder(compound2);

}
 
Example 17
Project: jmt   File: GraphArrivalPanel.java   View Source Code Vote up 4 votes
/**
 * Initialize GUI of this panel
 */
private void initGraphics() {
	setLayout(new BorderLayout(10, 10));
	setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
	mainPanel = new JPanel(new BorderLayout(5, 5));
	mainPanel.setBorder(BorderFactory.createEtchedBorder());

	// Adds description label
	JLabel descrLabel = new JLabel(DESCRIPTION_GRAPH);
	add(descrLabel, BorderLayout.NORTH);
	add(mainPanel, BorderLayout.CENTER);

	// Creates left panel with options
	left = new JPanel(new BorderLayout(3, 3));
	// Adds performance index selection
	JPanel indexPanel = new JPanel();
	JLabel pIndex = new JLabel("Granularity: ");
	index = new JComboBox(INDICES_TYPES);
	pIndex.setLabelFor(index);
	indexPanel.add(pIndex);
	indexPanel.add(index);
	left.add(indexPanel, BorderLayout.NORTH);
	// Adds panel for bounds selection
	JPanel boundsPanel = new JPanel();
	Box b = Box.createHorizontalBox();
	b.add(Box.createHorizontalStrut(5));
	b.add(new JLabel("Xmin: ", SwingConstants.RIGHT));
	Xmin = new JSpinner();
	Xmin.setPreferredSize(DIM_SPINNER);
	b.add(Xmin);
	b.add(Box.createHorizontalStrut(5));
	b.add(new JLabel("Xmax: ", SwingConstants.RIGHT));
	Xmax = new JSpinner();
	Xmax.setPreferredSize(DIM_SPINNER);
	b.add(Xmax);
	Box b1 = Box.createHorizontalBox();
	b1.add(Box.createHorizontalStrut(5));
	b1.add(new JLabel("Ymin: ", SwingConstants.RIGHT));
	Ymin = new JSpinner(new SpinnerNumberModel(0.0, 0.0, 1e10, 0.01));
	Ymin.setPreferredSize(DIM_SPINNER);
	b1.add(Ymin);
	b1.add(Box.createHorizontalStrut(5));
	b1.add(new JLabel("Ymax: ", SwingConstants.RIGHT));
	Ymax = new JSpinner(new SpinnerNumberModel(0.0, 0.0, 1e10, 0.01));
	Ymax.setPreferredSize(DIM_SPINNER);
	b1.add(Ymax);
	Box vb = Box.createVerticalBox();
	vb.add(b);
	vb.add(b1);
	left.add(vb, BorderLayout.SOUTH);

	mainPanel.add(left, BorderLayout.WEST);

	// Puts graph in the right panel
	// Creates label for X-axis
	String xLabel = "";
	graph = new NewPlot();
	xLabel = "Time";
	graph.setXLabel(currentIndex);
	graph.setXRange(0, 0);
	graph.setYLabel("Job / s");
	mainPanel.add(graph, BorderLayout.CENTER);
	columnHeads = new Vector();
	columnHeads.add(" ");
	columnHeads.add("Time");
	columnHeads.add("Job / s");
	table = new JTable(rows, columnHeads);

	tableScrollPane = new JScrollPane(table);
	tableScrollPane.setPreferredSize(new Dimension(160, tableScrollPane.getPreferredSize().height));
	left.add(tableScrollPane, BorderLayout.CENTER);
	updateSpinners();
	addActions();
}
 
Example 18
Project: javaportfolio   File: SubscriptionDialog.java   View Source Code Vote up 4 votes
/**
 * Set up and show the dialog. The first Component argument determines which
 * frame the dialog depends on; it should be a component in the dialog's
 * controlling frame. The second Component argument should be null if you
 * want the dialog to come up with its left corner in the center of the
 * screen; otherwise, it should be the component on top of which the dialog
 * should appear.
 */

public SubscriptionDialog(Component frameComp, Component locationComp, String title,
		Object[] brokers, Object[] sectors, Map<String, List<String>> stocks, I_TickerManager tickerManager) {
	super(frameComp, locationComp, title, tickerManager);

	this.stocks = stocks;

	// Brokers

	brokerList = new JComboBox(brokers);
	brokerList.setEditable(true);

	// Sectors
	sectorList = new JComboBox(sectors);
	sectorList.setActionCommand(SECTOR_CHANGED);
	sectorList.addActionListener(this);

	// Stocks
	stocksList = new JComboBox();
	updateStockList((String) sectorList.getSelectedItem());
	stocksList.setActionCommand(STOCK_SELECTED);
	stocksList.addActionListener(this);
	
	amountField.addKeyListener(this);
	costField.addKeyListener(this);
	
	taxPurchaseDateChooser = new JDateChooser(Calendar.getInstance().getTime());
	taxPurchaseDateChooser.setLocale(new Locale("fi", "FI"));

	totalCostField.setEditable(false);
	totalCostField.setText("0.00");

	sectorFieldLabel = new JLabel("Toimiala: ");
	sectorFieldLabel.setLabelFor(sectorList);

	stockFieldLabel = new JLabel("Arvopaperi: ");
	stockFieldLabel.setLabelFor(stocksList);

	dateFieldLabel = new JLabel("Merkintäpäivä: ");
	dateFieldLabel.setLabelFor(dateChooser);

	taxDateFieldLabel= new JLabel("Hankintapäivä verotuksessa: ");
	taxDateFieldLabel.setLabelFor(taxPurchaseDateChooser);
	
	amountFieldLabel = new JLabel("Määrä: ");
	amountFieldLabel.setLabelFor(amountField);

	costFieldLabel = new JLabel("Merkintähinta: ");
	costFieldLabel.setLabelFor(costField);

	brokerFieldLabel = new JLabel("Välittäjä: ");
	brokerFieldLabel.setLabelFor(brokerList);

	totalCostFieldLabel = new JLabel("yhteensä: ");
	totalCostFieldLabel.setLabelFor(totalCostField);

	init(getDialogLabels(), getDialogComponents());
}
 
Example 19
Project: javaportfolio   File: BaseDialog.java   View Source Code Vote up 4 votes
/**
 * Set up and show the dialog. The first Component argument determines which
 * frame the dialog depends on; it should be a component in the dialog's
 * controlling frame. The second Component argument should be null if you
 * want the dialog to come up with its left corner in the center of the
 * screen; otherwise, it should be the component on top of which the dialog
 * should appear.
 */

public BaseDialog(Component frameComp, Component locationComp,
		String title, I_TickerManager tickerManager) {
	super(JOptionPane.getFrameForComponent(frameComp), title, true);
	this.frameComp = frameComp;
	dateChooser = new JDateChooser(Calendar.getInstance().getTime());
	dateChooser.setLocale(new Locale("fi", "FI"));

	this.tickerManager = tickerManager;

	// Create and initialize the buttons.
	cancelButton = new JButton(BUTTON_CANCEL);
	cancelButton.addActionListener(this);
	cancelButton.setActionCommand(BUTTON_CANCEL);

	okButton = new JButton(BUTTON_OK);
	okButton.setActionCommand(BUTTON_OK);
	okButton.addActionListener(this);
	getRootPane().setDefaultButton(okButton);
	okButton.setEnabled(false);

	rateField = new JTextField(FIELD_LEN);
	rateField.setVisible(true);
	rateField.setText("1.0000");

	rateFieldLabel = new JLabel("Valuuttakurssi: ");
	rateFieldLabel.setLabelFor(rateField);
	rateFieldLabel.setVisible(true);

	localCurrencyButton = new JRadioButton(localCurrencyString);
	foreignCurrencyButton = new JRadioButton(foreignCurrencyString);
	currencyGroup = new ButtonGroup();

	localCurrencyButton.setActionCommand(localCurrencyString);
	foreignCurrencyButton.setActionCommand(foreignCurrencyString);
	localCurrencyButton.setSelected(true);
	currencyGroup.add(localCurrencyButton);
	currencyGroup.add(foreignCurrencyButton);
	updateRateFieldCcy("EUR", false);
	localCurrencyButton.addActionListener(this);
	foreignCurrencyButton.addActionListener(this);
	foreignCurrencyButton.setEnabled(false);
	
}
 
Example 20
Project: incubator-netbeans   File: Util.java   View Source Code Vote up 4 votes
/**
 * @author  Marian Petras
 */
static void layoutSelectResourcePanel(final Container thePanel,
                                      final String instructionsText,
                                      final String selectionLabelText,
                                      final Component selectionComp,
                                      final JButton button1,
                                      final JButton button2) {
    JTextArea instructions = new JTextArea();
    JLabel lblSelection = new JLabel();

    instructions.setColumns(20);
    instructions.setEditable(false);
    instructions.setLineWrap(true);
    instructions.setText(instructionsText);
    instructions.setWrapStyleWord(true);
    instructions.setDisabledTextColor(new JLabel().getForeground());
    instructions.setEnabled(false);
    instructions.setOpaque(false);

    lblSelection.setLabelFor(selectionComp);
    Mnemonics.setLocalizedText(lblSelection, selectionLabelText);

    JScrollPane scrollPane = new JScrollPane(selectionComp);

    Container filesSelection = new JPanel();
    GroupLayout layout = new GroupLayout(filesSelection);
    filesSelection.setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(LEADING)
        .addComponent(lblSelection)
        .addGroup(layout.createSequentialGroup()
            .addComponent(scrollPane, 0, DEFAULT_SIZE, Integer.MAX_VALUE)
            .addPreferredGap(RELATED)
            .addGroup(layout.createParallelGroup(LEADING)
                .addComponent(button1)
                .addComponent(button2)))
    );

    layout.linkSize(SwingConstants.HORIZONTAL, button1, button2);

    layout.setVerticalGroup(
        layout.createParallelGroup(LEADING)
        .addGroup(layout.createSequentialGroup()
            .addComponent(lblSelection)
            .addPreferredGap(RELATED)
            .addGroup(layout.createParallelGroup(LEADING)
                .addComponent(scrollPane, 0, DEFAULT_SIZE, Integer.MAX_VALUE)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(button1)
                    .addPreferredGap(RELATED)
                    .addComponent(button2))))
    );

    LayoutStyle layoutStyle = layout.getLayoutStyle();
    if (layoutStyle == null) {
        layoutStyle = LayoutStyle.getInstance();
    }

    BorderLayout mainLayout = new BorderLayout();
    thePanel.setLayout(mainLayout);
    thePanel.add(instructions, BorderLayout.PAGE_START);
    thePanel.add(filesSelection, BorderLayout.CENTER);
    mainLayout.setVgap(layoutStyle.getPreferredGap(instructions,
                                                   lblSelection,
                                                   UNRELATED,
                                                   SwingConstants.NORTH,
                                                   thePanel));
}