JavaRanch » Java Forums »
Java »
Swing / AWT / SWT
| Author |
help needed in makin GUI (in netbeans) for a maths program(with lots of loops).
|
F Boomboom
Greenhorn
Joined: Jun 17, 2011
Posts: 1
|
|
hey i'm new in java. i need to make GUI for my program but i'm confused as to what to wirte in GUI codes and what to write in Main codes etc. could someone please help me?
mathprogram.java main class
random.java class
addition.java class
subtraction.java class
multiplication.java class
division.java class
mathmenu.java guiclass(i just started learning about gui like literally yesterday, all i know is how to design the GUI and how to let the user key in- im confused how to code in this class, and am i supose to write all the loops here instead of the mathprogram.java(main class). could someone show me how to do it?
|
 |
Greg Brannon
Bartender
Joined: Oct 24, 2010
Posts: 530
|
|
|
Cross posted in DIC.
|
Learning Java using Eclipse on OpenSUSE 11.2
Linux user#: 501795
|
 |
Ashutosh M Kulkarni
Ranch Hand
Joined: Jun 07, 2010
Posts: 41
|
|
First of all, welcome to the Ranch and the fascinating world of Java.
About your JFrame class, it pretty much looks like you have posted the code of a frame that you designed in NetBeans (or similar IDE). The whole code in initComponents() method declaration is auto-generated. Since you are providing the user with a Swing interface, it's only recommended to use the frame itself for coding rather than having a separate class.
With an IDE such as NetBeans, it's quite easy to do this. All you need to do is just use the GUI design mode and use the components context menus.
For example, consider you have a Frame named myFrame, in which you have few textfields and a Submit and a Cancel button. Your aim would to be close/kill the window on clicking "Cancel". For this, in design mode, you just right-click the "Cancel" button and go to
Events-> action -> actionPerformed.
When you click on actionPerformed, you will be taken to source code and a method will be readily created of the form
Now all you need to do here is, write this in your method.
Also, this could help you a lot in what you wish to do. This should give you a basic idea... Keep digging in.
http://java.sun.com/developer/technicalArticles/tools/nb_guibuilder/
Also, if possible, please post a screenshot of your frame here so it would help others to assist you better.
Cheers,
Ashutosh.
|
SCJP 6, next stop - OCPJWCD!
|
 |
 |
|
|
subject: help needed in makin GUI (in netbeans) for a maths program(with lots of loops).
|
|
|
|