Can I add JRadioButton into JTable

It’s not clear how you want to use JRadioButton in a JTable; consider these alternatives: Use SINGLE_SELECTION mode to select individual rows. table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); Use a column of type Boolean.class, which will be rendered using a JCheckBox. This example limits selections to a single row. Use a JComboBox as an editor for mutually exclusive choices within … Read more

Setting print size of a jLabel and put a jRadiobutton on the print

So, based on the concept presented in Printing a JFrame and its components, I’ve been able to produce these two examples… Which used the following JPanel as the base component… public static class PrintForm extends JPanel { public PrintForm() { setLayout(new GridBagLayout()); JLabel label = new JLabel(“This is a label”); label.setVerticalTextPosition(JLabel.BOTTOM); label.setHorizontalTextPosition(JLabel.CENTER); try { label.setIcon(new … Read more

Adding jRadioButton into jTable

If you want to edit the value of a table cell, you must set a TableCellEditor. You should create a single JRadioButton in your renderer and reuse it everywhere, that is the purpose of TableCellRenderer. If you are not calling super.getTableCellRendererComponent, it is not need to extend DefaultTableCellRenderer, simply implement TableCellRenderer. Consider reading the JTable … Read more

How to add JRadioButton to group in JTable

As an alternative, use a JComboBox as an editor for mutually exclusive choices within a row. For convenience, DefaultCellEditor offers a constructor especially for this. The result also makes more efficient use of horizontal space in the row. DependentColumn is an example, shown below. See also these other alternatives. Figure from @mKorbel’s StatusRenderer and StatusEditor, … Read more