package example;
//-*- mode:java; encoding:utf-8 -*-
// vim:set fileencoding=utf-8:
//@homepage@
import java.awt.*;
import java.awt.event.*;
import java.util.Arrays;
import javax.swing.*;
import javax.swing.table.*;

public final class MainPanel extends JPanel {
    private final JRadioButton r0 = new JRadioButton("0.0", true);
    private final JRadioButton r1 = new JRadioButton("0.5");
    private final JRadioButton r2 = new JRadioButton("1.0");
    private final String[] columnNames = {"String", "Integer", "Boolean"};
    private final Object[][] data = {
        {"aaa", 12, true}, {"bbb", 5, false},
        {"CCC", 92, true}, {"DDD", 0, false}
    };
    private final TableModel model = new DefaultTableModel(data, columnNames) {
        @Override public Class<?> getColumnClass(int column) {
            return getValueAt(0, column).getClass();
        }
    };
    private final JSplitPane sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new JScrollPane(new JTable(model)), new JScrollPane(new JTree()));
    public MainPanel() {
        super(new BorderLayout());
        ActionListener al = e -> {
            if (r2.isSelected()) {
                sp.setResizeWeight(1d);
            } else if (r1.isSelected()) {
                sp.setResizeWeight(.5);
            } else {
                sp.setResizeWeight(0d);
            }
        };
        ButtonGroup bg = new ButtonGroup();
        JPanel p = new JPanel();
        p.add(new JLabel("JSplitPane#setResizeWeight: "));
        for (JRadioButton r: Arrays.asList(r0, r1, r2)) {
            r.addActionListener(al);
            bg.add(r);
            p.add(r);
        }
        add(p, BorderLayout.NORTH);
        add(sp);
        setPreferredSize(new Dimension(320, 240));
        EventQueue.invokeLater(() -> {
            sp.setDividerLocation(.5);
            //sp.setResizeWeight(.5);
        });
    }
    public static void main(String... args) {
        EventQueue.invokeLater(new Runnable() {
            @Override public void run() {
                createAndShowGUI();
            }
        });
    }
    public static void createAndShowGUI() {
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (ClassNotFoundException | InstantiationException
               | IllegalAccessException | UnsupportedLookAndFeelException ex) {
            ex.printStackTrace();
        }
        JFrame frame = new JFrame("@title@");
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        frame.getContentPane().add(new MainPanel());
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
    }
}

@@ -272,202 +272,65 @@
 ate 
-final JRadioButton r0 = new JRadioButton(%220.0%22, true);%0A    private final JRadioButton r1 = new JRadioButton(%220.5%22);%0A    private final JRadioButton r2 = new JRadioButton(%221.0%22
+MainPanel() %7B%0A        super(new BorderLayout()
 );%0A
+%0A
     
-private final
+   
  Str
@@ -387,29 +387,19 @@
 %22%7D;%0A    
-private final
+   
  Object%5B
@@ -411,16 +411,20 @@
 ata = %7B%0A
+    
         
@@ -469,16 +469,20 @@
         
+ 
+   
 %7B%22CCC%22, 
@@ -510,16 +510,20 @@
  false%7D%0A
+    
     %7D;%0A 
@@ -525,29 +525,19 @@
  %7D;%0A    
-private final
+   
  TableMo
@@ -591,32 +591,36 @@
 ames) %7B%0A        
+    
 @Override public
@@ -670,16 +670,20 @@
         
+    
 return g
@@ -719,26 +719,34 @@
 ();%0A        
+   
+ 
 %7D%0A
+    
     %7D;%0A    p
@@ -748,21 +748,11 @@
     
-private final
+   
  JSp
@@ -877,65 +877,63 @@
 ));%0A
-    public MainPanel() %7B%0A        super(new BorderLayout()
+%0A        JRadioButton r0 = new JRadioButton(%220.0%22, true
 );%0A 
@@ -939,30 +939,34 @@
         
-Action
+r0.addItem
 Listener
  al = e 
@@ -961,14 +961,9 @@
 ener
- al = 
+(
 e -%3E
@@ -985,23 +985,48 @@
 if (
-r2.isSelected()
+e.getStateChange() == ItemEvent.SELECTED
 ) %7B%0A
@@ -1060,17 +1060,17 @@
 eWeight(
-1
+0
 d);%0A    
@@ -1082,95 +1082,376 @@
    %7D
- else if (r1.isSelected()) %7B%0A                sp.setResizeWeight(.5);%0A            %7D else
+%0A        %7D);%0A%0A        JRadioButton r1 = new JRadioButton(%220.5%22);%0A        r1.addItemListener(e -%3E %7B%0A            if (e.getStateChange() == ItemEvent.SELECTED) %7B%0A                sp.setResizeWeight(.5);%0A            %7D%0A        %7D);%0A%0A        JRadioButton r2 = new JRadioButton(%221.0%22);%0A        r2.addItemListener(e -%3E %7B%0A            if (e.getStateChange() == ItemEvent.SELECTED)
  %7B%0A 
@@ -1476,33 +1476,33 @@
 setResizeWeight(
-0
+1
 d);%0A            
@@ -1504,33 +1504,35 @@
      %7D%0A        %7D
-;
+);%0A
 %0A        ButtonG
@@ -1714,45 +1714,8 @@
 ) %7B%0A
-            r.addActionListener(al);%0A
     
@@ -1865,24 +1865,25 @@
 320, 240));%0A
+%0A
         Even

use ItemListener instead of ActionListener for JRadioButton