Hi, I needed some help with fixing my code. So basically what I am trying to implement is the following:

I have 2 radio button (hours and minutes) and under each is a JTextField for each radio button. On the right side there is 2 buttons (+ and -) that should increment and decrement whichever button is selected (hours or minutes).

My code works but is missing this:

There is a ‘+’ button that increases the hours or minutes by 1 every time it is pressed, depending on which radio button has been chosen. When it reaches the maximum count, it resets to zero on the next click and keeps counting. ‘+’ and ‘-’ buttons that go forwards and backwards respectively.

Here is my code for this particular part (jButton1 = hours radio button and jButton2 = minutes radio button; jTextField1 = display hours everytime increment or decrement is pressed and same goes for jTextField2)

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                         

    if(jRadioButton1.isSelected()){
        clicked++;
        jTextField1.setText("" + clicked);

    }
    else {
        if(jRadioButton2.isSelected()){
            clicked++;
            jTextField2.setText("" + clicked);
        }    


    }
} `

I have been trying to figure this out but can't find a solution.

What exactly is theproblem... what is happening that shouldn't or what is not happening that should?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.