• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Critique my beginner basic GUI calculation program and need some clarifications

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
John Laker
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Darryl Burke wrote: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.



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
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic