text clipping in Label - how to prevent? [message #173152] |
Tue, 22 March 2005 19:14  |
Eclipse User |
|
|
|
This I think is a pretty basic question, but for some reason I cannot get
this to work properly.
I'm creating a custom Figure-based class that draws "flags". The flag uses
an GIF image (Label) for the flag pole and another Label with the flag text.
I use a horizontal ToolbarLayout. I have the figure working properly but I
cannot disable text clipping on the label. What am I doing wrong?
Code:
public FlagFigure() {
super();
IFigure flagPole = new Label(Images.getImage("flagpole.gif"));
IFigure bookmarkLabel = new Label("ThisIsALongerLabel");
setLayoutManager(new ToolbarLayout(true));
bookmarkLabel.setBorder(new MarginBorder(15, 2, 0, 0));
add(flagPole);
add(bookmarkLabel);
}
Thanks for any help,
Erik
|
|
|
|
Re: text clipping in Label - how to prevent? [message #173297 is a reply to message #173185] |
Wed, 23 March 2005 14:07  |
Eclipse User |
|
|
|
Doh... It was my problem. My base edit part class was doing things that
weren't correct for the new edit part/figure resulting in setting the layout
constraints/size incorrectly.
As far as using a Label with text + image, the reason I wasn't doing that in
the first place was because I needed to override paintFigure to draw a few
extra lines & colors to give the figure the apperance of a flag. I was able
to achieve the same result though by subclassing Label and overriding
paintFigure, so I will probably just take that approach rather than
needlessly creating composite figures.
Thanks,
Erik
"Pratik Shah" <ppshah@us.ibm.com> wrote in message
news:d1qufd$qun$1@news.eclipse.org...
> I take it that by clipped you mean the text is truncated (i.e., an
ellipsis
> is shown at its end since not all of it fits in available space)? That
> happens when the label is not sized to be as big as it wants to be. I am
> not sure why that is happening in your case though.
>
> It seems you're going in a round-about way for what you want to achieve.
> Maybe a simpler approach will make things easier for you. Why don't you
try
> something like this?
>
> Label flagFigure = new Label("ThisIsALongerLabel",
> Images.getImage("flagpole.gif"));
>
>
> "Erik Johnson" <ejohnson@avaya.com> wrote in message
> news:d1qh57$cue$1@news.eclipse.org...
> > This I think is a pretty basic question, but for some reason I cannot
get
> > this to work properly.
> >
> > I'm creating a custom Figure-based class that draws "flags". The flag
> uses
> > an GIF image (Label) for the flag pole and another Label with the flag
> text.
> > I use a horizontal ToolbarLayout. I have the figure working properly
but
> I
> > cannot disable text clipping on the label. What am I doing wrong?
> >
> > Code:
> > public FlagFigure() {
> > super();
> > IFigure flagPole = new Label(Images.getImage("flagpole.gif"));
> > IFigure bookmarkLabel = new Label("ThisIsALongerLabel");
> > setLayoutManager(new ToolbarLayout(true));
> > bookmarkLabel.setBorder(new MarginBorder(15, 2, 0, 0));
> > add(flagPole);
> > add(bookmarkLabel);
> > }
> >
> > Thanks for any help,
> > Erik
> >
> >
> >
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03409 seconds