File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Simple GUI for math programs

 
Mike Polioudakis
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11343
Java Mac Safari
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Norm Radder
Ranch Hand
Posts: 707
3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Norm Radder
Ranch Hand
Posts: 707
3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47300
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At least partially L&F; an AWT GUI looks different on Windows, on Unix/Linux and on Macs.
 
Rob Spoor
Sheriff
Pie
Posts: 20396
47
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Availability of controls is another. Swing has tables and trees for instance, whereas AWT doesn't.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic