Download our latest
Android and iPhone apps ...
At a glance ...
Pages
909
Exercises
21
Sections
41
Public
On-Site
Level
2
Days
5

Course Name: Java 1.7 Swing with Eclipse

Duration:
Minimum skill level required:
On-Site course:
Public course:
Sections:
No of exercises:
No of pages in the manual:
Pre-Requisite course(s):
Suggested further course(s):
Price guide:
5 days
2 (1 - Beginner, 2 - Experienced 3 - Advanced)
Yes
No
41
21
909
Java 1.7 Programming with Eclipse
None
Contact us for the latest pricing

Synopsis for course

The follow on course from our Java 1.7 Programming course, this course dives straight in to creating GUI modules in Java

This course is designed for delegates wishing to use Java AWT and Swing classes in a commercial setting, it builds up the knowledge of the delegate to the point where they are creating functionally rich input screens with complicated data integrity checks, pop up menus and Java toolbars.

All Swing classes are covered from the basic JFrames through to JTables and JApplets and everything in between.

Note: A good working knowledge of Java programming is a must for this course, so therefore delegates should have attended our Java 1.7 Programming training course or have had comprehensive period of time working with Java.

The course comes with a comprehensive manual, and over 80 working modules in addition to the solutions for every exercise.

This is a practical course based on commercial requirements.

Exercise highlights

Using JFrames
Creating Components and placing them in Layouts
Borders and Components
Creating menus and toolbars in Java
Web enabling Applications with JApplet

Course Contents

Section
Section Name
Pages


One
Introduction to Java
1

 
- Usage of Java
2

 
- Structure of Java
4

 
- Flexibility of Java Programming
5

 
- Using the Eclipse software
6

 
- Swing and AWT in Java
7

Two
Running Java in Eclipse
10

 
- Introduction
11

 
- Using Eclipse
12

 
- Workspace Launcher
14

 
- Workspace in Eclipse
19

 
- Projects in Eclipse
20

 
- Opening Projects in Eclipse
21

 
- Importing Projects in Eclipse
22

 
- Running Projects in Eclipse
27

 
- Viewing results in the Eclipse Console
28

 
- The Eclipse Console properties
30

Three
Setting up a machine to use Eclipse
31

 
- Introduction
32

 
- Downloading the JDK
33

 
- Installing the Java Developer Kit
36

 
- Downloading Eclipse
40

 
- Installing Eclipse
42

Four
First Steps in Eclipse
44

 
- Naming Java modules
45

 
- Commenting in Java Programs
46

 
- Editing Java in Eclipse
47

 
- The SRC folder
49

 
- Editing the code in the SRC
51

 
- Examining the Workspace Folder
53

 
- Examining the Workspace
54

Five
Creating Projects and Classes in Eclipse
56

 
- Introduction
57

 
- Creating Projects
58

 
- Importing Projects
62

 
- Importing Projects from other Folders
63

 
- Importing Archives into Workspace
66

 
- Exporting a Project
69

 
- Deleting Projects
73

 
- Creating Packages
74

 
- Creating Classes
77

 
- Exporting Classes into Projects
82

 
- Importing Classes into Projects
83

 
- Copying Classes
86

 
- Incorporating Existing Classes
88

Six
Using the Java Editor in Eclipse
89

 
- Introduction
90

 
- Folding
92

 
- Line Numbers
94

 
- Creating Bookmarks
95

 
- Using Bookmarks
96

 
- Using Tasks
100

 
- Correcting Errors
105

 
- Error Checking
106

 
- Colour Coding
108

 
- Hints while typing
109

 
- Bracket Location
111

Seven
Dialog Boxes
112

 
- Using Dialog Boxes
113

 
- Using Message Dialogs
115

 
- Using ImageIcons with Message Dialogs
120

 
- Using Confirm Dialogs
123

 
- Using Input Dialogs
128

 
- Using Input Dialogs with Icons and Lists
130

 
- Using Option Dialogs
132

 
- Making a Beep in Java
138

 
- Exercise One
139

Eight
Dimensions
144

 
- The Dimension Datatype
145

 
- Examples of Using Dimensions
146

 
- Methods for Dimensions
147

 
- getScreenSize()
149

Nine
JFrame
150

 
- Using JFrame
151

 
- setDefaultCloseOperation()
152

 
- setVisible()
153

 
- Exiting JFrames
154

 
- setResizable()
155

 
- setLocation()
156

 
- setBounds()
158

 
- Centering JFrames
159

 
- JFrame Example
160

 
- setLocationRelativeTo() for Centreing
161

 
- dispose()
162

 
- Using setIconImage()
163

 
- Using Constructors in Java Swing
164

 
- serialVersionUID
165

 
- Creating a Constructor Method
166

 
- JFrame Constructor
168

 
- @SuppressWarnings
169

 
- Exercise Two
174

Ten
JComponent
176

 
- Introduction
177

 
- Methods to Change Appearance
178

 
- Methods to Process Components
182

Eleven
Colour and Fonts
186

 
- Using Color
187

 
- Using Color with JFrame
189

 
- Using Font
190

Twelve
JLabel
196

 
- Using JLabel
197

 
- getContentPane().add()
198

 
- Creating a message in JLabel
200

 
- Using HTML with JLabel
201

 
- Changing the position in a JLabel
204

 
- Adding an Icon to a JLabel
206

 
- Changing a JLabel's Colour and Font
208

 
- Icon only JLabel
210

 
- setVerticalAlignment()
211

 
- pack()
212

 
- Exercise Three
214

Thirteen
Borders
217

 
- BorderFactory
218

 
- createEmptyBorder()
221

 
- createLineBorder()
222

 
- createRaisedBevelBorder()
224

 
- createRaisedSoftBevelBorder()
225

 
- createBevelBorder()
226

 
- createDashedBorder()
228

 
- createStrokeBorder()
231

 
- createEtchedBorder()
235

 
- createMatteBorder()
237

 
- createTitledBorder()
239

 
- Nested createTitledBorder()
249

 
- Fonts with createTitledBorder()
250

 
- createCompoundBorder()
251

 
- Exercise Four
254

Fourteen
Mid-Level Containers
258

 
- Containers
259

 
- JPanels
261

 
- JScrollPanes
263

 
- Scroll Bar policy
266

 
- Exercise Five
268

Fifteen
Absolute Layouts
270

 
- Introduction
271

 
- setBounds()
272

 
- Exercise Six
276

Sixteen
Layouts
277

 
- JPanel and Layouts
278

 
- FlowLayout
280

 
- Some FlowLayout Methods
284

 
- GridLayout
286

 
- Some GridLayout Methods
291

 
- BorderLayout
292

 
- Defining BorderLayouts since Java 1.4
297

 
- Some BorderLayout Methods
299

 
- Exercise Seven
300

 
- BoxLayout
303

 
- SpringLayout
306

 
- putConstraint()
310

Seventeen
Box
314

 
- Introduction
315

 
- createRigidArea()
317

 
- createVerticalStrut()
318

 
- createHorizontalStrut()
319

 
- createGlue()
320

 
- createHorizontalGlue() / createVerticalGlue()
322

 
- Using Box.Filler
323

 
- Using Box as a Container
326

 
- Exercise Eight
328

Eighteen
JButton
330

 
- Introduction
331

 
- Example
332

 
- Using Insets to re-size JButtons
334

 
- Using Icons with JButtons
336

 
- Using AbstractButton with JButtons
337

 
- Using SwingConstants with JButtons
341

 
- Some Methods for JButtons
342

 
- Using HTML with JButton
345

 
- Advanced Icons with JButtons
346

 
- Using Rollover with JButtons
348

 
- JButtons and ToolTips
349

 
- BasicArrowButton
350

Nineteen
Event Handling with Listeners
352

 
- Listening for Events
353

Twenty
Private Event Listeners for JButtons
358

 
- Introduction
359

 
- java.awt.event.*
360

 
- Example of Private Listener
361

 
- ActionEvent
363

 
- Recording the Event
364

 
- Which Component fired the Listener
365

 
- Using getActionCommand()
366

 
- getValueIsAdjusting()
367

 
- getWhen()
368

 
- Exercise Nine
369

Twenty One
Public Event Listeners
371

 
- Introduction
372

 
- Example of Public Listener
373

Twenty Two
Implemented Event Listeners
375

 
- Introduction
376

 
- Example of Implemented Listener
377

Twenty Three
Listener Events
379

 
- Introduction
380

 
- Multiple Events with Listeners
381

 
- Exercise Ten
384

Twenty Four
JTextComponent
386

 
- Methods in JTextComponent
387

Twenty Five
Input Components
388

 
- Introduction
389

 
- JTextField
390

 
- JTextField Example
391

 
- JTextField Initialisation
393

 
- Other Methods for JTextField
394

 
- Processing JTextField using getText()
396

 
- Listeners for JTextField
397

 
- FocusListener with JTextField
398

 
- ActionListener with JTextField
400

 
- JPasswordField
403

 
- JPasswordField Example
404

 
- setEchoChar()
406

 
- JTextArea
407

 
- JTextArea Example
408

 
- JTextArea and setFocusable()
410

 
- Wrapping text in JTextArea
412

 
- Listeners with JTextArea
415

 
- Some methods for JTextArea
416

 
- JFormattedTextField
419

 
- Initialising JFormattedTextField
420

 
- Populating JFormattedTextField
423

 
- Using setValue()
425

 
- Listeners with JFormattedTextField
426

 
- Using MaskFormatter
427

 
- Using setFocusLostBehavior
429

 
- requestFocusInWindow()
431

 
- Exercise Eleven
432

Twenty Six
GroupLayout
434

 
- Introduction
435

 
- Sequential and Parallel Groups
436

 
- addGap()
439

 
- setAutoCreateGaps()
440

 
- Changing Direction of Components
441

 
- Chained Invocation or Method Chaining
442

 
- Adding further Groups with addGroup()
443

 
- Controlling Resizing with addComponent()
448

 
- Using LinkSize to standardise sizing
451

 
- Alignment
452

Twenty Seven
Selection Components
453

 
- JComboBox
454

 
- Using addItem() with JComboBox
457

 
- getSelectedItem() with JComboBox
458

 
- ComboBoxModel with JComboBox
459

 
- Some methods for JComboBox
460

 
- ItemListener with JComboBox
462

 
- JCheckBox
463

 
- JCheckBox Example
464

 
- Initialising JCheckBox
465

 
- Using HTML with JCheckBox
466

 
- Images with JCheckBox
467

 
- ItemListener with JCheckBox
468

 
- JToggleButton
470

 
- Initialising JToggleButton
471

 
- Listeners with JToggleButtons
472

 
- JRadioButton
473

 
- JRadioButton Example
475

 
- Initialising JRadionButtons
477

 
- Icons with JRadioButtons
478

 
- ActionListener with JRadioButton
480

 
- Using setActionCommand()
481

 
- setActionCommand() Example
482

 
- Using Enumeration
484

 
- Using AbstractButton
487

 
- Exercise Twelve
488

 
- JList
493

 
- JList Example
494

 
- setLayoutOrientation() with JList
496

 
- setSelectionMode() with JList
498

 
- setPrototypeCellValue() with JList
500

 
- setFixedCellWidth with JList
501

 
- DefaultListModel with JList
502

 
- DefaultListModel Example
503

 
- Icons with DefaultListModels
505

 
- Using Vectors
507

 
- Methods for Vectors
508

 
- getSelectedIndices() in JList
513

 
- JList Listeners
514

 
- ListSelectionListener
515

 
- Using getSelectedValuesList()
516

 
- ListDataListener
517

 
- ListDataListener Example
518

 
- Exercise Thirteen
520

 
- JSpinner
523

 
- SpinnerNumberModel
524

 
- SpinnerNumberModel Example
525

 
- Methods for SpinnerNumberModel
526

 
- Change Orientation of JSpinner
527

 
- ChangeListener with JSpinner
528

 
- SpinnerListModel
529

 
- SpinnerListModel Example
530

 
- setPreferredSize()
531

 
- ArrayLists with SpinnerListModel
533

 
- SpinnerDateModel
534

 
- SpinnerDateModel Example
536

 
- DateEditor with SpinnerDateModel
538

 
- JSlider
543

 
- Initialising JSlider
544

 
- ChangeListener with JSlider
546

 
- Placing Numbers on the JSlider
547

 
- Placing ticking on the JSlider
548

 
- setMinorTickSpacing() with JSlider
549

 
- Customising the JSlider ticks
550

 
- Some more JSlider methods
551

 
- JSeparator
553

 
- JSeparator Example
554

 
- Using Box with JSeparator Example
556

 
- Exercise Fourteen
558

Twenty Eight
JMenus and JPopupMenus
561

 
- Introduction
562

 
- JMenuBar
563

 
- JMenuBar Example
565

 
- JMenu
566

 
- JMenu Example
567

 
- JMenuBar and JTextField
568

 
- Mnemonic with JMenus
569

 
- MenuListener
570

 
- MenuListener Example
571

 
- JMenuItem
573

 
- JMenuItem Example
574

 
- JMenuItems with Images
575

 
- Mnemonic with JMenuItems
576

 
- Accelerator with JMenuItems
577

 
- Listeners with JMenuItems
579

 
- JMenuItem and MenuKeyListener
580

 
- Sub-Menus in JMenus
581

 
- JCheckBoxMenuItems in JMenus
582

 
- JCheckBoxMenuItems with Images
584

 
- JCheckBoxMenuItems with ItemListner
585

 
- JRadioButtonMenuItem in JMenus
586

 
- JRadioButtonMenuItem Example
587

 
- JRadioButtonMenuItem with JMenu Example
588

 
- JRadioButtonMenuItem with Images
589

 
- JRadioButtonMenuItem and Listeners
590

 
- Using getActionCommand() with JRadioButton
591

 
- Using Enumeration
592

 
- JPopupMenu
593

 
- JPopupMenu with MouseListener
594

 
- MouseListener Examples
595

 
- Event.isPopupTrigger()
597

 
- PopupMenuListener
598

 
- JToolBar
599

 
- JToolBar Example
601

 
- JToolBar and setFloatable()
603

 
- JToolBar and Listeners
604

 
- JToolBar and Icons
605

 
- JToolBar Orientation
606

 
- JToolBar with JTextFields
607

 
- addSeparator() with JToolBar
609

 
- Exercise Fifteen
610

Twenty Nine
Applets
613

 
- Introduction to using Applets within Eclipse
614

 
- Using Appletviewer in Eclipse
615

 
- Appletviewer Options
617

 
- Converting a basic Application to an Applet
618

 
- InvocationTargetException and Images
624

 
- Using URL with Images
625

 
- Dialog Boxes converted to JApplet
626

 
- JInternalFrames (with LAF) converted to JApplet
627

 
- JMenus converted to JApplet
628

 
- JTrees converted to JApplet
629

 
- JColorChooser converted to JApplet
630

 
- Choosing Applet or Application in Eclipse
631

 
- Using start(), stop(), paint(), init() and destroy()
637

 
- Passing Parameters to JApplet in Eclipse
640

 
- Using getParameter() with JApplet
643

 
- Embedding Java in HTML
645

 
- Using the applet tag in HTML
646

 
- Using showStatus() (Short status strings)
648

 
- Passing Parameters to the Applet
649

 
- Reading Parameters in the Applet
650

 
- Using the object tag in HTML
651

 
- Accessing System Properties in Applets
652

 
- Exercise Sixteen
654

Thirty
Look and Feel (LAF)
657

 
- Using setLookandFeel()
658

 
- Standard LAF Styles
660

 
- javax.swing.plaf.metal.MetalLookAndFeel
662

 
- javax.swing.plaf.nimbus.NimbusLookAndFeel
663

 
- com.sun.java.swing.plaf.motif.MotifLookAndFeel
664

 
- com.sun.java.swing.plaf.windows.WindowsLookAndFeel
665

 
- com.sun.java.swing.plaf.windows.WindowsClassicLookandFeel
666

 
- Defaulting the LAF permanently in Java
667

 
- Using Third Party LAFs
668

 
- Installing the LAF in the Operating System
669

 
- Identifying the Look and Feel Class in the Jar file
670

 
- Using the third party LAF in Java
671

 
- Exercise Seventeen
672

Thirty One
GridBagLayouts
673

 
- Introduction
674

 
- GridBagConstraints
675

 
- GridBagConstraints Example
678

 
- gridx and gridy
683

 
- gridx and gridy example
684

 
- gridwidth and gridheight
687

 
- gridwidth and gridheight example
688

 
- GridBagConstraints.REMAINDER
691

 
- fill
692

 
- fill example
693

 
- anchor
694

 
- anchor examples
695

 
- insets
697

 
- insets example
698

 
- ipadx and ipady
699

 
- ipadx and ipady example
700

 
- weightx and weighty
701

 
- Final example
705

Thirty Two
JTable
711

 
- Introduction
712

 
- JTable Example
713

 
- Default Settings
716

 
- setPreferredScrollableViewportSize()
717

 
- java.lang.ArrayIndexOutOfBoundsException
718

 
- Problems with the TableColumnModel
719

 
- Adding to a JPanel
720

 
- Using DefaultTableModel()
721

 
- Using addColumn()
722

 
- setAutoCreateColumnsFromModel()
724

 
- Changing the Width of Columns
725

 
- setResizable()
727

 
- Some Methods for JTable
728

 
- Moving Columns Programmatically
729

 
- Moving Rows Programmatically
730

 
- Setting the Selection Mode
731

 
- isCellEditable()
734

 
- Accessing Cells
736

 
- Determining the Current Cell
737

 
- ListSelectionListener
738

 
- ListSelectionListener Example
739

 
- TableModelListener
743

 
- TableModelListener Example
745

 
- Exercise Eighteen
748

Thirty Three
Mouse Double Click
751

 
- Introduction
752

 
- Double Click Example
753

Thirty Four
JTree
755

 
- Introduction
756

 
- JTree Example
757

 
- Populating a JTree (Top to Bottom)
759

 
- Expand()
762

 
- Populating a JTree (Bottom to Top)
763

 
- Populating a JTree with more levels
764

 
- TreeExpansionListener
766

 
- getLastSelectedPathComponent()
767

 
- TreeSelectionListener
768

 
- Customising the JTree
769

Thirty Five
CardLayouts
771

 
- Introduction
772

 
- CardLayout Example
773

 
- Exercise Nineteen
777

Thirty Six
More Containers
782

 
- Introduction
783

 
- JSplitPane
784

 
- setDividerLocation() with JSplitPane
788

 
- Using setResizeWeight with JSplitPane
789

 
- JSplitPanes within JSplitPanes
790

 
- JTabbedPane
792

 
- JTabbedPane Example
794

 
- Using addTab() with JTabbedPane
796

 
- Inserting Tabs into a JTabbedPane
799

 
- Removing Tabs in JTabbedPane
800

 
- Positioning the Tabs
801

 
- setTabLayoutPolicy for JTabbedPane
804

 
- setMnemonic() with Tabs
806

 
- Some Methods for JTabbedPane
807

 
- ChangeListener with JTabbedPane
811

Thirty Seven
More Frames
813

 
- JInternalFrame
814

 
- Using LAF with JInternalFrame
816

 
- JInternalFrame Behaviour
817

 
- Some JInternalFrame Methods
820

 
- Adding Compnents to JInternalFrame
821

 
- setJMenuBar() for JInternalFrame
822

 
- InternalFrameListener
823

 
- isVisible() with JInternalFrame
825

 
- JLayeredPane
826

 
- JLayeredPane Example
830

 
- Layouts in JLayeredPane
832

 
- More methods for JLayeredPane
833

 
- JDesktopPane
836

 
- showInternalMessageDialog
837

 
- showInternalConfirmDialog
840

 
- Exercise Twenty
845

Thirty Eight
JWindow
847

 
- Using JWindow
848

Thirty Nine
Swing Timers and Progress Bars
850

 
- Introduction
851

 
- Methods for Swing Timers
854

 
- Timers and Coaleace
856

 
- JProgressBar
857

 
- JProgressBar Example
858

 
- JProgressBar Methods
860

 
- Displaying text in the JProgressBar
861

 
- JProgressBar Orientation
863

 
- JProgressBar and ChangeListener
864

 
- Using Threads to create a Splash screen
865

 
- Cursors
867

 
- Scope of Cursors
870

 
- Creating a Custom Cursor
871

Forty
System Tray
872

 
- Introduction
873

 
- System Tray Example
875

Forty One
Java Built-in Choosers
878

 
- JColorChooser
879

 
- ChangeListener
885

 
- setPreviewPanel()
888

 
- Using setColor()
889

 
- Using AbstractColorChooserPanel
890

 
- JFileChooser
892

 
- setFileSelectionMode()
897

 
- setControlButtonsAreShown()
899

 
- FileFilter
900

 
- setAcceptAllFileFilterUsed()
902

 
- addChoosableFileFilter
903

 
- Some Methods for JFileChooser
904

 
- ActionListener with JFileChooser
905

 
- Exercise Twenty One
908