11.07.2015 Views

Introduction to Programming Using Java - Department of ...

Introduction to Programming Using Java - Department of ...

Introduction to Programming Using Java - Department of ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CONTENTSv6.5.4 State Machines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2686.6 Basic Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2716.6.1 JBut<strong>to</strong>n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2736.6.2 JLabel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2746.6.3 JCheckBox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2756.6.4 JTextField and JTextArea . . . . . . . . . . . . . . . . . . . . . . . . . . . 2766.6.5 JComboBox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2776.6.6 JSlider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2786.7 Basic Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2806.7.1 Basic Layout Managers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2816.7.2 Borders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2836.7.3 SliderAndComboBoxDemo . . . . . . . . . . . . . . . . . . . . . . . . . . 2856.7.4 A Simple Calcula<strong>to</strong>r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2876.7.5 <strong>Using</strong> a null Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2896.7.6 A Little Card Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2916.8 Menus and Dialogs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2946.8.1 Menus and Menubars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2956.8.2 Dialogs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2986.8.3 Fine Points <strong>of</strong> Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3006.8.4 Creating Jar Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302Exercises for Chapter 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304Quiz on Chapter 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3097 Arrays 3117.1 Creating and <strong>Using</strong> Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3117.1.1 Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3127.1.2 <strong>Using</strong> Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3127.1.3 Array Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3147.2 <strong>Programming</strong> With Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3167.2.1 Arrays and for Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3167.2.2 Arrays and for-each Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . 3187.2.3 Array Types in Subroutines . . . . . . . . . . . . . . . . . . . . . . . . . . 3197.2.4 Random Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3207.2.5 Arrays <strong>of</strong> Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3227.2.6 Variable Arity Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3257.3 Dynamic Arrays and ArrayLists . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3277.3.1 Partially Full Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3277.3.2 Dynamic Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3307.3.3 ArrrayLists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3337.3.4 Parameterized Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3377.3.5 Vec<strong>to</strong>rs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3407.4 Searching and Sorting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3417.4.1 Searching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3417.4.2 Association Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3437.4.3 Insertion Sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3467.4.4 Selection Sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3477.4.5 Unsorting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!