B4J Question No enum constant javafx.scene.text.TextAlignment.Left

TorontoJim

Member
Licensed User
Longtime User
I'm using a canvas, and successfully drawing lines. I need to add text though. I tried using DrawText but get this error:

java.lang.IllegalArgumentException: No enum constant javafx.scene.text.TextAlignment.Left

It's telling me there is no Enum constant for "Left" (which doesn't make sense).

Code causing error is last canvasDayDesigner line near the end:

B4X:
Sub paneDayBuilderCanvas_Resize (Width As Double, Height As Double)
    Dim timeFont As Font
    timeFont = fx.CreateFont("Verdana,Tahoma,Arial", 32, True, False)
    canvasDayDesigner.ClearRect(0, 0, Width, Height)
    'Hours hash lines; Left is 85; Right is width - 35
    Dim dblCanvas0000 As Double = 85
    Dim dblCanvasX1Hr As Double
    dblCanvasX1Hr = ((Width - 120.00) / 24.00)
    canvasDayDesigner.DrawLine(dblCanvas0000, 20.00, dblCanvas0000, (Height - 50), fx.Colors.Gray, 2.00)
    For i = 1 To 24
        If i mod 6 = 0 Then
            canvasDayDesigner.DrawLine(dblCanvas0000 + (dblCanvasX1Hr * i), 20.00, dblCanvas0000 + (dblCanvasX1Hr * i), (Height - 50), fx.Colors.Gray, 2.00)
        Else
            canvasDayDesigner.DrawLine(dblCanvas0000 + (dblCanvasX1Hr * i), 20.00, dblCanvas0000 + (dblCanvasX1Hr * i), (Height - 50), fx.Colors.ARGB(100, 140, 140, 140), 1.00)
            canvasDayDesigner.DrawText(i, dblCanvas0000 + (dblCanvasX1Hr * i), Height - 25, timeFont, fx.Colors.Gray, "Left")
        End If
    Next
End Sub


This is the error I'm getting on the Draw Text:

B4X:
java.lang.IllegalArgumentException: No enum constant javafx.scene.text.TextAlignment.Left


Canvas is working great, lines are drawing no problem. It's just this that (so far) is buggering up for me.

I also looked at this page:

http://grepcode.com/file/repo1.mave...ea-b96.1/javafx/scene/text/TextAlignment.java

LEFT, CENTER, RIGHT, JUSTIFY are all valid.

The Enum has to be passed as a string, so the quotes are necessary. It doesn't seem to be case sensitive, but I've tried lower, upper case, and UCFirst.

Really stumped here. This time I don't think it's me (for a change) ... but I've been known to be wrong.
 

TorontoJim

Member
Licensed User
Longtime User
I just went back in to try it again, and it worked. I didn't change anything. I don't get it. Thanks for replying anyways.
 
Upvote 0
Top