Welcome to TRiBot Forums

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

tnwrestler360

How to create a GUI (Using Netbeans Java IDE)

28 posts in this topic

Hello all, this is a tutorial that is much needed by the forums. I thought of linking one from another site but thought it might be better to write my own. You can create a GUI by simply writing it yourself however Netbeans allows us to create one while viewing it.

Here we go :)

Step 1: Downloading Netbeans Java IDE

Follow the link here the the IDE download and install it (If you don't already use Netbeans)

The java SE package will work

Step 2: Creating your GUI

Create a new project so we can make our GUI by clicking file->new project.

Make a Java Application Project.

After making our project we are going to create a new JFrame. Right-Click on your default package and click "JFrame Form". You should be here:

Posted Image

Name it what you please but I tend you stick with the template yourScriptNameGUI.

Now we are ready to start creating our GUI, I start out with a jLabel at the top of our frame with our script name. We do this by clicking jLabel on the palette and snapping it to our JFrame.

Palette:

Posted Image

Properties:

Posted Image

We change the text from "jLabel1" by locating the properties pane and changing the text variable and clicking back on your jFrame.

If you are making a GUI for your script your are already going above and beyond, so I suggest adding a jPanel below your jLabel to add a bit of order to your GUI. If your script has a lot of on start arguments to grab you might want to consider splitting it up into more panels. To add a jPanel go to your palette once again, then drop the box into your form.

jPanel:

Posted Image

Your panel will look different to start with but I added a titled border by clicking the button I circled in the picture in the properties pane.

Now we are ready to actually make the options for our GUI. Add more jLabels to explain what each option is and below I will show you two different ways to get our arguments.

jComboBox:

Posted Image

To edit the options click the "..." in the properties pane next to model. This is for options with a few different choices.

jTextField:

Posted Image

The text field can be used for just about any argument as you can parse an Integer from the string in the box or grab a string.

After we create the means to get our option we want to give these items meaningful names so we can easily reference them in our script. In the same panel as properties you can view the "code" options. Click this and change the variable name to whatever you desire.

Renaming variable:

Posted Image

After we rename our variables we are almost done! Now lets make a button so that our user can tell us when the script is ready to be started. Now double click on the button to generate the action preformed code for it.

Posted Image

Congratulations, you have just successfully created your first GUI. Check out how to implement it into your script here

1 person likes this

Share this post


Link to post
Share on other sites

Looks really good. This will help a lot of people out.

Thanks. It's not necessarily for dummies but you shouldn't be making a GUI if you don't know the very basics right? lol

Share this post


Link to post
Share on other sites

i am going to be trying to make some scripts so this is a very useful link for me keep up the good work and thanks for a heads up

Share this post


Link to post
Share on other sites

is the whole concept the same for eclipse?

Yes, I started out using NetBeans because when I started writing I was to stupid to figure out the one in Eclipse. The funny thing is I use eclipse to write and NetBeans to make my GUI. The functionality of NetBeans GUI builder is unmatched imo.

Share this post


Link to post
Share on other sites

is the whole concept the same for eclipse?

Yes, I started out using NetBeans because when I started writing I was to stupid to figure out the one in Eclipse. The funny thing is I use eclipse to write and NetBeans to make my GUI. The functionality of NetBeans GUI builder is unmatched imo.

oh sweet, so I guess i'll just use netbeans for gui then haha

Share this post


Link to post
Share on other sites

I will be using this and adding it to my miner very soon. Hopefully with this I can make it into an AIO. Thank you, a lot.

Share this post


Link to post
Share on other sites

Nice, I like the effort you put on this thread but isn't it true that Netbeans puts a lot of useless code while making GUI?

Share this post


Link to post
Share on other sites

Helped me a lot as a supplement to what I already knew. Great post, hope you will make some new ones with graphics as well ;)

Share this post


Link to post
Share on other sites

this isn't even a link. it's just text... Congratulations, you have just successfully created your first GUI. Check out how to implement it into your script here 

 

[edit] wtf this is from 2013 my bad

Edited by Flamo353

Share this post


Link to post
Share on other sites

Awesome tutorial / guide. I am thoroughly impressed with the amount of community scripting support via these tutorials. Being new to java, this sort of stuff (gui, paint, etc..) is very new to me. I am able to write the scripts (I am familiar with js) easily enough, but this other "java-y" stuff is beyond me at this point. Once again, thank you!

Share this post


Link to post
Share on other sites

Is it normal if the gui takes 10 seconds to load and the client is unresponsive?

Share this post


Link to post
Share on other sites
13 minutes ago, some0ne said:

Is it normal if the gui takes 10 seconds to load and the client is unresponsive?

Not from personal experience, no. What are the specs of the PC and is the client really packed with content?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.