B4J Question Setting B4XTable lblSort.TextColor

aeric

Expert
Licensed User
Longtime User
WARNING: package com.sun.javafx.embed.swing.oldimpl not in javafx.swing
Waiting for debugger to connect...
Program started.
Error occurred on line: 24 (B4XMainPage)
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at anywheresoftware.b4a.keywords.Common.CallSubDebug2(Common.java:486)
at b4j.example.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:875)
at b4j.example.b4xpagesmanager._showpage(b4xpagesmanager.java:354)
at b4j.example.b4xpagesmanager._addpage(b4xpagesmanager.java:175)
at b4j.example.b4xpagesmanager._addpageandcreate(b4xpagesmanager.java:189)
at b4j.example.b4xpagesmanager._initialize(b4xpagesmanager.java:125)
at b4j.example.main._appstart(main.java:85)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:629)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:237)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:100)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
at b4j.example.main.start(main.java:38)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:134)
at anywheresoftware.b4a.debug.Debug.CallSubNew2(Debug.java:81)
... 35 more
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:115)
... 36 more
Caused by: java.lang.RuntimeException: Object should first be initialized (B4XView).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:49)
at anywheresoftware.b4a.objects.B4XViewWrapper.getNodeObject(B4XViewWrapper.java:123)
at anywheresoftware.b4a.objects.B4XViewWrapper.setTextColor(B4XViewWrapper.java:353)
at b4j.example.b4xmainpage._b4xpage_created(b4xmainpage.java:58)
... 41 more
java.lang.RuntimeException: java.net.SocketException: Socket closed
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:140)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:100)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
at anywheresoftware.b4j.objects.PaneWrapper$1.run(PaneWrapper.java:120)
at anywheresoftware.b4j.objects.PaneWrapper$ResizeEventManager$1.run(PaneWrapper.java:175)
at anywheresoftware.b4j.objects.PaneWrapper$ResizeEventManager$3.changed(PaneWrapper.java:198)
at anywheresoftware.b4j.objects.PaneWrapper$ResizeEventManager$3.changed(PaneWrapper.java:1)
at javafx.base/com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:181)
at javafx.base/com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)
at javafx.base/javafx.beans.property.ReadOnlyDoublePropertyBase.fireValueChangedEvent(ReadOnlyDoublePropertyBase.java:72)
at javafx.base/javafx.beans.property.ReadOnlyDoubleWrapper.fireValueChangedEvent(ReadOnlyDoubleWrapper.java:103)
at javafx.base/javafx.beans.property.DoublePropertyBase.markInvalid(DoublePropertyBase.java:114)
at javafx.base/javafx.beans.property.DoublePropertyBase.set(DoublePropertyBase.java:148)
at javafx.graphics/javafx.scene.layout.Region.setHeight(Region.java:1045)
at javafx.graphics/javafx.scene.layout.Region.resize(Region.java:1489)
at javafx.graphics/javafx.scene.Node.resizeRelocate(Node.java:3215)
at javafx.graphics/javafx.scene.layout.AnchorPane.layoutChildren(AnchorPane.java:369)
at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1207)
at javafx.graphics/javafx.scene.Scene.doLayoutPass(Scene.java:576)
at javafx.graphics/javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2510)
at javafx.graphics/com.sun.javafx.tk.Toolkit.lambda$runPulse$2(Toolkit.java:412)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
at javafx.graphics/com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:411)
at javafx.graphics/com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:438)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:563)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:543)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:536)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$11(QuantumToolkit.java:342)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.net.SocketException: Socket closed
at java.base/sun.nio.ch.NioSocketImpl.ensureOpenAndConnected(NioSocketImpl.java:165)
at java.base/sun.nio.ch.NioSocketImpl.beginWrite(NioSocketImpl.java:366)
at java.base/sun.nio.ch.NioSocketImpl.implWrite(NioSocketImpl.java:411)
at java.base/sun.nio.ch.NioSocketImpl.write(NioSocketImpl.java:440)
at java.base/sun.nio.ch.NioSocketImpl$2.write(NioSocketImpl.java:826)
at java.base/java.net.Socket$SocketOutputStream.write(Socket.java:1052)
at java.base/java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:81)
at java.base/java.io.BufferedOutputStream.flush(BufferedOutputStream.java:142)
at anywheresoftware.b4a.shell.ShellConnector.sendControlMessage(ShellConnector.java:55)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:189)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
... 31 more
Zipper v1.03
Collecting files
Root: C:\B4X\Development\Example
Found 12 file(s)
Success. Zip size: 9KB
C:\B4X\Development\Example.zip
Completed. Exit code: 0
 

Attachments

  • Example.zip
    8.7 KB · Views: 63
Upvote 0

PaulMeuris

Well-Known Member
Licensed User
Move the setting to the B4XPage_Appear and it will work. At that time the table is set up properly.
I have added some test data.
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
    B4XTable1.Clear
    B4XTable1.AddColumn("first", B4XTable1.COLUMN_TYPE_TEXT)
    Dim data As List
    data.Initialize
    Dim rec As List
    rec.Initialize
    rec.Add("test")
    data.Add(rec)
    B4XTable1.SetData(data)
End Sub
Private Sub B4XPage_Appear
    B4XTable1.lblSort.TextColor = xui.Color_Red
End Sub
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Yes, I understand that the B4XTable may not ready. It is similar to hiding the pnlHeader.

 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Moved to the questions forum.

B4XTable is internally loading a layout in its DesignerCreateView sub. This requires adding Sleep(0) inside B4XTable and this means that you also need to add Sleep(0) before you can access its views. This is a common issue / limitation of custom views that internally load layouts.
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Moved to the questions forum.

B4XTable is internally loading a layout in its DesignerCreateView sub. This requires adding Sleep(0) inside B4XTable and this means that you also need to add Sleep(0) before you can access its views. This is a common issue / limitation of custom views that internally load layouts.
I get it.
 
Upvote 0
Top