After loading my data on tableview ( 20 to 30 columns all needed ) it resize the columns width into equal based on numbers of column.
But when i double click the column header separator after loading the data it auto size the width of that column based on its content. Is there something like that to do it tru codes.
You can use this code to call the private method that auto-resizes a column:
B4X:
Sub ResizeToFit(tv As TableView, ColumnIndex As Int)
Dim tvjo As JavaObject = tv
Dim r As Reflector
r.Target = tvjo.RunMethod("getSkin", Null)
r.RunMethod4("resizeColumnToFitContent", Array(tvjo.RunMethodJO("getColumns", Null).RunMethod("get", Array(ColumnIndex)), -1), _
Array As String("javafx.scene.control.TableColumn", "java.lang.int"))
End Sub
java.lang.NullPointerException
at com.sun.javafx.scene.control.skin.TableViewSkin.resizeColumnToFitContent(TableViewSkin.java:257)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at anywheresoftware.b4j.agraham.reflection.Reflection.runmethod(Reflection.java:168)
at anywheresoftware.b4j.agraham.reflection.Reflection.RunMethod4(Reflection.java:932)
at felco.prj.dar.review._resizetofit(review.java:254)
at felco.prj.dar.review._btnload_action(review.java:102)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
at anywheresoftware.b4a.BA$2.run(BA.java:165)
at com.sun.javafx.application.PlatformImpl.lambda$null$174(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$175(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$149(WinApplication.java:191)
at java.lang.Thread.run(Thread.java:745)