Problems while using button border of draw2d [message #155461] |
Mon, 25 October 2004 09:29  |
Eclipse User |
|
|
|
Originally posted by: Greenbank.water.pku.edu.cn
Hi!Randy and other ensusiasts:
Can anyone please guide me to use the ButtonBorder? I try to use it just
as following:
label1.setBorder(new ButtonBorder());
but I am getting an Exception.
I searched in the newsgroup and found that some people had asked the
same question as me.Randy answered that it requires a Button figure.But
how can I get the figure? Can anyone please point me to an example on
the same?
Thanks a lot!
|
|
|
|
|
|
|
|
Re: Problems while using button border of draw2d [message #155611 is a reply to message #155589] |
Tue, 26 October 2004 05:52   |
Eclipse User |
|
|
|
Originally posted by: Greenbank.water.pku.edu.cn
Thanks for Andreas' answer!Now I understand where I was wrong.
But what I am trying to do is to write an editor just like the SWT
Designer.I want to use the draw2d control figures as my view(like the
buttons,textfields...).And I just need an static editable image of the
button(the display text can be changed by the user)rather than a real
clickable one.But the draw2d button do not provide any methods to change
these properties of the figures after constructed.So I asked this
question here a few days ago,Randy suggested me to use a label figure
with a button border.If I cannot achieve my goal by this method,could
anyone point me another way?
Each time when I asked a question here I received many enthusiasm
replys,and they helped me a lot.I really appreciated these friends and
people,if any of you come to china please contact me!
Best Wishes!
Greenbank Tang
Peking University
Beijing,China
Tel:86-010-62759092
FreeGroup wrote:
> Hi
>
> In the ButtonBorder.java on line 226(or 227)
> you can see that the ButtonBorder expected an
> class from type [Clickable]. The class [Label]
> doesn't extends this class.
>
> In this case you can't use the ButtonBorder for
> a Label. Use instead [SimpleRaisedBorder].
>
> greetings
>
> Andreas
>
>
>
> 226 public void paint(IFigure figure, Graphics graphics, Insets insets) {
> 227 Clickable clickable =
> (Clickable)figure; <<<<<< crash
> 228 ButtonModel model = clickable.getModel();
> 229 ButtonScheme colorScheme = (ButtonScheme)getScheme();
> 230
> 231 if (clickable.isRolloverEnabled() && !model.isMouseOver()
> 232 && !model.isSelected())
> 233 return;
> 234
> 235 Color tl[], br[];
> 236 if (model.isSelected() || model.isArmed()) {
> 237 tl = colorScheme.getShadowPressed();
> 238 br = colorScheme.getHighlightPressed();
> 239 } else {
> 240 tl = colorScheme.getHighlight();
> 241 br = colorScheme.getShadow();
> 242 }
> 243
> 244 paint(graphics, figure, insets, tl, br);
> 245 }
>
>> Greenbank Tang
>> Peking University
>> Beijing,China
>> Tel:86-010-62759092
>>
|
|
|
|
Powered by
FUDForum. Page generated in 0.08485 seconds