SWING / CATATAN</>↗Swing31 Des 2008
This example demonstrates the ItemListener to listen for changes to the selected item in the JComboBox component. package org.kodejava.swing; import javax.swing.*; import javax.swing.border.BevelBorder; import java.awt.event.ItemEvent; import java.awt.*; public class ComboBoxSelectionChange extends JFrame { public ComboBoxSelectionChange() { initialize(); } public static void main(String[] args) { SwingUtilities.invokeLater( () -> new ComboBoxSelectionChange().setVisible(true...
SWING / CATATAN</>↗Swing28 Des 2008
In this example you’ll see how we can change the default number of visible items in the combo box. By default, it only shows eight items at once and when the combo box has more items a scrollbar will be shown, so we can scroll up and down in the combo box list. If we […]
ITEXT PDF / CATATAN</>↗iText PDF27 Des 2008
This example shows how to create a table in a PDF document. Using the iText PDF library we can use the PdfPTable and the PdfPCell classes to create table and cells in our PDF document. In the following example we use array of strings to define the table’s data. Let’s see the complete code snippet […]
SWING / CATATAN</>↗Swing27 Des 2008
This example demonstrate how to add an items into a specific position in the combo box list or at the end of the list using the insertItemAt(Object o, int index) and addItem(Object o) method. In the code we also learn how to remove one or all items from the list using removeItemAt(int index) method and […]
SWING / CATATAN</>↗Swing23 Des 2008
This example demonstrate the use of JComboBox‘s getItemCount() method and getItemAt(int index) to get the number of items inside the combo box and how to obtain each of them. package org.kodejava.swing; import javax.swing.*; import java.awt.*; public class ComboBoxGetItems extends JFrame { public ComboBoxGetItems() { initialize(); } public static void main(String[] args) { SwingUtilities.invokeLater(() -> new […]
SWING / CATATAN</>↗Swing19 Des 2008
The code below demonstrate how to set the selected item of JComboBox and then on how to get the value of the selected item. In this example we set the JComboBox component so that user can enter their own value. package org.kodejava.swing; import javax.swing.*; import java.awt.*; public class ComboBoxSelectedItem extends JFrame { public ComboBoxSelectedItem() { […]