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

The following are Jave code examples for showing how to use setMinimumSize() 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.
Example 1
Project: jreliability   File: MeasuresPanel.java   Source Code and License Vote up 6 votes
/**
 * Creates the {@link JPanel} showing the mission time.
 * 
 * @param maxwidth
 *            the dimension of the longest label
 * @return the JPanel showing the mission time
 */
private JPanel createMtPanel(Dimension maxwidth) {
	Double mtVal = inverse.evaluate(reliabilityFunction, standardMT);

	JLabel pmtLabel = new JLabel("P[MT] =");
	pmtLabel.setMinimumSize(maxwidth);

	JLabel mtLabel = new JLabel("MT:");
	mtLabel.setMinimumSize(maxwidth);

	mtProbability = new JFormattedTextField(mtFieldFormat);
	mtProbability.addActionListener(MeasurePanel.this);
	mtProbability.setPreferredSize(new Dimension(70, 15));
	mtProbability.setHorizontalAlignment(SwingConstants.RIGHT);
	mtProbability.setText(standardMT.toString());

	mt = new JLabel(mtVal.toString());

	return createSubPanel("Mission-Time", pmtLabel, mtProbability, mtLabel, mt);
}
 
Example 2
Project: java-course   File: Calculator.java   Source Code and License Vote up 6 votes
/**
 * Initializes GUI.
 */
private void initGUI() {
    CalcLayout pane = new CalcLayout(5);
    JPanel p = new JPanel(pane);

    display = new JLabel("0", SwingConstants.RIGHT);
    display.setMinimumSize(new Dimension(75, 75));
    display.setVerticalAlignment(SwingConstants.BOTTOM);
    display.setBackground(Color.WHITE);
    display.setOpaque(false);
    display.setFont(new Font(display.getFont().toString(), Font.BOLD, 30));

    p.add(display, new RCPosition(1, 1));

    addNumberButtons(p);
    addOperatorButtons(p);
    addFunctionButtons(p);
    addControlButtons(p);
    getContentPane().add(p);
}
 
Example 3
Project: jdk8u-jdk   File: Test8039464.java   Source Code and License Vote up 6 votes
private static void init(Container container) {
    container.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.BOTH;
    gbc.gridx = 0;
    gbc.gridy = 1;
    JLabel label = new JLabel();
    Dimension size = new Dimension(111, 0);
    label.setPreferredSize(size);
    label.setMinimumSize(size);
    container.add(label, gbc);
    gbc.gridx = 1;
    gbc.weightx = 1;
    container.add(new JScrollBar(JScrollBar.HORIZONTAL, 1, 111, 1, 1111), gbc);
    gbc.gridx = 2;
    gbc.gridy = 0;
    gbc.weightx = 0;
    gbc.weighty = 1;
    container.add(new JScrollBar(JScrollBar.VERTICAL, 1, 111, 1, 1111), gbc);
}
 
Example 4
Project: openjdk-jdk10   File: Test8039464.java   Source Code and License Vote up 6 votes
private static void init(Container container) {
    container.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.BOTH;
    gbc.gridx = 0;
    gbc.gridy = 1;
    JLabel label = new JLabel();
    Dimension size = new Dimension(111, 0);
    label.setPreferredSize(size);
    label.setMinimumSize(size);
    container.add(label, gbc);
    gbc.gridx = 1;
    gbc.weightx = 1;
    container.add(new JScrollBar(JScrollBar.HORIZONTAL, 1, 111, 1, 1111), gbc);
    gbc.gridx = 2;
    gbc.gridy = 0;
    gbc.weightx = 0;
    gbc.weighty = 1;
    container.add(new JScrollBar(JScrollBar.VERTICAL, 1, 111, 1, 1111), gbc);
}
 
Example 5
Project: JavaGraph   File: FormulaDialog.java   Source Code and License Vote up 5 votes
/** Returns the label displaying the current error in entered string (if any). */
private JLabel getErrorLabel() {
    if (this.errorLabel == null) {
        JLabel result = this.errorLabel = new JLabel();
        result.setForeground(Color.RED);
        result.setMinimumSize(getOkButton().getPreferredSize());
    }
    return this.errorLabel;
}
 
Example 6
Project: JavaGraph   File: FindReplaceDialog.java   Source Code and License Vote up 5 votes
/** Returns the label displaying the current error in the renaming (if any). */
private JLabel getErrorLabel() {
    if (this.errorLabel == null) {
        JLabel result = this.errorLabel = new JLabel();
        result.setForeground(Color.RED);
        result.setMinimumSize(getReplaceButton().getPreferredSize());
    }
    return this.errorLabel;
}
 
Example 7
Project: JavaGraph   File: FreshNameDialog.java   Source Code and License Vote up 5 votes
private JLabel getErrorLabel() {
    if (this.errorLabel == null) {
        JLabel result = this.errorLabel = new JLabel();
        result.setForeground(Color.RED);
        result.setMinimumSize(getOkButton().getPreferredSize());
    }
    return this.errorLabel;
}
 
Example 8
Project: JavaGraph   File: StringDialog.java   Source Code and License Vote up 5 votes
/** Returns the label displaying the current error in entered string (if any). */
private JLabel getErrorLabel() {
    if (this.errorLabel == null) {
        JLabel result = this.errorLabel = new JLabel();
        result.setBorder(BorderFactory.createEmptyBorder(3, 0, 0, 0));
        result.setForeground(Color.RED);
        result.setPreferredSize(new Dimension(200, 25));
        result.setMinimumSize(getOkButton().getPreferredSize());
    }
    return this.errorLabel;
}
 
Example 9
Project: rapidminer   File: ConfigurableDialog.java   Source Code and License Vote up 4 votes
/**
 * Initializes the GUI.
 */
private void initGUI() {
	realOuterPanel = new JPanel(new BorderLayout());

	outerLayer = new JLayer<JPanel>(realOuterPanel);
	savingGlassPane = new TransparentGlassPanePanel(WAITING_ICON,
			I18N.getGUILabel("configurable_dialog.saving_configurables"), getBackground(), 0.5f);
	outerLayer.setGlassPane(savingGlassPane);
	savingGlassPane.setVisible(false);

	JPanel pagePanel = new JPanel(new BorderLayout());

	// list of configurables
	JPanel configPanel = createConfigPanel();
	// force size so it does not resize itself depending on entered values
	configPanel.setMinimumSize(CONFIG_LIST_SIZE);
	configPanel.setMaximumSize(CONFIG_LIST_SIZE);
	configPanel.setPreferredSize(CONFIG_LIST_SIZE);
	buttonPanel = createConfigurableButtonPanel();
	// create middle spacer
	JLabel spacer = new JLabel();
	spacer.setMinimumSize(DIMENSION_SPACER_MIDDLE);
	spacer.setMaximumSize(DIMENSION_SPACER_MIDDLE);
	spacer.setPreferredSize(DIMENSION_SPACER_MIDDLE);
	// add both to an outer panel for layout reasons
	JPanel outerConfigPanel = new JPanel(new BorderLayout());
	outerConfigPanel.setBorder(BorderFactory.createMatteBorder(0, 1, 1, 1, Color.LIGHT_GRAY));
	outerConfigPanel.add(configPanel, BorderLayout.CENTER);
	outerConfigPanel.add(buttonPanel, BorderLayout.SOUTH);
	// another panel for layouting
	JPanel outermostConfigPanel = new JPanel(new BorderLayout());
	outermostConfigPanel.add(outerConfigPanel, BorderLayout.CENTER);
	outermostConfigPanel.add(spacer, BorderLayout.EAST);

	// glass pane showed if the user is not able to edit connections due to an old version of
	// the server
	simpleGlassPane = new TransparentGlassPanePanel(null, null, getBackground(), 0.5f);

	// panel displaying the selected configurable
	JPanel paramPanel = createParameterPanel();

	GridBagConstraints c = new GridBagConstraints();
	c.fill = GridBagConstraints.BOTH;
	c.weightx = 1;
	c.weighty = 0.3;
	c.gridwidth = GridBagConstraints.REMAINDER;

	// add panels to page panel
	pagePanel.add(outermostConfigPanel, BorderLayout.WEST);
	pagePanel.add(paramPanel, BorderLayout.CENTER);

	// add page and button panel to outer panel
	realOuterPanel.add(pagePanel, BorderLayout.CENTER);

	layoutDefault(outerLayer, makeSaveButton(), makeCancel());
	setDefaultSize(ButtonDialog.HUGE);
	setLocationRelativeTo(ApplicationFrame.getApplicationFrame());
	setModal(true);
	setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
	addWindowListener(new WindowAdapter() {

		@Override
		public void windowClosing(WindowEvent e) {
			cancelButton.doClick();
		}
	});

	updateButtonState(true);
}
 
Example 10
Project: rapidminer   File: OAuthDialog.java   Source Code and License Vote up 4 votes
/**
 * Basic method to initialize the GUI.
 */
private void initGUI() {
	JPanel outerPanel = new JPanel();
	outerPanel.setLayout(new GridBagLayout());
	GridBagConstraints gbc = new GridBagConstraints();

	gbc.gridx = 0;
	gbc.gridy = 0;
	gbc.weightx = 1;
	gbc.fill = GridBagConstraints.BOTH;
	outerPanel.add(createStep1Panel(), gbc);

	if (oAuth.isOAuth2()) {
		gbc.gridy += 1;
		outerPanel.add(createStep2Panel(), gbc);
	}

	statusLabel = new JLabel();
	statusLabel.setMinimumSize(new Dimension(400, 25));
	statusLabel.setPreferredSize(new Dimension(400, 25));
	statusLabel.setHorizontalAlignment(JLabel.RIGHT);
	gbc.gridy += 1;
	gbc.insets = new Insets(5, 5, 5, 5);
	outerPanel.add(statusLabel, gbc);

	gbc.gridy += 1;
	Component btPanel = createButtons();
	outerPanel.add(btPanel, gbc);

	add(outerPanel);
	layoutDefault(outerPanel, confirmButton, cancelButton);
	if (oAuth.isOAuth2()) {
		setPreferredSize(new Dimension(375, 430));
	} else {
		setPreferredSize(new Dimension(375, 320));
	}
	setResizable(false);
	setModal(true);
	pack();
	setLocationRelativeTo(ApplicationFrame.getApplicationFrame());
}
 
Example 11
Project: jreliability   File: MeasuresPanel.java   Source Code and License Vote up 3 votes
/**
 * Creates the {@link JPanel} showing the mean time to failure.
 * 
 * @param mttf
 *            the mean time to failure
 * @param maxWidth
 *            the dimension of the longest label
 * @return the JPanel showing the mean time to failure
 */
private JPanel createMttfPanel(Double mttf, Dimension maxWidth) {
	JLabel mttfLabel = new JLabel("MTTF:");
	mttfLabel.setMinimumSize(maxWidth);

	JLabel expectedValue = new JLabel(mttf.toString());

	return createSubPanel("Mean-Time-To-Failure", mttfLabel, expectedValue);
}