Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

help needed in makin GUI (in netbeans) for a maths program(with lots of loops).

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Bartender
Posts: 563
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Cross posted in DIC.
 
Ranch Hand
Posts: 41
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic