GeeCON Prague 2014*
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
Author

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
Sheriff

Joined: Oct 27, 2005
Posts: 19697
    
  20

PatienceIsAVirtue.

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):


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
GeeCON Prague 2014
 
subject: Layout problem using AWT