Monday, 20 November 2017

Program to create a Popup Menu using Java AWT

This tutorial shows you how to create a simple popup menu in Java. Popup menu is a menu which appears when you right click on mouse. For example, to copy, paste something in computer you right click and it will show the popup menu like:



Sunday, 19 November 2017

Program to create a simple Calculator using Java AWT components

This tutorial explains you how to create a simple Calculator using Java AWT components. The output of the program is given below. 



















PROGRAM
import java.awt.*;
import java.awt.event.*;

class MyCalculator extends Frame implements ActionListener {
 
 TextField tfInput;
 Panel panel;
 
 String btnString[] = {"7", "8", "9", "+",
                 "4", "5", "6", "-",
                 "1", "2", "3", "*",
                 "C", "0", "=", "/"};

Sunday, 12 November 2017

Program to create a simple mini paint application

In this program, we will create a simple mini paint application using Frame class. We have to implement two types of events here: Mouse event and Key event. To use this program you have to use numpad keys on keyboard. The following keys are used for specific purpose: