This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Simple GUI for math programs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Simple GUI for math programs " Watch "Simple GUI for math programs " New topic
Author

Simple GUI for math programs

Mike Polioudakis
Greenhorn

Joined: Aug 25, 2008
Posts: 1
My first post, on almost any site. I need a simple GUI for JAVA for Windows for programs that do mostly math manipulations. The user needs to be able to know the program is running, know the program has ended, be able to specify file locations for input and output, provide names for new files, and see where output has gone. This should not be fancy. It should allow the user to "browse" to specify file locations rather than have to type in full directory locations. For example, I have a program that figures kinship (relatedness) indicators between two people in a population. I originally learned Pascal, C, and C++ a long time ago but did not make it to GUIs. I can render all my old programs into JAVA easily enough except for simple GUIs (console alone not enough). Without a GUI, modern users are stuck, and all my old programs are useless. Any help much appreciated. I will learn fancier GUIS later. You can hand me some code, or I am open to other sources such as books (don't have a lot of money to spend these days). Thanks a lot.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Welcome to JavaRanch!

Your first resource for building a Java GUI should be The Java Swing Tutorial. I think you'll find everything you need there.

If you're building a GUI (especially a Java GUI) for the first time, don't be overwhelmed. There are a lot of steps and a lot of pieces to manage. So understand that this will not be a "quick code insert." Be prepared to spend some time on this.

I strongly recommend looking at the Model-View-Controller (MVC) pattern. This will help you set up your code in a manageable way. You mentioned that you can already translate your old programs in Java to work with the console. That's excellent, because this is the "Model" component of the MVC pattern. The GUI is the "View," which should be entirely separate from your logical model. The "Controller" is the piece that connects the Model and View.

Finally, we have a forum dedicated to GUIs, so I'll move this topic there for you. Please continue in that forum.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 685
If you'd like a very simple GUI builder that generates AWT code try this:Simple GUI builder

It presents an empty window that you can RC on to add components. The components can be moved around and resized. The code has lots of weird features (bugs) but I've been able to use it to put Q&D front ends on various utilities that need user input as you describe. If you'd like to help me remove some of the bugs, let me know & I'll send you the source.
Good luck,
Norm
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by Norm Radder:
If you'd like a very simple GUI builder that generates AWT code try this:Simple GUI builder

It presents an empty window that you can RC on to add components. The components can be moved around and resized. The code has lots of weird features (bugs) but I've been able to use it to put Q&D front ends on various utilities that need user input as you describe. If you'd like to help me remove some of the bugs, let me know & I'll send you the source.
Good luck,
Norm


I don't think this is helpful for three reasons:

1. Being new to GUI coding the OP shouldn't concern themselves with builders. They need to dig in and write the code so they can learn it.

2. AWT based GUI's are so 1998. In this (java) day and age building GUI's with Swing is the way to go, builder or no builder.

3. If a gui builder must be used there are several excellent quality bug free tools available. Netbeans Matisse, for example. Or JFormDesigner.


GenRocket - Experts at Building Test Data
Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 685
Yes, the OP should learn Swing. No differences there.
However, there is a LONG learning curve for Swing and for IDEs.

A lot of utilities I've written have taken longer to put a GUI on them than all the rest of the code and a lot more. That's why I wrote this simple program. On my first computer Swing was so slow that I could watch the components as they were placed in the layout. AWT was a lot faster.

While studying Swing and how to use the IDEs he can play with my simple tool.
The problems with IDEs for beginners is there is TOO much magic involved. Knowing what goes on underneath will make a better programmer. Another problem I've seen is that the new version of Netbeans came with java 1.6 and required all users of its output to have 1.6. Not all non-programming users are interested in having to install a new version of java.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Originally posted by Norm Radder:
While studying Swing and how to use the IDEs he can play with my simple tool.


What good does it do to try and learn swing by using AWT widgets? No one develops GUI applications using only AWT anymore. I'm not saying your tool is bad. I'm just advising the OP that using it might be converse to what they are trying to achieve, learning Swing.
Ted Smyth
Ranch Hand

Joined: May 28, 2008
Posts: 73
A little bit of a tangent I guess, but I've always wondered why GUI development in Java moved from AWT to Swing/SWT. Is it because of L&F, limitations of AWT, both, or more?

I only got onto the GUI scene about a 1.5 years ago.


Edward Smith
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37891
    
  22
At least partially L&F; an AWT GUI looks different on Windows, on Unix/Linux and on Macs.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19649
    
  18

Availability of controls is another. Swing has tables and trees for instance, whereas AWT doesn't.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
wood burning stoves
 
subject: Simple GUI for math programs
 
Similar Threads
Which GUI technology to learn
Runtime.exec() hell. Any opinions? explanations?
How do i get my none programmer friends to try out my simple programs by just clicking on them?
Damn newbie has a question.
About stop the RMI server