File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Critique my beginner basic GUI calculation program and need some clarifications Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Critique my beginner basic GUI calculation program and need some clarifications" Watch "Critique my beginner basic GUI calculation program and need some clarifications" New topic
Author

Critique my beginner basic GUI calculation program and need some clarifications

John Laker
Greenhorn

Joined: Oct 01, 2010
Posts: 22


This is a GUI that I wrote for learning more about how to use GUI's in Java.

What you can help me with is the layout of components. I wanted to have the layout of components something like this



Right now it is setup with flowlayout to be in one row. Can someone let me know the code to set it up the way I want.

Also I don't know why I'm using this in the main method


The teacher used that in one of the examples, so I'm using it. But I don't know why.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4540
    
    5

1. http://download.oracle.com/javase/tutorial/uiswing/layout/index.html
2. http://download.oracle.com/javase/tutorial/uiswing/concurrency/index.html

Ask if anything there still isn't clear.


luck, db
There are no new questions, but there may be new answers.
John Laker
Greenhorn

Joined: Oct 01, 2010
Posts: 22


I read it, but not sure which one fits what i want to do.

Also I have this code



but the GUI doesn't have these dimensions
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10329
    
    8

You can nest layouts.
Panel1 has the result , centered
Panel2 has num1, num2 centered
Panel3 has +,-,/,* centered
DaddyPanel has panel1,panel2 and panel3 aligned vertically
DaddyPanel is added to the content pane.

You need to choose an appropriate layout (there are others besides the FlowLayout you have been using) The link Darryl provided, will help you find out these layouts.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Critique my beginner basic GUI calculation program and need some clarifications