Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ve-dev] Painting Custom widgets in Swing for VE .


Why are you changing it in the paint itself? Why not change it directly on the component when the property itself is changed. Then it would only be done once.

Rich


"H Ramachandra, Rashmi" <rashmi.h.ramachandra@xxxxxxx>
Sent by: ve-dev-bounces@xxxxxxxxxxx

11/07/2005 12:32 AM

Please respond to
Discussions people developing code for the Visual Editor project

To
<ve-dev@xxxxxxxxxxx>
cc
Subject
[ve-dev] Painting Custom widgets in Swing for VE .





Hi all ,

We are using eclipse 3.1 and VE 1.1 for our project. We are trying to build custom widgets in Swing, that paint themselves when any property such as Color (Back Ground or Foreground) is changed. We have two questions here,

1.) How do we debug and follow the flow of execution? (Sysout's are not working here inside custom widgets).

2.) How do we customize the paint method to pick up and apply property from the user defined field?

For E.g.:-

We have a field called 'backGroundColor' , which has a setter and getter methods. On every change of this property by the user from the property palette. We want to change the color of the component .

this.setBackGround(this.getBackGroundColor());

We have used the above code  inside the paint method. Since paint method is called ample number of times the eclipse runtime hangs and becomes very slow. It even does not reflect the property changes. Is there any way we can handle these custom properties inside the paint method.

Our paint method looks like this

 public void paint(Graphics g)
       
   {
       
       super.paint(g);
       
       if(flag)
               
 {
       
               this.setBackground(this.getBackgroundColor());
                       
this.setOpaque(true);
               
       
               
 }
               flag = false;

       
   }
       
   

We used flag to restrict repainting of the component continuously. But we are unable to find how to reset the flag and call the paint, whenever there is a property change.

For the above component and the swing container  I am using null layout.

Any help in this regard is greatly appreciated.

Thank you and Best Regards.

Rashmi H.Ramachandra _______________________________________________
ve-dev mailing list
ve-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ve-dev


Back to the top