开发者

reusing components in inherited Frame while maintaining GUI builder usage

开发者 https://www.devze.com 2023-02-05 08:37 出处:网络
what is the best way to have JFrames, JDialogs, etc t开发者_开发问答hat derive from a common parent but differ some, to be able to have the common parts update automatically when the parent does, but

what is the best way to have JFrames, JDialogs, etc t开发者_开发问答hat derive from a common parent but differ some, to be able to have the common parts update automatically when the parent does, but also have new components which are still easily modified in a GUI builder.

One approach I have used before is having placeholder JPanels that populate with existing isolated components at runtime, but I suspect that this is not the best way.

Example frame visual inheritence:

reusing components in inherited Frame while maintaining GUI builder usage


  1. Don't use a GUIBuilder unless you creating some sort of prototype or other throw away code.
  2. Have the components that need to update automatically setup as listeners for some sort of change event. Once an update is needed fire of an "Event" to each listener.
0

精彩评论

暂无评论...
验证码 换一张
取 消