Showing posts with label extends. Show all posts
Showing posts with label extends. Show all posts

Friday, September 20, 2013

Simple Frames and Panels

CODE DOWNLOAD - FramesAndPanelsTute.zip

A JFrame is a Window that can contain other GUI components such as JPanel. We can override the JPanel's paint method to force the JPanel to draw the way we would like it to. In the demo code, the final result looks like the following:


In this example, inheritance has been used to extend both the JFrame and the JPanel class. Both of these classes come from the Java Swing library.

Tuesday, March 27, 2012

Inheritence

When once class is derived / extended / inherited from another class, this relationship is said to be 'Inheritance'.

In Java, the extends keyword is used in the class declaration to implement inheritance.



"Inheritance (The Java™ Tutorials > Learning the Java Language > Interfaces and Inheritance)" ( http://bit.ly/OgTDmk )

"Is-a - Wikipedia, the free encyclopedia" ( http://bit.ly/JWeeX1 )

An example class diagram.