-1

i´m a newbie to java

my program has 4 JRadiobuttons (button1, button2, button3, button4) & 1 Button(b), when i clicked (b), random int show on 4 JRadioButton now i want to

1.****compare (by clicking b) the int(value) of button1, with the button2, how can i do that?

2.****if int of button1 is greater than button2, a text should show "button2 is greater"

   b.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) 
        {
            if(e.getSource()==button2) 
            {
               if(button1==button2)

               some idea for me??

            }}

Thank you for helping me

Rufus_12
  • 392
  • 1
  • 5
  • 14

1 Answers1

0

Do you really want JRadioButtons? Don't you think labels would fit better?
to your second point: I think you mean when the value of button2 is greater show button2 is greater

@Override
        public void actionPerformed(ActionEvent e) 
        {
        button1value = Integer.parseInt(button1.getText());
        button2value = Integer.parseInt(button2.getText());
        if(button1value<button2value){
            txtLoc.setText("Button 2 is greater");
        }
}
Rufus_12
  • 392
  • 1
  • 5
  • 14