Add  Border to  JPanel

Add Border to JPanel

Borders are basically margined around the edges of a Swing component. Borders are useful for providing titles and empty spaces around components. The setBorder() is used to put a border around a component. Borders in JPanel Example import java.awt.*; import javax.swing.*; import javax.swing.border.*; import java.awt.event.*; public class VariousBorders extends JPanel { Border border; JButton butn; … Read more

Border Layout in Java

Border Layout in Java

BorderLayout  divides the container into five parts (directions),east,west,north,south,centre. By using this Layout we can place AWT components in each part (different location). BORDER LAYOUT IN JAVA EXAMPLE import java.awt.*; import java.applet.*; public class bordr extends Applet { Button b1,b2,b3,b4,b5; public void init() { b1=new Button(“east”); b1.setBackground(Color.RED); b2=new Button(“west”); b2.setBackground(Color.GREEN); b3=new Button(“south”); b3.setBackground(Color.BLACK); b4=new Button(“north”); b4.setBackground(Color.BLUE); … Read more

Java Program Structure

Java Program Structure

In Java Program Structure, the java system may contain numerous classes of which one and only class characterize the main technique. Classes contain information members and techniques that work on the information members from the class. Strategies may contain information sort revelation and executable articulations. To compose a Java program, we first characterize classes and … Read more

Java Abstract Window ToolKit(AWT)

Java Abstract Window ToolKit(AWT)

Awt package is used for components and awt. event package is used for action performed. If we want to select only one option we use checkboxes.CheckboxGroup is a set of checkboxes in which we can select only one option(checkbox) . The checkboxes which are set in CheckboxGroup are called “radio buttons”. AWT Example import java.awt.*; … Read more

An Applet Program to Add Two Numbers

An Applet Program to Add Two Numbers

Applets are simple Java programs that run in web browsers. The creation of web pages is related to Java Applet. An applet is an Internet-based Java program that can be included in an HTML page. An applet is a Java class defined in JDK’s java. applet package. Addition of Two Numbers using Applet import java.awt.*; … Read more

Animation in Java Applets

Animation in Java Applets

Animation is defined as a rapid(fast/quick) display of text or images. These images or text have to be created in a specific pattern. When they are displayed rapidly it causes an appearance of movement. Example of animation in Applet import javax. swing.*; import java.awt.*; public class animation1 extends JApplet implements Runnable { JLabel labelanimationn; String … Read more

History of Java

History of Java

Java is an object-oriented programming language developed by James Gosling(James A. Gosling a famous software developer, born on May 19, 1955, Canada) at SUN Micro Systems(Since 1984, he has been associated with Sun  Micro Systems and developed the Java Programming language in 1991). The language was initially called OAK(named after the OAK trees outside Gosling’s … Read more

Java Variables

Java Variables

What is a variable? Variable is the name of the memory location from which we store the value. This is clear in the above example. A name that holds value. We can use variables to represent data. Representing attributes by variables. An attribute of an object can be referred to by a variable name that … Read more

Break Statement in Java

Break Statement in Java

A break statement is one of the branching statements(break, continue) provided by Java, which is also used to control the flow of the program. A break statement is used to exit (stop, terminate)from a running loop program on a condition that is predefined, before the loop completion(condition). By using break, you can force immediate termination(stop … Read more