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) {                                         

        jTextField1.setText("" + clicked);

    else {
            jTextField2.setText("" + clicked);

} `

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

Edited by Rashmi_1: changed formatting

9 Months
Discussion Span
Last Post by JamesCherrill
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.