WDD_lec_18 - Web Design & Development Lecture 18 Java...

Info iconThis preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon
Lecture 18
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Java Graphics
Background image of page 2
Graphics Window is like a painter’s canvas App must paint its window contents Java components paint themselves Anything else: Programmer When to paint? How to paint? JButton
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
MyApp
Background image of page 4
Open WinExp, Notepad
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Close WinExplorer Repaint event sent to: MyApp, Desktop
Background image of page 6
Desktop gets repaint event
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
MyApp gets repaint event MyApp JPanel gets repaint event
Background image of page 8
MyApp gets repaint event MyApp JPanel forwards repaint event to JButton
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Painting a Swing Component Three methods are at the heart of painting a swing component paintComponent() paintBorder() paintChildren()
Background image of page 10
The Swing Painting Methods It's one of three methods, that objects of type JComponent use to paint themselves. The three methods are invoked in this order: paintComponent — The main method for painting. By default, it first paints the background. Then it performs any custom painting. paintBorder — Tells the component's border (if any) to paint.
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 21

WDD_lec_18 - Web Design & Development Lecture 18 Java...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online