Hi there
I'm trying to have an AddImage method in the TextFlow class.
Well, this is not working. What I want to do is to change the text color of a treeview item and then assign an existing image to it as the current color change does not pick up the treeitem image.
Can anyone advise please??? Thanks
I'm trying to have an AddImage method in the TextFlow class.
B4X:
Public Sub AddImage(dir As String, img As String)
Dim uri As String = File.GetUri(dir, img)
Dim lastItem As JavaObject
lastItem.InitializeNewInstance("javafx.scene.image.Image", Array(uri))
texts.Add(lastItem)
End Sub
Well, this is not working. What I want to do is to change the text color of a treeview item and then assign an existing image to it as the current color change does not pick up the treeitem image.
B4X:
'Description: Set TreeItem text to some color you want.
'Tag: TreeItem, color, font size
Sub TreeViewItemSetColorImage(ti As TreeItem, Color As Paint, FontSize As Int, dir As String, img As String)
Dim ft As Font = fx.DefaultFont(FontSize)
Dim text As String = ti.Text
Dim tf As TextFlow
tf.Initialize
tf.AddImage(dir,img)
tf.AddText(text).SetColor(Color).SetFont(ft)
Dim jo As JavaObject = ti
Dim p As Pane = tf.CreateTextFlow
jo.RunMethod("setGraphic", Array(p))
End Sub
Can anyone advise please??? Thanks