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

The following examples show how to use javax.swing.JCheckBox#setBorderPainted() . 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: CodeSetupPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public TableCellEditor getCellEditor(int row, int column) {
    if(showParamTypes) {
        String paramName = (String) tableModel.getValueAt(row, 0);
        Class type = (column == 2) ? (Class) tableModel.getValueAt(row, 1) : Boolean.class;

        if (Enum.class.isAssignableFrom(type)) {
            JComboBox combo = new JComboBox(type.getEnumConstants());
            return new DefaultCellEditor(combo);
        } else if (type == Boolean.class || type == Boolean.TYPE) {
            JCheckBox cb = new JCheckBox();
            cb.setHorizontalAlignment(JLabel.CENTER);
            cb.setBorderPainted(true);
            return new DefaultCellEditor(cb);
        } else if (paramName.toLowerCase().contains(Constants.PASSWORD)) {
            return new DefaultCellEditor(new JPasswordField());
        }
    }

    return super.getCellEditor(row, column);
}
 
Example 2
Source File: CodeSetupPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, 
        boolean hasFocus, int row, int column) {
    Component ret = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    String paramName = (String) tableModel.getValueAt(row, 0);

    if (value == null) {
        return new JLabel(NbBundle.getMessage(CodeSetupPanel.class, "LBL_NotSet"));
    } else if (value instanceof Class) {
        return new JLabel(((Class) value).getName());
    } else if (value instanceof Boolean) {
        JCheckBox cb = new JCheckBox();
        cb.setHorizontalAlignment(JLabel.CENTER);
        cb.setBorderPainted(true);
        cb.setSelected((Boolean) value);
        return cb;
    } else if (paramName.contains(Constants.PASSWORD)) {
        return new JPasswordField((String) value);
    } 
    return ret;
}
 
Example 3
Source File: MuleModulesCheckBoxList.java    From mule-intellij-plugins with Apache License 2.0 6 votes vote down vote up
public Component getListCellRendererComponent(
                JList<? extends JCheckBox> list, JCheckBox value, int index,
                boolean isSelected, boolean cellHasFocus) {
            JCheckBox checkbox = value;

            //Drawing checkbox, change the appearance here
/*
            checkbox.setBackground(isSelected ? getSelectionBackground()
                    : getBackground());
            checkbox.setForeground(isSelected ? getSelectionForeground()
                    : getForeground());
*/
            checkbox.setEnabled(isEnabled());
            checkbox.setFont(getFont());
            checkbox.setFocusPainted(false);
            checkbox.setBorderPainted(true);
            checkbox.setBorder(isSelected ? UIManager
                    .getBorder("List.focusCellHighlightBorder") : noFocusBorder);
            return checkbox;
        }
 
Example 4
Source File: DefaultsDisplay.java    From littleluck with Apache License 2.0 6 votes vote down vote up
public ValueRenderer(Color colors[]) {
    super(colors);
    buttonIconRenderer = new JButton();
    buttonIconRenderer.setBorderPainted(false);
    buttonIconRenderer.setContentAreaFilled(false);
    buttonIconRenderer.setText("(for AbstractButtons only)");
    radioIconRenderer = new JRadioButton();
    radioIconRenderer.setBorderPainted(false);
    radioIconRenderer.setText("for JRadioButtons only)");
    checkboxIconRenderer = new JCheckBox();
    checkboxIconRenderer.setBorderPainted(false);
    checkboxIconRenderer.setText("for JCheckBoxes only)");
    menuItemIconRenderer = new JMenuItem();
    menuItemIconRenderer.setBorderPainted(false);
    menuItemIconRenderer.setText("(for JMenuItems only)");
    
}
 
Example 5
Source File: DefaultsDisplay.java    From beautyeye with Apache License 2.0 6 votes vote down vote up
public ValueRenderer(Color colors[]) {
    super(colors);
    buttonIconRenderer = new JButton();
    buttonIconRenderer.setBorderPainted(false);
    buttonIconRenderer.setContentAreaFilled(false);
    buttonIconRenderer.setText("(for AbstractButtons only)");
    radioIconRenderer = new JRadioButton();
    radioIconRenderer.setBorderPainted(false);
    radioIconRenderer.setText("for JRadioButtons only)");
    checkboxIconRenderer = new JCheckBox();
    checkboxIconRenderer.setBorderPainted(false);
    checkboxIconRenderer.setText("for JCheckBoxes only)");
    menuItemIconRenderer = new JMenuItem();
    menuItemIconRenderer.setBorderPainted(false);
    menuItemIconRenderer.setText("(for JMenuItems only)");
    
}
 
Example 6
Source File: JPanel_AppManager.java    From MobyDroid with Apache License 2.0 5 votes vote down vote up
public JCheckBoxTableHeaderCellRenderer() {
    jCheckBox = new JCheckBox();
    jCheckBox.setFont(UIManager.getFont("TableHeader.font"));
    jCheckBox.setBorder(UIManager.getBorder("TableHeader.cellBorder"));
    jCheckBox.setBackground(UIManager.getColor("TableHeader.background"));
    jCheckBox.setForeground(UIManager.getColor("TableHeader.foreground"));
    jCheckBox.setHorizontalAlignment(SwingConstants.CENTER);
    jCheckBox.setBorderPainted(true);
}
 
Example 7
Source File: JPanel_TaskManager.java    From MobyDroid with Apache License 2.0 5 votes vote down vote up
public JCheckBoxTableHeaderCellRenderer() {
    jCheckBox = new JCheckBox();
    jCheckBox.setFont(UIManager.getFont("TableHeader.font"));
    jCheckBox.setBorder(UIManager.getBorder("TableHeader.cellBorder"));
    jCheckBox.setBackground(UIManager.getColor("TableHeader.background"));
    jCheckBox.setForeground(UIManager.getColor("TableHeader.foreground"));
    jCheckBox.setHorizontalAlignment(SwingConstants.CENTER);
    jCheckBox.setBorderPainted(true);
}
 
Example 8
Source File: DefaultOutlineCellRenderer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
final JCheckBox createCheckBox() {
    JCheckBox cb = new JCheckBox();
    cb.setSize(cb.getPreferredSize());
    cb.setBorderPainted(false);
    cb.setOpaque(false);
    return cb;
}
 
Example 9
Source File: SimpleXYChartUtils.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
public IconCheckBox(String text, Icon icon, boolean selected) {
    renderer = new JCheckBox(text, icon) {
        public boolean hasFocus() {
            return IconCheckBox.this.hasFocus();
        }
    };
    renderer.setOpaque(false);
    renderer.setBorderPainted(false);
    setSelected(selected);
    setBorderPainted(false);
}
 
Example 10
Source File: CustomCheckBoxList.java    From tmc-intellij with MIT License 5 votes vote down vote up
@Override
public Component getListCellRendererComponent(
        JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    JCheckBox checkbox = (JCheckBox) value;
    checkbox.setBackground(isSelected ? getSelectionBackground() : getBackground());
    checkbox.setForeground(isSelected ? getSelectionForeground() : getForeground());
    checkbox.setFont(getFont());
    checkbox.setFocusPainted(false);
    checkbox.setBorderPainted(false);
    checkbox.setBorder(
            isSelected
                    ? UIManager.getBorder("List.focusCellHighlightBorder")
                    : new EmptyBorder(1, 1, 1, 1));
    return checkbox;
}
 
Example 11
Source File: CheckBoxList.java    From spotbugs with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public Component getListCellRendererComponent(JList<? extends E> list, E value, int index, boolean isSelected,
        boolean cellHasFocus) {
    JCheckBox checkbox = (JCheckBox) value;
    checkbox.setBackground(isSelected ? getSelectionBackground() : getBackground());
    checkbox.setForeground(isSelected ? getSelectionForeground() : getForeground());
    checkbox.setEnabled(isEnabled());
    checkbox.setFont(getFont());
    checkbox.setFocusPainted(false);
    checkbox.setBorderPainted(true);
    checkbox.setBorder(isSelected ? UIManager.getBorder("List.focusCellHighlightBorder") : noFocusBorder);
    return checkbox;
}