Draw A Paint Using Java
Draw A Paint Using Java
Draw A Paint Using Java
PROJECT REPORT
Submitted in Partial Fulfillment of the requirements for the Award of the Degree of
IN
COMPUTER APPLICATION
By
PROF.P.GUDAGHE
OF
1. Introduction
1.1 Overview
1.2 Object-oriented Programming
1.3 The Basic GUI (graphical user interface ) Application 2. Graphics and
Painting
2.1 Overview of the Java 2D API Concepts
2.2 Coordinates
2.3 Colors
2.4 Shapes
Containert
Panel
Applet
SimpleApplet
Operation Model: Events are executed requested by the user and show the result
of the required on panel or frame.
1. The events on the buttons or panel such as mouseClicked, MousePressed,
MouseReleased, MouseMoved, MouseDragged, and FocusGained, when
the user released events the program call the subroutine to achieve
operation required.
2. After completing execute the subroutine show the result on panel.
4.3 Components
Our project contents from several classes as follows:
- Main_DrawPaintProject.java (Main Program)
- InterfaceForm.java (Main program interface)
- Shape.java
- Command.java
- Point.java
- DrawLine.java
- DrawCircle.java
- DrawRectangle.java
- DrawSquare.java
- DrawOval.java - DrawString
package com.onlinetutorialspoint.swing;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JColorChooser;
import javax.swing.JFrame;
import javax.swing.JPanel;
public JColorChooserDemo(){
super("JColorChooser Example");
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e)
{ color =
JColorChooser.showDialog(JColorChooserDe
mo.this, "Pick Color", color); if(color == null)
color = Color.WHITE;
colorPanel.setBackground(color);
}
});
add(colorPanel,BorderLayout.CENTER);
add(button,BorderLayout.SOUTH);
setSize(400, 130);
setVisible(true);
}
public static void main(String[] args) {
JColorChooserDemo colorChooser = new
JColorChooserDemo();
colorChooser.setDefaultCloseOperation(JFrame.EXIT_ON_CL
OSE);
}
Output:
References
[1] "Programming Language Popularity". 2009. Retrieved 2009-01-
16.
[8] http://docs.oracle.com/javase/7/docs/api/java/awt/Graphics.h
tml , 2013
[10] OracleTechnology,
http://www.oracle.com/technetwork/java/painting-
140037.html#callback