Allanh
Allanh

Reputation: 507

There are some method to use toggle buttons without need to create a lot of conditions

I'm developing a program in java for admin orders in a restaurant. I have a screen like this. Frame for admin orders.

I want to select any button from left and any button from right and clic in button "Agregar" later. I'm thinking to do a method with a lot of conditions if and else if, for example.

if(buttonCombo1.isSelected() and buttonNumber1.isSelected()){
//Doing something
}else if(buttonCombo1.isSelected() and buttonNumber2.isSelected()){
//Doing something
}

I would have to do a lot of conditions, and I have no idea do otherwise. If you can help me to find another way for do It, I would be grateful.

Note: I apologize for my bad english. I'm learning yet. Thanks so much.

Upvotes: 0

Views: 43

Answers (1)

João Santos
João Santos

Reputation: 34

I don't remember if you can group simple buttons. But you can define a click function in each button to change the value of button in a Bollean Array (with lenght equals amount of button.)

In this case, you will have acess a boolean value directly for a index.

Upvotes: 0

Related Questions