Problems while using button border of draw2d [message #155461] |
Mon, 25 October 2004 13: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 #155470 is a reply to message #155461] |
Mon, 25 October 2004 14:23 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
Did you see the class cast exception? That is the class you need to use
with the border.
"Greenbank" <Greenbank@water.pku.edu.cn> wrote in message
news:cliuf3$10u$1@eclipse.org...
> 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 #155517 is a reply to message #155470] |
Tue, 26 October 2004 02:05 |
Eclipse User |
|
|
|
Originally posted by: Greenbank.water.pku.edu.cn
Yes, there is an error log about the class cast exception,but it didn't
tell me which class I need to use,the log is as following:
*** Stack trace of contained exception ***
Reason:
java.lang.ClassCastException
Unhandled exception caught in event loop.
Reason:
Failed to execute runnable (java.lang.ClassCastException)
Randy,could you give me a simple example about how to use the
ButtonBorder? Thank you very much!
Best regards!
Greenbank Tang
Peking University
Beijing,China
Tel:86-010-62759092
Randy Hudson wrote:
> Did you see the class cast exception? That is the class you need to use
> with the border.
>
> "Greenbank" <Greenbank@water.pku.edu.cn> wrote in message
> news:cliuf3$10u$1@eclipse.org...
>
>>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 #155548 is a reply to message #155524] |
Tue, 26 October 2004 05:56 |
Eclipse User |
|
|
|
Originally posted by: Greenbank.water.pku.edu.cn
Thanks for reminding me!
I read the .log file and find the exception start at
java.lang.ClassCastException
at org.eclipse.draw2d.ButtonBorder.paint(ButtonBorder.java:226)
but I just use the following codes:
label.setBorder(new ButtonBorder());
to set a border and the system called this function automaticly.
Is this problem a mistake of mine or something wrong with my system?
Anyone who gives any idea will be grateful. :)
Greenbank Tang
Peking University
Beijing,China
Tel:86-010-62759092
FreeGroup wrote:
> Have you look in the [runtime-workbench-workspace/.metadata/.log]
> file?
>
> I think you will find the hole stack trace. In that case you can take
> a close look to your code.
> I find my hole mistakes in this log file.
>
>
> greetings
>
> Andreas
|
|
|
|
Re: Problems while using button border of draw2d [message #155611 is a reply to message #155589] |
Tue, 26 October 2004 09: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.03943 seconds