• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

I'm stuck with calculator GUI

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


My task is to allow user to enter input only through clicking buttons but not keyboard. So I figured out that I have to use 'isEditable' to the 'TextField'.

I'm clear with buttonsa also. Only thing that is bothering me is the shallow spaces where all the components are placed. It is clear in the case of two horizontal lines.

Those can be drawn using 'drawLine' but what about the pits ?

And I'm thiking to place all these components in 'GridLayout'. Is that a good way ?

In general, what should I call all these elements ( Button, TextField, Label ) in a panel ? Is the word component appropriate ?
 
Bartender
Posts: 11445
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For the "shallow pits" check out JSeparator
Yes. Components is correct, especially JComponent if you are using Swing (and should)
 
Seetamraj Sriharsha
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Maneesh Godbole wrote:For the "shallow pits" check out JSeparator



Thanks, I'll try that
 
Rancher
Posts: 3157
28
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your last two postings you have mentioned using "TextField" both times. TextField is an AWT component. If you are going to learn Java Iwould suggest you learn Swing, which is more current and more flexible than AWT.

You can start with the Swing tutorial.
 
Maneesh Godbole
Bartender
Posts: 11445
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can ask whatever questions you have here on the forums. We do not encourage private messages or emails.
http://faq.javaranch.com/java/UseTheForumNotEmail

JSeparator is just like any other JComponent which you would add to the parent container.
Just use parentContainer.add(new JSeparator());
To check out real life use, take a look at the JMenu API and follow the How To Use Menus link from the API
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1/ use a main vbox or VBOxLayout, then a gridbaglayout for the buttons (with an vertical and horizontal spacing)

2/ unless this is a teaching lesson (in witch case by hand is much better), otherwise use a visual builder, you'll have found all your answers in a matter of hours. Such a layout takes 10 minutes with a visual builder.

 
Seetamraj Sriharsha
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Maneesh Godbole wrote:
JSeparator is just like any other JComponent which you would add to the parent container.
Just use parentContainer.add(new JSeparator());
To check out real life use, take a look at the JMenu API and follow the How To Use Menus link from the API




I got this from 'Sun'...

" The JSeparator class provides a horizontal or vertical dividing line or empty space. It's most commonly used in menus and tool bars. "

I got it now. I have to go with BorderFactory..
 
It is sorta covered in the JavaRanch Style Guide.
    Bookmark Topic Watch Topic
  • New Topic