Series: AWT Introduction

Introduction to Java AWT in simple terms and code

Java AWT Create Font Object

Important text can be made eye-catching by displaying in attractive fonts. A font represents a combination of a font name (like Monospaced), font style (like bold) and font size (like 20). Following is the class signature public class Font extends Object implements Serializable The Font constructor takes three parameters to create a Font object. Font …

Java AWT Create Font Object Read More »

Java AWT Create Color Object

With colors and fonts, readability increases as important noteworthy topics can be colored. All the latest operating systems support colors and fonts and allow customizing also. To support colors and fonts, the java.awt package includes Color class and Font class. Standard Color Models Color can be specified in two formats – RGB and HSB. 1. …

Java AWT Create Color Object Read More »

Java AWT Adapters

Java AWT Adapters are abstract classes from java.awt.event package introduced with JDK 1.1. Adapter classes make event handling simple and easy. Adapters usage replaces the listeners; adapters make event handling easy to the programmer. Every listener that includes more than one abstract method has got a corresponding adapter class. The advantage of adapter is that …

Java AWT Adapters Read More »

Java AWT Listeners

Java AWT Listeners are a group of interfaces from java.awt.event package. Listeners are capable to handle the events generated by the components like button, choice, frame etc. These listeners are implemented to the class which requires handling of events. public class ButtonDemo1 extends Frame implements ActionListener The class ButtonDemo1 implements ActionListener as ButtonDemo1 includes some …

Java AWT Listeners Read More »