Java Code Examples for javax.swing.JCheckBox#setPreferredSize()

The following examples show how to use javax.swing.JCheckBox#setPreferredSize() . 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: ImageGallery.java    From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 6 votes vote down vote up
/**
 * create returns the thumb selector component
 *
 * @param f
 * @return
 */
private JComponent getThumbSelector(final String f) {
    final JCheckBox cb = new JCheckBox();
    cb.setText("");
    cb.setSelected(false);
    cb.setName(f);
    cb.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (cb.isSelected()) {
                selflist.add(f);
            } else {
                selflist.remove(f);
            }
        }
    });
    cb.setPreferredSize(CB_SIZE);
    return cb;

}
 
Example 2
Source File: NullableObject.java    From jclic with GNU General Public License v2.0 6 votes vote down vote up
/** Creates new NullableObject */
public NullableObject() {

  super(new java.awt.BorderLayout());
  setOpaque(false);
  nullValue = true;

  check = new JCheckBox();
  check.setPreferredSize(checkDim);
  check.setMinimumSize(checkDim);
  check.setFocusPainted(false);
  check.setSelected(false);
  add(check, java.awt.BorderLayout.WEST);

  button = buildButton();
  button.setPreferredSize(btDim);
  button.setMinimumSize(btDim);
  button.setFocusPainted(false);
  add(button, java.awt.BorderLayout.CENTER);

  check.addActionListener(this);
  button.addActionListener(this);
}
 
Example 3
Source File: ImageGallery.java    From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 5 votes vote down vote up
/**
 * create returns the thumb close component
 *
 * @param p
 * @return
 */
private JComponent setupThumbClose(final JPanel p) {
    JCheckBox cb = new JCheckBox();
    cb.setIcon(close);
    cb.setSelectedIcon(closesel);
    cb.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            removeThumbPanel(p);
        }
    });
    cb.setPreferredSize(CL_SIZE);
    cb.setMaximumSize(CL_SIZE);
    return cb;
}
 
Example 4
Source File: JPlagCreator.java    From jplag with GNU General Public License v3.0 5 votes vote down vote up
public static JCheckBox createCheckBox(String toolTip) {
	JCheckBox box = new JCheckBox();

	box.setFont(JPlagCreator.SYSTEM_FONT);
	box.setPreferredSize(new java.awt.Dimension(20, 20));
	box.setForeground(JPlagCreator.OPTION_PANEL_FOREGROUND);
	box.setBackground(JPlagCreator.SYSTEMCOLOR);
	if (toolTip != null && !toolTip.equals(""))
		box.setToolTipText(toolTip);
	return box;
}
 
Example 5
Source File: JPlagCreator.java    From jplag with GNU General Public License v3.0 4 votes vote down vote up
public static JCheckBox createCheckBox(String title, int width, String toolTip) {
	JCheckBox box = createCheckBox(toolTip);
	box.setText(title);
	box.setPreferredSize(new java.awt.Dimension(width, 20));
	return box;
}
 
Example 6
Source File: ActionChooserScreen.java    From chipster with MIT License 4 votes vote down vote up
public ActionChooserScreen(ImportSession importSession) {
	SwingClientApplication.setPlastic3DLookAndFeel(dialog);
	dialog.setPreferredSize(new Dimension(640, 480));
	dialog.setLocationByPlatform(true);

	this.importSession = importSession;

	table = this.getTable();
	JScrollPane scroll = new JScrollPane(table);

	// upper panel
	JLabel titleLabel = new JLabel("<html><p style=" + VisualConstants.HTML_DIALOG_TITLE_STYLE + ">" + TITLE_TEXT + "</p></html>", JLabel.LEFT);
	JLabel descriptionLabel = new JLabel("<html><p>" + INFO_TEXT + "</p></html>", JLabel.LEFT);
	GridBagConstraints c = new GridBagConstraints();
	JPanel upperPanel = new JPanel(new GridBagLayout());
	c.weightx = 1.0;
	c.weighty = 1.0;
	c.fill = GridBagConstraints.HORIZONTAL;
	c.anchor = GridBagConstraints.NORTHWEST;
	c.insets.set(10, 10, 5, 10);
	c.gridx = 0;
	c.gridy = 0;
	upperPanel.add(titleLabel, c);
	c.gridy++;
	upperPanel.add(descriptionLabel, c);
	

	// lower panel
	JPanel buttonPanel = new JPanel();
	okButton = new JButton("  OK  ");
	cancelButton = new JButton("Cancel");
	copyButton = new JButton("Apply first action to all");

	okButton.addActionListener(this);
	cancelButton.addActionListener(this);
	copyButton.addActionListener(this);

	JLabel sameSettingsLabel = new JLabel("<html><p>" + "When using Import tool to import more than one files, only define the contents of the first file and then apply the same settings for the rest of the files." + "</p></html>", JLabel.LEFT);
	sameSettingsLabel.setVerticalTextPosition(JLabel.TOP);
	//sameSettingsLabel.setPreferredSize(new Dimension(550, 40));
	
	sameSettingsCheckBox = new JCheckBox("Define file structure once and apply the same settings to all files");
	sameSettingsCheckBox.setEnabled(true);
	sameSettingsCheckBox.setSelected(true);
	sameSettingsCheckBox.setPreferredSize(new Dimension(550, 40));

	buttonPanel.setLayout(new GridBagLayout());
	GridBagConstraints g = new GridBagConstraints();
	g.anchor = GridBagConstraints.NORTHWEST;
	g.gridx = 0;
	g.gridy = 0;
	g.weightx = 0.0;

	g.insets = new Insets(5, 5, 10, 5);
	buttonPanel.add(copyButton, g);
	g.gridy++;
	buttonPanel.add(sameSettingsCheckBox, g);
	g.insets = new Insets(5, 0, 10, 5);
	g.gridy++;
	g.anchor = GridBagConstraints.EAST;
	buttonPanel.add(cancelButton, g);
	g.gridx++;
	buttonPanel.add(okButton, g);

	dialog.setLayout(new BorderLayout());
	dialog.add(upperPanel, BorderLayout.NORTH);
	dialog.add(scroll, BorderLayout.CENTER);
	dialog.add(buttonPanel, BorderLayout.SOUTH);
	dialog.pack();
	dialog.pack();
	okButton.requestFocusInWindow();
	dialog.setVisible(true);
}