Java List Selection Control Examples with String Formatting Guide
Learn about Java list controls in GUI applications with detailed explanations for single and multiple selection lists. Also, explore String formatting in Java similar to printf in C with code examples.
Java List Selection Control Examples with String Formatting Guide
E N D
Presentation Transcript
Controls in Java (3) • JList(setSelectionMode, getSelectionModegetSelectedIndex, setSelectedIndex, getSelectedIndices, setSelectedIndices; ListSelectionListner: valueChanged) • Single-selection list (ListSelectionModel.SINGLE_SELECTION) and multiple-selection list (ListSelectionModel.SINGLE_INTERVAL_SELECTION and ListSelectionModel.MULTIPLE_INTERVAL_SELECTION), please see http://docs.oracle.com/javase/6/docs/api/javax/swing/ListSelectionModel.html
Strings in Java • http://java.sun.com/javase/7/docs/api/java/lang/String.html • String.format(String format, Object... args), similar to printf() in C • %d, %10d, %-10d, %010d • %s, %20s, %-20s
No Meeting This Thursday • E-Day, Oct. 11, 2012, 8:30 a.m.-11:45 a.m. • Open E-day to all current students as well. • My lab – SEC 3423.