Forums Register Login

TabFolder / TabItem Code Organsiation

+Pie Number of slices to send: Send
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.

    Mark
    +Pie Number of slices to send: Send
    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.
    +Pie Number of slices to send: Send
    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?

    Mark





    +Pie Number of slices to send: Send
    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.

    here's a link to the 'How to use TabbedPanes' tutorial
    http://docs.oracle.com/javase/tutorial/uiswing/components/tabbedpane.html
    there are a number of demo programs there that you can run and see its functionality.

    > Out of interest, why isn't their much SWT traffic on this list?

    it seems none of the regular readers/helpers/contributors here uses SWT.
    Possibly because it's tied in with Eclipse (I think) - I don't use Eclipse, and
    that might be the same for the other regulars.
    +Pie Number of slices to send: Send
    Thanks for the explanations!
    Put a gun against his head, pulled my trigger, now he's dead, that tiny ad sure bled
    a bit of art, as a gift, that will fit in a stocking
    https://gardener-gift.com


    reply
    reply
    This thread has been viewed 2288 times.
    Similar Threads
    SWT TabFolder related
    SWT: Menu in CTabItem/CTabFolder or TabItem/TabFolder
    help file management and translation for web app
    Design choice for dispatching request to view
    tabFolder, table and SWT.EraseItem problem
    More...

    All times above are in ranch (not your local) time.
    The current ranch time is
    Mar 28, 2024 17:08:03.