Get your CodeRanch badge!*
The moose likes Swing / AWT / SWT and the fly likes How to avoid getting ridiculously huge textboxes? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to avoid getting ridiculously huge textboxes?" Watch "How to avoid getting ridiculously huge textboxes?" New topic
Author

How to avoid getting ridiculously huge textboxes?

Besjamain Greenaway
Ranch Hand

Joined: Dec 21, 2007
Posts: 45
I want it to look the same except that I want the textboxes to be not so high. How is this done?



[Thumbnail for teGroteTextBoxen.jpg]

K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 1953
    
    7

You are using GridLayout?? If so add a panel instead of adding the text field directly to the window.


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD
Besjamain Greenaway
Ranch Hand

Joined: Dec 21, 2007
Posts: 45
For now I added a bunch of labels with empty strings to fill the whole thing up. I add a panel to the contentPane, in which I add a panel for the labels, and one for the textfields. Here's my code:
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36452
    
  15
You may need another layout. You could try GridBag, with insets round the JTextFields, or Google for MigLayout.
You may be able to set sizes on the JTextFields; they probably have several methods like setXXXSize.
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 1953
    
    7

I mean something like this:

Besjamain Greenaway
Ranch Hand

Joined: Dec 21, 2007
Posts: 45
@k. tsang

I adjusted and compiled the code you posted, and it works. Is it because you left the default layout for JPanel instead of giving it a GridLayout? Maybe I have to fiddle some more with that and see what works and what not...

@Campbell Ritchie

I will look for what you suggested.

Thanks!
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 1953
    
    7

The reason mine works is I used a tempPanel for the text field instead of adding the field directly to the grid panel.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to avoid getting ridiculously huge textboxes?
 
Similar Threads
logic:iterate without Collection
Dynamically display product of two numbers using java scripts
rounded textbox & buttons
How to create dynamic textboxes based on dropdown selection
disabling rows in an ADF table