Jump to content

[1.7.10] [SOLVED] GUI Option Button?


SebasTheGreat

Recommended Posts

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.

Link to comment
Share on other sites

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 :).

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.