Jsplitpane appears with buttons?

I am playing with the Jsplitpane for the first time!! Despite following all the instructions I always get a pane with 2 large buttons (left and right). I can place forms on the pane and the left button disappears but the right one remains (hiding the form on the right) - unless I set the initial divider location in the properties to a number that pushes it right to the edge of the split pane. Then I see both the forms I placed and the pane seems to behave as expected.

I am puzzled though by the buttons - should they be there and how do I remove them? I have seen no mention of this in any of the examples or discussions :?


Mac OS X 10.4.8
Java 1.5.0_06-68

Could you show us the code that you are using when you initialize the bean? I have seen that before (the bean is somehow “prefilled”), but if you do the right thing everything should work just fine.

This is the method that runs as an onShow for the form:

elements.splitPane1.orientation = 0;
elements.splitPane1.topComponent = elements.tabs_70;
elements.splitPane1.bottomComponent = elements.selections;
elements.splitPane1.dividerLocation = 500;

… all very basic. But in order for the ‘buttons’ to not get in the way I have to also set the divider location in the properties panel as well. If I don’t do that, then simply running the above method leaves me with a big button hiding half of the splitpane!

Are there other settings I should include in the method?

Hi David,

You should attach that method on the onLoad event.

Is this

elements.selections

a tab panel? If yes, it should work just fine. But yes, do that onLoad of the form.

yes, i have seen this also often.
A restart of developer mostly helps!

(btw: in my case, in design-mode both tabpanels have to touch the splitpanel bean)

Hi Robert,

Seems to make no difference whether its onLoad or onShow.

I have however compared my newly added jSplitPanes with the split panes used in the Servoy demo files - the issue seems to be that newly added jSplitPanes have all the components (top, bottom, left and right) preset to a jButton and using the properties panel these cannot be deleted! - if I select the text and delete it or even try to replace it, it simply resets itself when I tab away! Looking at the properties of the splitpanes in the Servoy demo files, all the components are empty (but the ones required are set of course by method when the form loads).

If I am using top and bottom components, I have tried setting the left and right ones to null but that does not work either - the buttons remain.

If anyone knows why these split panes behave differently, please let me know!

In the meantime I can probably copy the splitpanes from the demo solution and paste those into my solution which should provide a work around for now. :?

Seen this as well, it helped me to use the left/rightCompnent instead of the top/bottomComponent functions to add your tabs to the splitpane.

Paul

Hi Paul,

I still have the same issue whichever set of components I try to set! However, using one of the splitpanes from the servoy demo solutions files works fine - they can be copied onto my forms without the components being preset to jbuttons :D

So my solution for now is to use a copied splitpane rather than inserting a new one from the beans menu :!:

Hi Paul

I ahve this bad behaviour as well. My JSPlitPanes loose (visually) after a short time (I never found out because of what event, if it is only one at all) the right button and only the left is visible - very annoying. The right button of the bean is actually invisible on the far right or far bottom, depending on vertical or horizontal split).
The functionality is still there but the beans are difficult to handle. Setting the bean properties doesn’t help. i. e. the properties seem NOT accepting (executing) entries, programmed code on a method does, though.

Would be nice if this behaviour could be improved (corrected :-)

Best regards, Robert

pbakker:
Seen this as well, it helped me to use the left/rightCompnent instead of the top/bottomComponent functions to add your tabs to the splitpane.

Paul

Hello All,

I am new to Servoy and have just started playing with JSplitPanes. I am also experiencing the same problem described in this thread. Sounds like the work around is to copy the JSplitPane from one of the demos, but how do you copy an element from one solution to another?

Thanks

Hi Bob,

I have to say I never had a problem with JSplitPanes.

There are however a few things you need to know about them.

  • they have a default appearance with buttons.
  • you can only set 1 object in the left/right or top/bottom component so if you need to have more objects use a tabpanel and a (un)related form
  • these objects have to be on the same form as the JSplitPane
  • these objects should be moved UNDER the split-pane object to make sure you don’t have redraw issues.
  • you have to set the left/right or top/bottom component with a method
  • set the splitter orientation in design time (why do it in code anyway if it’s fixed?)
  • you can also set the dividerLocation in design time when needed or in a method.
  • if you use a method to set properties of the split-pane trigger it with the onload form event
  • they don’t work in WebClient
  • if you want to use anchors you need to right-click on them to do so (CTRL-click for 1 button-mouse Mac users) as with any other bean

By the way it can be a bad idea to copy/paste objects. Some objects don’t act too well on it (tabs in tabpanels for instance).

Hope this get you started.

I never had these problems either - until yesterday. Same story, the split showed an ugly button. I found no way to get rid of it. Then I deleted the bean and place a new bean on the form. It worked instantly?!

yes, there is something buggy in the jSplitpanel bean, I have seen it several times also. Sometimes just a restart of Servoy developer does the trick also!

Hope the Servoy guys could look into that.

I got JSplitPane to work :lol:
I had the two forms that I wanted displayed as separate tabs in 1 TabPanel. This did not work. If I put them in their own TabPanel, it worked. I also had to restart Developer to lose the button.

Thanks Robet, Patrick and Harjo.