• Post Reply Bookmark Topic Watch Topic
  • New Topic

Static UI components  RSS feed

 
Kejal Shah
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all.
In my application, i've several frames of the same type.
Each frame has several common components, such as buttons, menubar etc.
If i declare these components as static, will the memory utilization b less? Also, will the entire application work?
Tx in advance
Kejal
 
Abhik Sarkar
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kejal,
I guess the answer would largely depend on whether your components are the "same" or of the "same type".
Let's say you currently have two "OK buttons". If both of these perform exactly the same actions on exactly the same objects, then maybe you could try.
But, generally I don't think it is a good idea, because when you interact with a static Component in one Frame, it might effect the same component on the other frame as well...
Stuff that you could keep static would be Icons, Common Actions, and other resources which might be used without change in more than one place.
Hope this helps,
Abhik.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't make static references to the components... they can't be static because they are added to different containers ( the different frames ), and you will end up with a lot of problems...

What you may want to do is have a static model that you send to all the components. This would make all the components look "linked". Moving a slider in one frame would make a slider with the same model in another frame update with the same value. Filling in a textfield in one frame would be mirrored in another... etc. etc.
 
Kejal Shah
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for all ur replies.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!