JAVA

Frame Layout Managers

  Layout Manager The layout manager automatically positions all the components within the container. If we do not use layout manager then also the components are positioned by the...

AWT Component Classes

AWT provides many ready-made and reusable GUI components. The frequently-used are: Button, TextField, Label, Checkbox, CheckboxGroup (radio buttons), List, and Choice, as illustrated below. AWT GUI Component: java.awt.Label A...

AWT Container Classes

Top-Level Containers: Frame, Dialog and Applet Each GUI program has a top-level container. The commonly-used top-level containers in AWT are Frame, Dialog and Applet: A Frame provides the “main...

Containers and Components

There are two types of GUI elements: Component: Components are elementary GUI entities (such as Button, Label, and TextField.) Container: Containers (such as Frame, Panel and Applet) are used...

AWT Packages

AWT is huge! It consists of 12 packages (Swing is even bigger, with 18 packages as of JDK 1.7!). Fortunately, only 2 packages – java.awt and java.awt.event – are...

Graphical User Interface (GUI) in JAVA

There are two basic types of GUI program in Java: stand-alone applications and applets. An applet is a program that runs in a rectangular area on a Web page....

Event Handling in Java

EventsWhen the user interacts with a GUI application, an event is generated. Examples of user events are clicking a button, selecting an item or closing a window. Events are...

Dynamic Programming in Java

The classic example to explain dynamic programming is the fibonacci computation, so I’ll also go with that. The definition of the fibonacci number of a number is clearly a...

Super and Sub class in Java

In Java, as in other object-oriented programming languages, classes can be derived from other classes. The derived class (the class that is derived from another class) is called a...

Inheritance in Java

Java Inheritance defines an is-a relationship between a superclass and its subclasses. This means that an object of a subclass can be used wherever an object of the superclass...