Painting Editor/ Drawing Pad in JAVA
/**
* MakeCodeEasy
*/
import java.awt.*;
import java.awt.event.*;
public class Painting implements MouseMotionListener,MouseListener
{
Frame f;
int x,y;
int px;
int py;
int count=0;
public Painting()
{
f=new Frame();
f.setSize(400,400);
f.setVisible(true);
f.addMouseMotionListener(this);
f.addMouseListener(this);
WindowCloser wc=new WindowCloser();
f.addWindowListener(wc);
}
public void mouseDragged(MouseEvent e1)
{
}
public void mouseMoved(MouseEvent e2)
{
if(count==0)
{
x=e2.getX();
y=e2.getY();
Graphics g=f.getGraphics();
g.setColor(Color.blue);
g.drawLine(x,y,x,y);
px=x;
py=y;
count=1;
}
else
{
x=e2.getX();
y=e2.getY();
Graphics g=f.getGraphics();
g.setColor(Color.blue);
g.drawLine(px,py,x,y);
px=x;
py=y;
}
}
public void mouseClicked(MouseEvent e3)
{
}
public void mouseEntered(MouseEvent e4)
{
}
public void mouseExited(MouseEvent e5)
{
count=0;
}
public void mousePressed(MouseEvent e6)
{
count=0;
}
public void mouseReleased(MouseEvent e7)
{
}
public static void main(String args[])
{
Painting pnt=new Painting();
}
}
Output :-
/**
* MakeCodeEasy
*/
import java.awt.*;
import java.awt.event.*;
public class Painting implements MouseMotionListener,MouseListener
{
Frame f;
int x,y;
int px;
int py;
int count=0;
public Painting()
{
f=new Frame();
f.setSize(400,400);
f.setVisible(true);
f.addMouseMotionListener(this);
f.addMouseListener(this);
WindowCloser wc=new WindowCloser();
f.addWindowListener(wc);
}
public void mouseDragged(MouseEvent e1)
{
}
public void mouseMoved(MouseEvent e2)
{
if(count==0)
{
x=e2.getX();
y=e2.getY();
Graphics g=f.getGraphics();
g.setColor(Color.blue);
g.drawLine(x,y,x,y);
px=x;
py=y;
count=1;
}
else
{
x=e2.getX();
y=e2.getY();
Graphics g=f.getGraphics();
g.setColor(Color.blue);
g.drawLine(px,py,x,y);
px=x;
py=y;
}
}
public void mouseClicked(MouseEvent e3)
{
}
public void mouseEntered(MouseEvent e4)
{
}
public void mouseExited(MouseEvent e5)
{
count=0;
}
public void mousePressed(MouseEvent e6)
{
count=0;
}
public void mouseReleased(MouseEvent e7)
{
}
public static void main(String args[])
{
Painting pnt=new Painting();
}
}
Output :-
I think I will become a great follower.Just want to say your article is striking. The clarity in your post is simply striking and i can take for granted you are an expert on this subject.
ReplyDeletebar sets with stools
thanks Bryan
DeleteThanx dude.
ReplyDeleteSamsun
ReplyDeleteUrfa
Erzincan
Mersin
Kayseri
2J7
5F5D1
ReplyDeletebuy peptides
clenbuterol
Osmaniye Evden Eve Nakliyat
order deca durabolin
anapolon oxymetholone
Çerkezköy Evden Eve Nakliyat
Eskişehir Evden Eve Nakliyat
Aksaray Evden Eve Nakliyat
buy steroids
2BC43
ReplyDeleteFuckelon Coin Hangi Borsada
Tumblr Beğeni Satın Al
Sui Coin Hangi Borsada
Nexa Coin Hangi Borsada
Bitcoin Kazma Siteleri
Threads Yeniden Paylaş Hilesi
Likee App Beğeni Satın Al
Madencilik Nedir
Mexc Borsası Kimin
31431
ReplyDeleteThreads Yeniden Paylaş Satın Al
Shinja Coin Hangi Borsada
Mexc Borsası Güvenilir mi
Binance'de Kaldıraç Var mı
Mith Coin Hangi Borsada
Mexc Borsası Güvenilir mi
Threads Beğeni Hilesi
Threads Yeniden Paylaş Hilesi
Meta Coin Hangi Borsada
79934E8622
ReplyDeletetelafili takipçi satın al
Kazandırio Kodları
Razer Gold Promosyon Kodu
Kafa Topu Elmas Kodu
M3u Listesi
101 Okey Vip Hediye Kodu
Footer Link Satın Al
Google Yorum Satın Al
Kafa Topu Elmas Kodu