0

I have a question regarding this way of solving the problem. I need a bigger check box. Partial solution of the problem writer in a method:

private JCheckBox createCheckBox() {
    Icon normal = new ImageIcon(...);
    Icon selected = new ImageIcon(...);
    JTable table = new JTable(what parameter);
    table.setRowHeight(...);

    TableCellRenderer renderer = table.getDefaultRenderer(Boolean.class);
    JCheckBox checkBoxRenderer = (JCheckBox)renderer;
    checkBoxRenderer.setIcon( normal );
    checkBoxRenderer.setSelectedIcon( selected );

    DefaultCellEditor editor = (DefaultCellEditor)table.getDefaultEditor(Boolean.class);
    JCheckBox checkBoxEditor = (JCheckBox)editor.getComponent();
    checkBoxEditor.setIcon( normal );
    checkBoxEditor.setSelectedIcon( selected );
    return which panel?
}

Two questions

  1. Which panel should I return if I want to add this panel to my mail panel?
  2. What parameter can a give in the constructor for JTable table = new JTable(...);?
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Maria
  • 1
  • 1
    You need a bigger check box so you're creating a `JTable`? You could just specify the icons for a `JCheckBox` and return that instead – MadProgrammer Oct 09 '15 at 08:53
  • 1
    ***"Two questions"*** SO is not a help desk, but a Q&A site where each thread should be a single question. That helps people to find it later. – Andrew Thompson Oct 09 '15 at 09:14
  • Alos consider a custom `TableCellEditor` using a `JToggleButton`. – trashgod Oct 09 '15 at 09:24
  • Question for MadProgrammer? Can you please write to me the correct way of writing the method? I guess I ve done something wrong, my checkbox is not shown. Thank you . – Maria Oct 09 '15 at 11:04

0 Answers0