开发者

How to make iGoogle like UI using java swing

开发者 https://www.devze.com 2023-03-23 19:20 出处:网络
I am developing desktop GUI application using java swing. And I want to show several \"subwindow\" on the same window(JFrame). And I want the layout is similar to iGoogle such that user can add and re

I am developing desktop GUI application using java swing. And I want to show several "subwindow" on the same window(JFrame). And I want the layout is similar to iGoogle such that user can add and remove new subwindow. To be simple, I assume all the "subwindows" have the same size and similar content(all are showing chart). By the way, the maximum number of "subwindow" would not be a huge number. I think it is less than 8.

  1. if there is no drag and drop, can I just use grid layout to implement it?
  2. if there is drag and drop, what is开发者_StackOverflow社区 the easy way to do it?

Thank You very much.

FYI: iGoogle http://www.google.com.hk/ig


I don't know what iGoogle is, but it sounds like you should be using internal frames. See the section from the Swing tutorial on How to Use Internal Frames.


If all the "sub windows" will be equal size and not draggable, I'd just use a simple layout. seems like a good case to use TableLayout. In a simple case where you know the max amount of slots, you could have 8 corresponding JPanels and add them to Container using the table layout (making sure to revalidate()) as the user requests them. if a user closes one, you just remove it from the container and revalidate. Hope that helps. if you don't need docking functionality, don't even go down that road is my advice.

EDIT:

you could also still implement drag and drop by using your own mouse handlers.

0

精彩评论

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

关注公众号