File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Layout problem using AWT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Layout problem using AWT" Watch "Layout problem using AWT" New topic

Layout problem using AWT

Naresh Talluri
Ranch Hand

Joined: Oct 12, 2007
Posts: 115
Hi All

I have small problem with AWT while arranging buttons.
I want to arrange one text field in one line , and next all lines will be followed by buttons like calculator.
I can able to show buttons as i like but text field is not showing appropriately.

here is my code :

Here is the whole class, if you want you can execute directly, and am attaching output of the program as well.
could you please let me know how can i achieve,
I really appriciate if anyone have any solutions.

[Thumbnail for output.jpg]

Naresh Talluri
Ranch Hand

Joined: Oct 12, 2007
Posts: 115
Can anyone please let me know any solutions..
Rob Spoor

Joined: Oct 27, 2005
Posts: 20269


On line 28 you add textpanel. A Frame uses a BorderLayout by default. You omit the constraints so that means you add textpanel to the center. On line 29 you then add panel - again to the center. This overwrites textpanel, effectively removing it from the frame.

Specify the constraints when adding textpanel (and preferably, panel as well):

How To Ask Questions How To Answer Questions
I agree. Here's the link:
subject: Layout problem using AWT
It's not a secret anymore!