Is getSelectedTabFormName gone somehow?

Hello,

I just received this error

java.lang.ClassCastException: javax.swing.plaf.basic.BasicTabbedPaneUI$ScrollableTabButton cannot be cast to com.servoy.j2db.dataui.FormLookupPanel

When I checked where it came from, I found this code

forms[vForm].elements*.getSelectedTabFormName()*
*```*
*I looked at the element properties of the tab panel and saw that I do not see* 
*```*
*getSelectedTabFormName*
*```*
*Has that disappeared somehow?*
*Am I missing something obvious?*

BTW: Servoy Developer 3.1.6

i see that the selectedformname is depricated you have to use the tabindex to get what you want:

getTabFormNameAt(getTabIndex())

But that is in the code exactly the same thing, so that classcast exception is a very strange one that i can’t understand completely how that is happening.

don’t you see in the log file a full stack trace?

Yes, I have more details. It seems to happen if the tab panel is “scrollable” (has too many tabs to fit on the tab panel):

org.mozilla.javascript.JavaScriptException: java.lang.ClassCastException: javax.swing.plaf.basic.BasicTabbedPaneUI$ScrollableTabButton cannot be cast to com.servoy.j2db.dataui
.FormLookupPanel
at org.mozilla.javascript.JavaScriptException.wrapException(JavaScriptException.java:71)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:368)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1254)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2031)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:94)
at com.servoy.j2db.scripting.e.call(Unknown Source)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1254)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2031)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:94)
at com.servoy.j2db.scripting.e.call(Unknown Source)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1254)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2031)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:94)
at com.servoy.j2db.scripting.e.call(Unknown Source)
at com.servoy.j2db.develop.debugger.k.a(Unknown Source)
at com.servoy.j2db.develop.debugger.k.access$100(Unknown Source)
at com.servoy.j2db.develop.debugger.k$2.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
java.lang.ClassCastException: javax.swing.plaf.basic.BasicTabbedPaneUI$ScrollableTabButton cannot be cast to com.servoy.j2db.dataui.FormLookupPanel
at com.servoy.j2db.util.a2.getFormNameAt(Unknown Source)
at com.servoy.j2db.dataui.SpecialTabPanel.js_getTabFormNameAt(Unknown Source)
at com.servoy.j2db.dataui.SpecialTabPanel.js_getSelectedTabFormName(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:334)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1254)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2031)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:94)
at com.servoy.j2db.scripting.e.call(Unknown Source)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1254)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2031)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:94)
at com.servoy.j2db.scripting.e.call(Unknown Source)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1254)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2031)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:94)
at com.servoy.j2db.scripting.e.call(Unknown Source)
at com.servoy.j2db.develop.debugger.k.a(Unknown Source)
at com.servoy.j2db.develop.debugger.k.access$100(Unknown Source)
at com.servoy.j2db.develop.debugger.k$2.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

With the change you suggested (it has to be tabIndex - a property) I get the same error. So basically this seems to be a bug that occurs on “scrollable” tab panels.

yes you have multiply tabs that can’t be displayed at once so you have those left and right scrollbuttons
it seems if you have this that something goes wrong will check it out

i fixed this for the next 3.5 release

Just to note: this happened to me in 3.1…

backported it also to 3.1