Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

dots instead of the whole text (JLabel)!

1,463 views
Skip to first unread message

Programmer

unread,
Nov 5, 1998, 3:00:00 AM11/5/98
to
Have you ever seen that? I’m trying to change the text like follow :

myLabel.setText("Second Test")

if the label text was on initialize set to "first" then
the UI will display only "Se...".

Does somebody know the solution ???

Sincerely


Programmer

unread,
Nov 5, 1998, 3:00:00 AM11/5/98
to

Programmer

unread,
Nov 5, 1998, 3:00:00 AM11/5/98
to

Ethan Henry

unread,
Nov 5, 1998, 3:00:00 AM11/5/98
to Programmer

Re-validate the container containing the label. It will force a
re-layout, which will resize the label.

Ethan
--
Ethan Henry e...@klg.com
Java Evangelist, KL Group http://www.klg.com
"Software Development Productivity"

Paul Medynski

unread,
Nov 5, 1998, 3:00:00 AM11/5/98
to
Programmer <bmue...@hsr.ch> wrote in article
<71shmg$kr8$2...@ubnnews.unisource.ch>...

> Have you ever seen that? I’m trying to change the text like follow :
>
> myLabel.setText("Second Test")
>
> if the label text was on initialize set to "first" then
> the UI will display only "Se...".
>
> Does somebody know the solution ???

It sounds like the label is too small. You have to resize the label so
all the text fits on it :) This isn't done dynamically; you've got to set
it at compile time.

--
---------------------------------------------------
Paul Medynski coo...@nortel.ca
Nortel - Skypark Location Ottawa, ON, Canada
Phone: (613) 763-5130
Java GUI Developer -- Integrated Network Management


Johan Compagner

unread,
Nov 5, 1998, 3:00:00 AM11/5/98
to
The the label is in is to small to display to complete
text.
You must set the size to the size of the complete text

Do you use a layout?


Programmer wrote in message <71shiu$kog$2...@ubnnews.unisource.ch>...


>Have you ever seen that? I’m trying to change the text like follow :
>
>myLabel.setText("Second Test")
>
>if the label text was on initialize set to "first" then
>the UI will display only "Se...".
>
>Does somebody know the solution ???
>

>Sincerely
>
>
>

motoneig

unread,
Nov 14, 1998, 3:00:00 AM11/14/98
to
I had the same problem. The easiest fix that I found is to override paint
and do:

setSize(getPreferredSize());
super.paint(g);

The reason is that the peer class doesn't update the size of the component
before updating the size of the text. From my experiences, a simple call to
validate(), invalidate(), or repaint() doesn't work.

Rick Carragher

0 new messages