Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Switch Like Interface using JRadioButtons

Can anyone please tell me how to make an interface like that which is been shown below. Right now i'm using two JRadioButton for implementing that task. My code which i've done is shown below

JRadioButton but1 = new JRadioButton("Option 1");
JRadioButton but2 = new JRadioButton("Option 2");

ButtonGroup db=new ButtonGroup();
db.add(but1);
db.add(but2);

But how can we make the interface shown in the picture which does the same task that i've done through JRadioButtons.

enter image description here

like image 741
Nidhish Krishnan Avatar asked Jul 07 '26 06:07

Nidhish Krishnan


1 Answers

  • required custom Icons and two JToggleButtons chained by ItemListener

  • create JSlider with two ranges (required custom painting)

  • great idea by @oliholz

like image 65
mKorbel Avatar answered Jul 09 '26 18:07

mKorbel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!