Swing: A Comprehensive Tutorial on Java's Platform Independent GUI Framework, Study notes of Design

A quick tutorial on Swing, a Java framework for creating platform independent GUI applications. Swing is based on the MVC design pattern and includes various visible components, containers, and supporting classes. The tutorial covers creating a JDialog using NetBeans, editing its properties, and adding fields and components. It also discusses the importance of design patterns and the MVC pattern in Swing components.

Typology: Study notes

2021/2022

Uploaded on 09/27/2022

virtualplayer
virtualplayer 🇬🇧

4.2

(13)

288 documents

1 / 66

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Poelman & Associates, Inc. (c) 2003 1
Swing
A Quick Tutorial on Programming
Swing Applications
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42

Partial preview of the text

Download Swing: A Comprehensive Tutorial on Java's Platform Independent GUI Framework and more Study notes Design in PDF only on Docsity!

Poelman & Associates, Inc. (c) 2003

Swing

A Quick Tutorial on Programming

Swing Applications

Poelman & Associates, Inc. (c) 2003

MVC – Model View Controller

• Swing is based on this design pattern• It means separating the implementation of

an application into layers or components:– The

Model

- the data structure that

represents something (like a customer inforec)

– The

Controller

- the user interface logic for

manipulating it

– The

View

- the display of that data structure to

the user.

Poelman & Associates, Inc. (c) 2003

Swing

• Visible “widgets” - windows, buttons,

combo boxes, trees, tables, checkboxes,text fields, menus, …

• Containers of components – applets,

dialogs, windows and frames

• Supporting classes and utility methods

Poelman & Associates, Inc. (c) 2003

Some important Swing visible

component classes

•^

JApplet **

-^

JButton

-^

JCheckBox

-^

JColorChooser

-^

JComboBox

-^

JDialog **

-^

JFileChooser

-^

JFormattedTextField

-^

JFrame **

-^

JLabel

-^

JList

-^

JMenu

-^

JMenuBar

-^

JMenuItem

-^

JPanel

•^

JPasswordField

-^

JPopupMenu

-^

JProgressBar

-^

JRadioButton

-^

JScrollBar

-^

JSlider

-^

JSpinner

-^

JTable

-^

JTextArea

-^

JTextField

-^

JToggleButton

-^

JToolBar

-^

JTree

-^

JWindow **

-^

** means a top level containers

Poelman & Associates, Inc. (c) 2003

adding fields

  • Poelman & Associates, Inc. (c)

Poelman & Associates, Inc. (c) 2003

code created

Poelman & Associates, Inc. (c) 2003

To kill a zombie or running process in

netbeans right click and choose: ”terminate”

Poelman & Associates, Inc. (c) 2003

Editing a dialog

St

select a layout manager for the dialog

Poelman & Associates, Inc. (c) 2003

select component edit properties

Poelman & Associates, Inc. (c) 2003

what layout manager should I

use?

• Start with the absolute and then

experiment when you feel comfortable (orhire a graphic artist and let them worryabout it ;-).

Poelman & Associates, Inc. (c) 2003

Adding other components to the

view - JTextFields

Poelman & Associates, Inc. (c) 2003

Adding a combo box

Poelman & Associates, Inc. (c) 2003

edit the model property for the

combo box

type in stateabbreviationsseparatedby commas