Posted February 13, 201510 yr Hey so I'm trying to make an Option Button for my GUI that toggles invisibility. I need to know how to set up the Option Button, as it seems very complicated from the vanilla code I've looked at. After looking at the vanilla code and getting nowhere, I decided to come ask. If you have a video or post that teaches how to do it just link it and I'll figure it out from there. If you know how to do it I would be very thankful for your help.
February 13, 201510 yr What do you mean by option button? Just a normal button? I require Java, both the coffee and the code
February 13, 201510 yr Author No I know how to make a button, but I need the button that once you press it, turns on. Then the button changes to the turn off button and you can press it again to turn it off. An example would be the clouds button in the option menu. It toggles clouds on and off, that's what I'm trying to make, only for something other than clouds .
February 14, 201510 yr Author Hey so I made this in my actionPerformed method: boolean on = guiButton.displayString == "On"; if(on) { guiButton.displayString = "Off"; } else if(!on) { guiButton.displayString = "On"; } It toggles just the way I want it to but now I have 1 problem. How do I save what the text is? If I set it to on and leave the GUI, when I come back its back to off.
February 14, 201510 yr Hey so I made this in my actionPerformed method: boolean on = guiButton.displayString == "On"; if(on) { guiButton.displayString = "Off"; } else if(!on) { guiButton.displayString = "On"; } It toggles just the way I want it to but now I have 1 problem. How do I save what the text is? If I set it to on and leave the GUI, when I come back its back to off. This really is just basic java.
February 14, 201510 yr Author Sometimes I just do and say the dumbest things. I got it working all thanks to you guys .
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.