Relative Content

Tag Archive for Java

The Convert’s Guide to Java Swing: JTextField

This is several of the common code snippets for the Swing JTextField component in Java. Text Font Background Color Select text (index range) Select text (everything) Replace Text Selection (or insert at cursor) Selected text color Cursor Location (text index) Cursor Location (pixel index) Custom Paint a region of Text (by pixel index) Custom Paint […]

The Convert’s Guide to Java Swing: JComboBox

Items Add Item Add Collection of Items Insert Item Replace Item Remove Item Remove All Items Item Count Selection Select Item Clear Item Selection Set Custom Key Selection Manager Selected Item Index Renderer and Editor Set Renderer that uses JLabel Set Renderer that uses JPanel Allow Editing Request Editor Focus Select All Editor Set Editor […]

The Convert’s Guide to Java Swing: JLabel

Text And Icons Set Text (Plain) Set Text (HTML) Set Icon Set Disabled Icon Alignment Change Text and Icon Alignment – HORIZONTAL Change Text and Icon Alignment – VERTICAL Change Text Position Relative to Icon – HORIZONTAL Change Text Position Relative to Icon – VERTICAL State Disable Overall Look Set Size Set Font Set Foreground […]