• Post Reply Bookmark Topic Watch Topic
  • New Topic

I'm stuck with calculator GUI  RSS feed

 
Seetamraj Sriharsha
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 ?
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 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
 
Rob Camick
Ranch Hand
Posts: 2801
15
  • 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
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 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
 
eric aro
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..
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!