Menus & Navigation · jdashboardUI · B4J / JavaFX
JTabBar creates animated horizontal navigation with text, image or icon options. It can be created from the Designer or with AddToParent.
The image shown here is a visual reference created for the documentation, not a pixel-perfect screenshot.
Basic example
JTabBar1.AddOptions(Array As String("Home", "Files", "Settings"))
JTabBar1.Show
JTabBar1.Active = 0
Visible and Enabled
The current version exposes these properties directly:
JTabBar1.Visible = False
JTabBar1.Visible = True
JTabBar1.Enabled = False
JTabBar1.Enabled = True
When Enabled = False or Visible = False, the control does not process clicks or raise the selection event. There is no need to access mBase manually.
Image or icon options
JTabBar1.AddTextWithImage("Files", File.DirAssets, "folder.png", "Files")
JTabBar1.AddTextWithIcon("Settings", Chr(0xE8B8), xui.Color_Blue, xui.CreateMaterialIcons(18), "Settings")
JTabBar1.Show
Event
Private Sub JTabBar1_itemClicked(Text As String, Index As Int)
Log(Text & " / " & Index)
End Sub
Complete public API
Initialize(Callback As Object, EventName As String)DesignerCreateView(Base As Object, Lbl As Label, Props As Map)AddToParent(parent As B4XView, Left As Int, Top As Int, Width As Int, Height As Int)setCornerRadius(Radius As Int)AddOption(Text As String)AddOptions(Texts As List)AddTextWithImage(Text As String, ImageDir As String, ImageFileName As String, Toltip As String)AddTextWithIcon(Text As String, Icon As String, IconColor As Int, IconFont As B4XFont, TolTip As String)setActive(Number As Int)setActive2(Text As String)Show()setVisible(Value As Boolean)getVisible() As BooleansetEnabled(Value As Boolean)getEnabled() As BooleansetActiveColor(Color As Int)setTextColor(Color As Int)setTextSize(sizee As Int)setFonts(setfont As B4XFont)setAnimationTime(MilliSecond As Int)setBackgroundColor(Color As Int)setBorderColor(BorderColor As Int)getSize() As IntgetTexts() As ListgetActiveIndex() As IntgetActiveValue() As StringsetDropShadow(color As Int)