Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / May 2008

Tip: Looking for answers? Try searching our database.

Hiding a JTexfield from the GUI

Thread view: 
jgricourt@free.fr - 29 May 2008 09:25 GMT
Hi,

I'd like to hide a JTextField from the GUI so that the layout doesn't
"see it" anymore ? I tried, setVisible(false) but it leaves an empty
space on the layout as if the component was still there.

Is there an easy way to achieve this ?

JGG
RedGrittyBrick - 29 May 2008 09:32 GMT
> Hi,
>
[quoted text clipped - 3 lines]
>
> Is there an easy way to achieve this ?

Use a different layout manager. Some layout managers will collapse
invisible components.

Have you tried resetting the components minimum,maximum,preferred sizes?

Have you called the container's pack()?

Which layout manager are you using?

Have you read http://sscce.org/ ?

Signature

RGB

Knute Johnson - 29 May 2008 17:45 GMT
> Hi,
>
[quoted text clipped - 5 lines]
>
> JGG

Just remove it.

Signature

Knute Johnson
email s/knute/nospam/

jgricourt@free.fr - 30 May 2008 14:58 GMT
I was using the layout called "TableLayout", which is a smart
replacement for swing gridbaglayout by the way. I found out that
calling  layout.setRow(rowNum, 0) can make the components on the row
really invisible (it collapses the entire row). Problem solved !
Roedy Green - 31 May 2008 08:51 GMT
>I'd like to hide a JTextField from the GUI so that the layout doesn't
>"see it" anymore ? I tried, setVisible(false) but it leaves an empty
>space on the layout as if the component was still there.

see http://mindprod.com/jgloss/setvisible.html
Signature


Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

jgricourt@free.fr - 31 May 2008 09:53 GMT
Yes, this describes exactly what happen with my layout manager.
TablLayout goes for the first solution by default but let the
programmer choose to go for the second one.

-- quote

How are invisible elements treated?

  1. Do they act as if they weren’t there at all? Do the other
elements move in to take over the vacated space? Is the visual effect
the same as removing them from the enclosing Container?
  2. Is there just a blank hole marking their place?

It depends on the LayoutManager you choose. LayoutManagers are free to
choose either strategy.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.