当前位置: 首页>>代码示例>>Java>>正文


Java JLabel.setLabelFor方法代码示例

本文整理汇总了Java中javax.swing.JLabel.setLabelFor方法的典型用法代码示例。如果您正苦于以下问题:Java JLabel.setLabelFor方法的具体用法?Java JLabel.setLabelFor怎么用?Java JLabel.setLabelFor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JLabel的用法示例。


在下文中一共展示了JLabel.setLabelFor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAccesoryPanel

import javax.swing.JLabel; //导入方法依赖的package包/类
@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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:UIUtil.java

示例2: addColorChooser

import javax.swing.JLabel; //导入方法依赖的package包/类
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);
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:18,代码来源:CFGOptionsPanel.java

示例3: AddingSitePanel

import javax.swing.JLabel; //导入方法依赖的package包/类
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);
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:18,代码来源:AddingSitePanel.java

示例4: MapSizeDialog

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * 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");
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:26,代码来源:MapSizeDialog.java

示例5: addInputString

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:21,代码来源:DefaultsEditor.java

示例6: AccountTransferDialog

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * 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());
}
 
开发者ID:skarna1,项目名称:javaportfolio,代码行数:35,代码来源:AccountTransferDialog.java

示例7: createSpinner

import javax.swing.JLabel; //导入方法依赖的package包/类
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);
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:11,代码来源:LayoutKind.java

示例8: ViewAlkaneLengthSelection

import javax.swing.JLabel; //导入方法依赖的package包/类
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);
	
	
}
 
开发者ID:etomica,项目名称:etomica,代码行数:31,代码来源:ViewAlkaneLengthSelection.java

示例9: initComponentsMore

import javax.swing.JLabel; //导入方法依赖的package包/类
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);

}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:39,代码来源:ResolveDeclarationsPanel.java

示例10: initGraphics

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * 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();

}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:80,代码来源:GraphPanel.java

示例11: ScaleMapSizeDialog

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:59,代码来源:ScaleMapSizeDialog.java

示例12: createLabel

import javax.swing.JLabel; //导入方法依赖的package包/类
private JLabel createLabel( String name, JComponent targetComponent ) {
    JLabel label = new JLabel( getLocalizedText(name) );
    label.setLabelFor( targetComponent );
    return label;
}
 
开发者ID:chipKIT32,项目名称:chipKIT-importer,代码行数:6,代码来源:SerialMonitorConfigPane.java

示例13: createHotCorners

import javax.swing.JLabel; //导入方法依赖的package包/类
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;
}
 
开发者ID:michaelnetter,项目名称:dracoon-dropzone,代码行数:51,代码来源:SettingsDialog.java

示例14: ViewSimEnvironmentSelection

import javax.swing.JLabel; //导入方法依赖的package包/类
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);

}
 
开发者ID:etomica,项目名称:etomica,代码行数:77,代码来源:ViewSimEnvironmentSelection.java

示例15: initGraphics

import javax.swing.JLabel; //导入方法依赖的package包/类
/**
 * 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();
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:77,代码来源:GraphArrivalPanel.java


注:本文中的javax.swing.JLabel.setLabelFor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。