B4X Store
jdashboardUI / Inputs & Controls / jcombobox
Inputs & Controls

jcombobox

Visual dropdown selector with text, icon, image and associated-value options.

Search all jdashboardUI docs
Source
jdashboardUI.b4xlib · Public API only
Store language: en

JDashboardUI · Complete API guide · B4J/JavaFX · October 30, 2026 source bundle

Dropdown selector with text, icon or image entries, text/value pairs, themes, alignment and distinct selection events.

Illustrative component mockup for jcombobox

Illustrative documentation mockup, not an exact control screenshot.

What it does and when to use it

Dropdown selector with text, icon or image entries, text/value pairs, themes, alignment and distinct selection events.

Initialization and practical examples

The example demonstrates the available operations. Root, where used, refers to an existing B4XView. Example image files must actually be included in the project's Files folder.

' Create a selector with optional values
Private Lang As jcombobox
Lang.Initialize(Me, "Lang")
Lang.AddToParent(Root, 20dip, 20dip, 230dip, 40dip, _
    xui.Color_RGB(48, 52, 80), 8dip, fx.Colors.White, "Language", 14)
Lang.Add_Option("Automatic")
Lang.Add_Option2("Español", "es")
Lang.Add_Option2("English", "en")
Lang.Add_Option_With_Icon("Home", Chr(0xF015), _
    xui.Color_White, fx.CreateFontAwesome(18))
Lang.Add_Option_With_Image("Account", File.DirAssets, "avatar.png")

' Select and inspect
Lang.SelectIndex = 1
Log(Lang.SelectOption)
Log(Lang.SelectIndex)
Log(Lang.Value)
Log(Lang.Size)

' Theme, alignment, dropdown height
Lang.Theme = "MidnightBlue"
Lang.LockCustomColors = False
Lang.paneOptionheight = 220dip
Lang.RefreshUI

' Events
Private Sub Lang_ItemClick(Index As Int, Text As String)
    Log(Text)
End Sub

Private Sub Lang_ItemClick2(ItemText As String, ItemValue As Object)
    Log(ItemText & " = " & ItemValue)
End Sub

Complete public API reference

This module exposes 29 public methods/accessors in the inspected version. All declarations, including variants, getters/setters and Designer lifecycle hooks, appear below.

Exact source declaration Purpose
Initialize(Callback As Object, EventName As String) Initializes the instance and, when required, binds Callback and EventName.
DesignerCreateView(Base As Object, Lbl As Label, Props As Map) Designer lifecycle hook; not called manually.
AddToParent(Parent As B4XView, Left As Int, Top As Int, Width As Int, Height As Int, Color_background As Int, Corner_radius As Int, textcolor As Paint, main_text As String, txtSize As Int) Inserts the control into Parent with geometry and initial options.
setTextColor(Color As Paint) Configures TextColor; single-argument setters commonly use B4X property syntax.
setpaneOptionheight(Height As Int) Public method; use the parameters in its declaration.
getpaneOptionheight As Int Public method; use the parameters in its declaration.
setArrowIconOpen(Icon As String) Configures ArrowIconOpen; single-argument setters commonly use B4X property syntax.
setTextforIndex(Index_value As Int) Configures TextforIndex; single-argument setters commonly use B4X property syntax.
setSelectOption(Option As String) Configures SelectOption; single-argument setters commonly use B4X property syntax.
getSelectOption As String Reads the SelectOption property.
getSelectIndex As Int Reads the SelectIndex property.
Add_Option(TextValue As String) Adds a text-only option.
Add_Option_With_Icon(text1 As String, icon As Char, IconColor As Int, font As Font) Adds a text option with font icon.
Add_Option_With_Image(text1 As String, DirIcon As String, FileIcon As String) Adds a text option with an image.
Add_Option2_With_Image(TextValue As String, Value As Object, DirIcon As String, FileIcon As String) Adds text, associated value and image.
Add_Option2_With_Icon(TextValue As String, Value As Object, icon As Char, IconColor As Int, font As Font) Adds text, associated value and icon.
Add_Option2(TextValue As String, Value As Object) Adds visible text and an Object value.
clear Removes all entries.
RefreshUI Reapplies appearance and colors.
ApplyPredefinedTheme(ThemeName As String) Applies a predefined theme.
setTheme(ThemeName As String) Configures Theme; single-argument setters commonly use B4X property syntax.
getTheme As String Reads the Theme property.
setLockCustomColors(Lock As Boolean) Configures LockCustomColors; single-argument setters commonly use B4X property syntax.
getLockCustomColors As Boolean Reads the LockCustomColors property.
getSize As Int Reads the Size property.
setSelectIndex(Index_value As Int) Configures SelectIndex; single-argument setters commonly use B4X property syntax.
getText As String Reads the Text property.
getValue As String Reads the Value property.
setValue(ValueText As String) Configures Value; single-argument setters commonly use B4X property syntax.

B4X properties: read/write access

Public getX/setX members correspond to standard B4X Control.X property syntax when their signatures are property-compatible. Use multi-argument members as methods.

Property Access
TextColor write
ArrowIconOpen write
TextforIndex write
SelectOption read / write
SelectIndex read / write
Theme read / write
LockCustomColors read / write
Size read
Text read
Value read / write

Public fields

  • mBase As B4XView
  • ArrowColor As Int
  • ArrowFont As Font
  • HeaderAlignment As String
  • ItemAlignment As String
  • ColorizeIcon As Boolean

Designer properties

  • color
  • TextColor
  • TextSize
  • MainText
  • cornerradius
  • Theme
  • LockCustomColors
  • ColorizeIcon
  • HeaderAlignment
  • ItemAlignment

Events

  • ItemClick(index As Int, text As String)
  • ItemClick2(ItemText As String, ItemValue As Object)

Lifecycle, compatibility and limitations

The inspected implementation opens below the control; there is no automatic upward opening. Do not assume this CustomView works with JToolBar.AddView; use the native JavaFX ComboBox in compact toolbars.

DesignerCreateView and Base_Resize, where listed, are Custom View lifecycle hooks managed by B4J. Normally you should not call them manually. When adding the view through the Designer, do not initialize the same instance again.

Icon Choose: the sample bundled with JDashboardUI allows searching and previewing glyphs, selecting colors, and copying Chr(0x...) and B4X color values. TTF assets are bundled in the library.

API conventions

  • All signatures and argument types come from the inspected source bundle.
  • B4XView denotes an XUI view, B4XFont an XUI font, and Object an arbitrary value.
  • Variable names in samples are illustrative: use those from your actual project.
  • Source review was performed; no real B4J compilation was performed in this environment.