Showing posts with label AWT. Show all posts
Showing posts with label AWT. Show all posts

Thursday, 27 February 2014

METHODS FOR FONTS IN GRAPHICS CLASS

WORKING WITH FONTS

Font Class in java applet with sample program..........

The AWT supports multiple type fonts. Within AWT, a font is specified by its name, style, and size. Each platform that supports Java provides a basic set of fonts. Beginning with Java 2, fonts have a family name, a logical font name, and a face name. The family name is the general name of the font, such as Courier. The logical name specifies a category of font, such as Monospaced. The face name specifies a specific font, such as Courier Italic.
An instance of the Font class represents a specific font to the system.

The Font class defines these variables:-


 Variable                     Meaning


 protected String name                    Name of the font
 protected int size                              Size of the font in points
 protected int style                            Font style


There are four styles for displaying fonts in Java: plain, bold, italic, and bold italic. Three class constants are used to represent font styles:

public static final int BOLD:The BOLD constant represents a boldface font.

public static final int ITALIC:The ITALIC constant represents an italic font.

public static final int PLAIN:The PLAIN constant represents a plain or normal font.

The combination BOLD/ITALIC represents a bold italic font. PLAIN combined with either BOLD or ITALIC represents bold or italic, respectively.

Tuesday, 25 February 2014

WINDOW FUNDAMENTALS

SOME JAVA FUNDAMENTALS OF THE AWT

Concept of window and advanced components in java


   The AWT defines windows according to a class hierarchy that adds functionality and specificity with each level. The two most common windows are those derived from Panel, which is used by applets, and those derived from Frame, which creates a standard window. Much of the functionality of these windows is derived from their parent classes.

Component


         At the top of the AWT hierarchy is the Component class. Component is an abstract class that encapsulates all of the attributes of a visual component. All user interface elements that are displayed on the screen and that interact with the user are subclasses of Component. It defines over a hundred public methods that are responsible for managing events, such as mouse and keyboard input, positioning and sizing the window, and repainting. A Component object is responsible for remembering the current foreground and background colors and the currently selected text font.

Monday, 24 February 2014

INTRODUCTION TO THE AWT

WHAT ARE AWT CLASSES IN JAVA


A description of Java's user interface toolkit

The Abstract Window Toolkit(AWT) contains numerous classes and methods that allow you to create and manage windows. Although the main purpose of the AWT is to support applet windows, it can also be used to create stand-alone windows that run in GUI environment, such as windows.The AWT classes are contained in the 'java.awt' package. Fortunately, because it is logically organized in a top-down,hierarchical fashion, it is easier to understand and use.