Re: custom Swing component



On 28 Sep 2005 00:40:44 -0700, "Chanchal" <chanchal.jacob@xxxxxxxxx>
wrote or quoted :

>Thank you for your helpful reply. but is there any way to actually set
>the size of the text field when the panel containing it is resized??

Yes, many different ways. The proper way is to use a layout that
calculates a size. If none of the layouts will compute the right size
you write one that does. See http://mindprod.com/jgloss/layout.html

It is possible, though strongly frowned on, to setLayout( null );
to turn off the layout manager. Then you are are on your own to size
and place all the components with setSize, setLocation or setBounds.

One time I consider using a null layout acceptable is for extremely
simple layouts that very definitely have a fixed size where you need a
small footprint and high speed, such as my CurrCon applet. See
http://mindprod.com/applets/currcon.html

The other time is when you have an extremely complex layout where
everything is packed in like a Swiss watch and you want to rigidly
control the layout to the last pixel. Even then, you are better to use
a LayoutManager that gives fine absolute positioning control rather
than a null layout manager.



--
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
.



Relevant Pages

  • Re: easy dialog resizing
    ... The layout controls in Whidbey are a bit better, ... > "Justin Rogers" wrote in message ... >> the layout manager to ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: suitable layout manager?
    ... what layout manager is the ...
    (comp.lang.java.gui)
  • Re: how to set (preferred) JSlider length?
    ... To set size of your component and still work with a layout manager: ... public void init() { ... Unlimited Access, Anonymous Accounts, Uncensored Broadband Access ...
    (comp.lang.java.programmer)
  • Re: GetKeyState() problem
    ... especially for the toggle keys. ... > No, no layout manager stuff. ... >> input system's understanding of these modifier flags. ...
    (microsoft.public.windowsce.platbuilder)