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 .


Hi,

I'm sorry, but I still understand why this has to be in the paint. At the time of the paint it is far too late to add controls to a panel. Swing will get very confused if you try to add components then.  

You should create however many controls you need at the time of the setting of the feature. You should add/remove/replace components in the ComponentHeight or the No_of_Display_Items set methods themselves within the composite object.

Thanks,
Rich


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

11/09/2005 04:10 AM

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

To
"Discussions people developing code for the Visual Editor project" <ve-dev@xxxxxxxxxxx>
cc
Subject
RE: [ve-dev] Painting Custom widgets in Swing for VE .





Hi Rich,
    Thanks for the input. But our requirement is not just to apply a property to the whole component . Let us explain more about our composite object. The composite component has  two of the properties as follows.
 
ComponentHeight
No_of_Display_Items.
 
The component Height is the height of the swing widgets inside the panel . Not the height of the panel itself.
No_of_Display_Items Specifies the number of item instances displayed for the item ,if No_of_Display_Items is set to 3 to , we create a TextField, by default we want to 3 TextFields visible inside the composite component like three rows of textField. To get only one textField, set No_of_Display_Items to 1.
 
The height of the panel depends on two aspects that is No_of_Display_Items
and Component height. Depending on the No_of_Display_Items, we duplicate the
swing widget that many number of times inside the panel. Hence we have "No_of_Display_Items" number of rows of the swing widget inside the panel.
 
You can see the example in the image attachments with this mail.
Pic1.jpg shows a  single swing widget inside the panel.(No_of_Display_Items=1)
Pic2.jpg shows multiple swing widget inside the panel. (No_of_Display_Items=3)
 
Can you please help how do I go about implementing such a kind of task.
 
Thanks in Advance,
Best Regards
Rashmi H.Ramachandra
 



From: ve-dev-bounces@xxxxxxxxxxx [mailto:ve-dev-bounces@xxxxxxxxxxx] On Behalf Of Rich Kulp
Sent:
Tuesday, 08 November 2005 8:23 PM
To:
Discussions people developing code for the Visual Editor project
Subject:
RE: [ve-dev] Painting Custom widgets in Swing for VE .



I think this is the wrong approach. It should be done on the set of the property itself, not during the paint. In the complex composite widget, when the property is set it should propagate it down to the children. The paint handler is for doing painting not setting properties. It is often too late, the children may of already painted.


Rich


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

11/08/2005 03:44 AM

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


To
"Discussions people developing code for the Visual Editor project" <ve-dev@xxxxxxxxxxx>
cc
Subject
RE: [ve-dev] Painting Custom widgets in Swing for VE .







Hi Rich,

 
  We are building complex composite widgets. For Example : a single component consisting of a Text Field and a checkbox put inside a panel. The composite component here is the panel. When we change properties for the composite component, we want it to reflect to the child component, which are placed inside the composite component. Hence we require a paint method to add components and to change properties related to the whole of the composite component.

So can you please help us resolving this issue of paint method?

 
Thanks in Advance

Best Regards,

Rashmi H.Ramachandra.


 


From: ve-dev-bounces@xxxxxxxxxxx [mailto:ve-dev-bounces@xxxxxxxxxxx] On Behalf Of Rich Kulp
Sent:
Monday, 07 November 2005 7:57 PM
To:
Discussions people developing code for the Visual Editor project
Subject:
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_______________________________________________
ve-dev mailing list
ve-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ve-dev_______________________________________________
ve-dev mailing list
ve-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ve-dev

Attachment: pic1.JPG
Description: JPEG image

Attachment: pic2.JPG
Description: JPEG image


Back to the top