IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası

IRCForumları - IRC ve mIRC Kullanıcılarının Buluşma Noktası (https://www.ircforumlari.net/)
-   JavaScript (https://www.ircforumlari.net/javascript/)
-   -   Fareyi Kullanarak Resim Çizmek (https://www.ircforumlari.net/javascript/689587-fareyi-kullanarak-resim-cizmek.html)

Kaf_Dağı 18 Mart 2015 14:53

Fareyi Kullanarak Resim Çizmek
 
Kod:

public class MousePaint extends Frame implements MouseMotionListener
{
private int x1, y1, x2, y2;
public MousePaintII()
{
addWindowListener(new WindowAdapter()
{
public **** windowClosing(WindowEvent we)
{
dispose();
System.exit(0);
}
});
addMouseMotionListener(this);
setBounds(50,50,400,250);
setVisible(true);
}
public static **** main(String[] argv)
{
new MousePaintII();
}
public **** update(Graphics g)
{
paint(g);
}
public **** paint(Graphics g)
{
g.setColor(Color.black);
g.drawLine(x1, y1, x2, y2);
}
public **** mouseDragged(MouseEvent me)
{
me.consume();
int x = me.getX();
int y = me.getY();
if ( x1 == 0 )
{
x1 = x;
}
if ( y1 == 0 )
{
y1 = y;
}
x2 = x;
y2 = y;
repaint();
x1 = x2;
y1 = y2;
}
public **** mouseMoved(MouseEvent me)
{ }
}



Tüm Zamanlar GMT +3 Olarak Ayarlanmış. Şuanki Zaman: 04:58.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO
Copyright ©2004 - 2025 IRCForumlari.Net Sparhawk