JAVA CBP
JAVA CBP
JAVA CBP
BACHELOR OF TECHNOLOGY
IN
Submitted by
CERTIFICATE
DECLARATION
We declare that the course based project work entitled “Supermarket Mnagement
System” submitted in the Department of Information Technology, Vallurupalli
Nageswara Rao Vignana Jyothi Institute of Engineering and Technology, Hyderabad,
in partial fulfilment of the requirement for the award of the degree of Bachelor of
Technology in COMPUTER SCIENCE AND ENGINEERING DATA SCIENCE is a bonafide
record of our own work carried out under the supervision of MRS. Ashalatha.G,
Assistant Professor, Dept. of CSE- (CYS, DS) AND AI&DS, VNRVJIET. Also,
we declare that the matter embodied in this thesis has not been submitted by us in full
or in any part thereof for the award of any degree/diploma of any other institution or
university previously.
Place: Hyderabad.
V.Sanjana V.Siri
(22071A6760) (22071A6764)
ACKNOWLEDGEMENT
We express our deep sense of gratitude to our beloved President, Sri. D. Suresh Babu,
VNR Vignana Jyothi Institute of Engineering & Technology for the valuable guidance
and for permitting us to carry out this project.
With immense pleasure, we record our deep sense of gratitude to our beloved Principal,
Dr. C.D Naidu, for permitting us to carry out this project.
We express our deep sense of gratitude to our beloved Professor Dr. M. RAJA
SEKHAR, Associate Professor and Head, Dept. of CSE- (CYS, DS) AND AI&DS,
VNR Vignana Jyothi Institute of Engineering & Technology, Hyderabad-500090 for
the valuable guidance and suggestions, keen interest and through encouragement
extended throughout the period of project work.
We take immense pleasure to express our deep sense of gratitude to our beloved Guide,
MRS. Ashalatha.G, Assistant Professor, Dept. of CSE- (CYS, DS) AND AI&DS,
VNRVJIET her valuable suggestions and rare insights, for constant source of
encouragement and inspiration throughout my project work.
We express our thanks to all those who contributed for the successful completion of
our project work.
P.HASINI (22071A6743)
P.BHANU SATISH (22071A6749)
S.SRI RAM (22071A6751)
V.SANJANA (22071A6760)
V.SIRI (22071A6764)
ABSTRACT
users with a robust and user-friendly platform for digital art creation. Leveraging the
flexibility and versatility of the Java programming language, this application provides a
dynamic canvas equipped with an array of drawing tools, including pencils, brushes, shapes,
and text. The intuitive user interface incorporates features like customizable brush settings,
layer management, and undo/redo functionality, ensuring a seamless and enjoyable drawing
experience. With support for various file formats and project files, users can save and revisit
their creations, preserving both the final composition and the individual elements for future
audience, allowing artists and designers to unleash their creativity on different operating
systems.
This drawing application stands out for its emphasis on a layered approach to drawing,
enabling users to organize and manipulate elements within their artwork efficiently. The
color palette, zoom and pan features, and the ability to create custom swatches further
enhance the user's control and expression. Whether used by professionals for intricate
illustrations or by hobbyists for casual sketching, the Java Drawing Application provides a
comprehensive suite of tools that caters to a wide range of digital art creation needs.
1
TABLE OF CONTENTS
1.Introduction 3
3.Outputs 22-23
4.Conclusion 24
2
INTRODUCTION
1.PROBLEM STATEMENT
Java-based drawing application enabling users to draw shapes, lines, text, and modify them
with different colors and brush sizes. Include features for saving, loading, and exporting
drawings in multiple formats. Incorporate basic editing options like undo, redo, copy, paste,
and resizing elements. Consider advanced features such as layers for better organization and
cater to users of varying skill levels.
2.OBJECTIVE
Additionally, the application should implement robust functionalities, including undo and
redo options, layer management, and the ability to import/export images. Integration of
advanced features like pressure sensitivity for digital drawing tablets, customizable
brushes, and real-time collaboration could enhance the application's appeal. Moreover, the
project should prioritize scalability, ensuring that the application can accommodate future
updates and additional features.
3
SOURCE CODE
Main.java
Canvas.java
package sanjana;
import java.awt.AWTException;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
Canvas() {
canvasPanel = new JPanel();
canvasPanel.addMouseMotionListener(this);
}
4
public void CanvasView() {
//-----------CANVAS-------------
canvasPanel.setBounds(320, 30, 850, 600);
canvasPanel.setBackground(Color.white);
canvasPanel.setLayout(null);
frame.add(canvasPanel);
canvasPanel.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
String cl = col.getText();
int rad = Integer.parseInt(sz.getText());
Graphics grap = canvasPanel.getGraphics();
grap.setColor(Color.decode(cl));
grap.fillRect(e.getX(), e.getY(), rad, rad);
}
});
//-----------------------------
//-----------TOOLBAR-------------
toolBar = new JPanel();
toolBar.setBounds(30, 30, 250, 600);
toolBar.setBackground(Color.white);
toolBar.setLayout(null);
frame.add(toolBar);
addButton(32, 30, "#000000");
addButton(105, 30, "#FFFFFF");
addButton(177, 30, "#808080");
addButton(32, 90, "#FF0000");
addButton(105, 90, "#00FF00");
addButton(177, 90, "#0000FF");
addButton(32, 150, "#FFFF00");
addButton(105, 150, "#FFA500");
addButton(177, 150, "#A020F0");
addButton(32, 210, "#FFC0CB");
addButton(105, 210, "#964B00");
addButton(177, 210, "#C32148");
//-----------------------------
//---------CUSTOM---------------
JLabel cllabel = new JLabel("Custom Colors : ");
cllabel.setBounds(30, 260, 100, 50);
toolBar.add(cllabel);
col = new JTextField();
col.setBounds(30, 310, 190, 30);
col.setText("#000000");
toolBar.add(col);
//------------------------------
//-----------BACKGROUNDCOLOUR-------------
back = "#FFFFFF";
JButton bc = new JButton("SET BACKGROUND");
5
bc.setBounds(30, 350, 190, 30);
toolBar.add(bc);
bc.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
back = col.getText();
canvasPanel.setBackground(Color.decode(back));
}
});
//---------------------------------
//---------SIZE------------------
JLabel szlabel = new JLabel("Size : ");
szlabel.setBounds(30, 380, 100, 50);
toolBar.add(szlabel);
JButton sub = new JButton("-");
sub.setBounds(30, 415, 50, 30);
toolBar.add(sub);
sz = new JTextField();
sz.setBounds(100, 415, 50, 30);
sz.setText("5");
toolBar.add(sz);
JButton add = new JButton("+");
add.setBounds(170, 415, 50, 30);
toolBar.add(add);
sub.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
sz.setText(Integer.parseInt(sz.getText())-1+"");
}
});
add.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
sz.setText(Integer.parseInt(sz.getText())+1+"");
}
});
//-------------------------------
//---------PAINT&ERASE-----------------
JButton brush = new JButton("BRUSH");
brush.setBounds(30, 465, 80, 30);
toolBar.add(brush);
JButton erase = new JButton("ERASE");
erase.setBounds(140, 465, 80, 30);
toolBar.add(erase);
prev = "#000000";
brush.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
col.setText(prev);
}
6
});
erase.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if(!col.getText().equals(back))
prev = col.getText();
col.setText(back);
}
});
//--------------------------------
//-----------CLEAN--------------
JButton clean = new JButton("CLEAN");
clean.setBounds(30, 515, 190, 30);
toolBar.add(clean);
clean.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
canvasPanel.removeAll();
canvasPanel.repaint();
}
});
//-------------------------------
//-----------SAVE---------------
JButton save = new JButton("SAVE");
save.setBounds(30, 555, 190, 30);
toolBar.add(save);
save.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String tm = java.time.LocalTime.now()+"";
tm = tm.substring(0, 2) + tm.substring(3, 5) + tm.substring(6,
8) + tm.substring(9, 12) + ".png";
try {
BufferedImage image = getImg(canvasPanel);
ImageIO.write(image, "png", new File(tm));
}
catch(Exception ex) {
}
}
});
//-------------------------------
//------FRAME------------------
frame.setSize(1250, 700);
frame.setLocationRelativeTo(null);
frame.setLayout(null);
frame.getContentPane().setBackground(Color.decode("#001122"));
frame.setVisible(true);
frame.setResizable(false);
7
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
//---------------------------------
}
//---------MOUSE FUNCTIONS---------------------
@Override
public void mouseDragged(MouseEvent e) {
String cl = col.getText();
int rad = Integer.parseInt(sz.getText());
Graphics grap = canvasPanel.getGraphics();
grap.setColor(Color.decode(cl));
grap.fillRect(e.getX(), e.getY(), rad, rad);
}
@Override
public void mouseMoved(MouseEvent e) {
}
//-------------------------------------------------
8
Proposed System Outputs
9
CONCLUSION
In conclusion, the Java-based drawing application project embodies a robust and user-
innovation. The project's success lies in its adept utilization of Java's versatile
features, providing a responsive and intuitive environment for users to unleash their
facilitated the creation of a modular and scalable system, allowing for easy addition of
Furthermore, the project's emphasis on user experience is evident through its well-
designed graphical interface, offering a wide array of drawing tools, color palettes,
drawing experience.
In essence, the Java drawing application project not only showcases the technical
prowess of Java but also demonstrates the fusion of creativity and technology. It
applications, making it a valuable tool for both developers and users alike.
10