I am trying to port a legacy application from Qt to Java. This is my first time with Java so please bear with me. I have also tried googling with every combination of words I can think of without success.
In the application the user selects a "work page" from a list (on the left of the screen) in a similar fashion to selecting a file in the Package Explorer in Eclipse. At startup only a "Welcome" type page is shown.
As each page is "opened" from the page list a new tab (TabItem) opens showing that page in the main part of the screen (again like Eclipse). The pages are quite different however, some containing text, some a few controls, some with tables others with further TabFolders in them.
I would like to:
Construct each "page" design using WindowBuilder
Have each page in a separate file (class)
Separate the code for the page business logic from the code for the UI
Add / delete / switch to the pages to the TabFolder at run time.
Any hints and tips on how to do this would be great.
Joined: Jun 09, 2003
TabFolder / TabItem - are these part of SWT?
If so, there's not a lot of SWT traffic here and many SWT questions remain unanswered.
Don't know the best place for SWT.
If it's Swing, it sounds like a JTabbedPane, and your 'component' questions would have simple answers.
Joined: Jan 16, 2012
Michael, thank you for taking the time to respond to my post and I am sorry I have been slow to reply.
Yes, these controls are part of SWT and are provided byorg.eclipse.swt.widgets.TabFolder and org.eclipse.swt.widgets.TabItem respectively.
TabFolder is basically a container for TabItems, which in turn can contain any number of other layouts and controls.
I haven't looked at Swing much, but from what I have just read it seems a similar concept except in Swing you add JComponents to the JTabbedPane whereas in SWT you add TabItems to the TabFolder.
I am interested in how you can solve this in Swing because it might be possible to use a similar method in SWT.
The approaches I have considered (but not tested) so far are:
Creating the tab page as a Dialog (or maybe Shell or Composite), adding layouts components etc. then adding it to the TabFolder by casting the Dialog to a TabItem (this is how Qt works)
Creating a Dialog (or Shell or Composite), adding a TabFolder and TabItem and then somehow referencing that TabItem in the main code
Out of interest, why isn't their much SWT traffic on this list?
Joined: Jun 09, 2003
A JTabbedPane sounds a lot like your TabFolder.
it looks like MS's Excel (tabs are at top), but each tab is (generally) a JPanel 'page',
with each 'page' containing one or more components.