import java.net.URL;
import java.awt.Toolkit;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Image;
import javax.swing.JFrame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Random;
import java.awt.Rectangle;
import java.awt.GraphicsEnvironment;
import java.awt.GraphicsDevice;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.MouseEvent;
import javax.swing.*;
import java.awt.Robot;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.Image;
class Borrado extends JFrame implements MouseListener, MouseMotionListener{
Image img;
Random r;
GraphicsDevice grafica;
int Alto,Ancho;
int xi=200,yi=200,xf,yf;
Toolkit toolkit;
Dimension dq;
Robot rob;
// Image img;
public Borrado(){
try{
toolkit = Toolkit.getDefaultToolkit();
dq = toolkit.getScreenSize();
rob = new Robot();
img = rob.createScreenCapture(new Rectangle(dq));
}
catch(Exception e){}
Toolkit tk = Toolkit.getDefaultToolkit();
Dimension d = tk.getScreenSize();
Alto = d.height;
Ancho = d.width;
setUndecorated(false);
addMouseMotionListener(this);
grafica= GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
grafica.setFullScreenWindow(this);
setTitle("Borrado");
setVisible(true);
addWindowListener(wa);
r=new Random();
refrescar();
}
public void mouseClicked( MouseEvent evento ){}
public void mousePressed( MouseEvent evento ){}
public void mouseReleased( MouseEvent evento ){}
public void mouseEntered( MouseEvent evento ){}
public void mouseExited( MouseEvent evento ){}
public void mouseDragged( MouseEvent evento ){}
public void mouseMoved( MouseEvent evento ){
System.exit(1);
}
WindowAdapter wa=new WindowAdapter(){
public void windowClosing(WindowEvent we){
System.exit(0);
}
};
public void paint(Graphics g){
setBackground(Color.black);
g.drawImage(img, 0, 0, this);
}
public void refrescar(){
try{
Thread.sleep(1000); // Pausa de un segundo
Graphics g=getGraphics();
int ro=0;
//while(ro<800){
Graphics2D g2 = (Graphics2D) g;
g2.setStroke(new BasicStroke(15.0f));
g.setColor( Color.BLACK);
Thread.sleep(r.nextInt(300));
//xf=r.nextInt(1000);
//xf=r.nextInt(1000);
xf=300;
yf=100;
System.out.println("xi= "+xi);
System.out.println("yi= "+yi);
//g.drawArc( xi,yi,xf,yf,r.nextInt(180),r.nextInt(180));
g.drawArc( 100,100,300,300,180,180);
g.drawArc( 380,90,300,400,160,210);
//g.drawArc( 100,100,300,300,100,100);
Thread.sleep(300);
g2.setStroke(new BasicStroke(15.0f));
g.setColor( Color.RED);
//g.drawArc( xi,yi,xf,yf,90,300);
//g.drawArc( 100,100,300,300,100,100);
//g.drawLine( 0,0,300,126);
g.drawLine( 0,0,250,100);
//xi=xf;
//yi=yf;
ro++;
System.out.println("xf= " +xf);
System.out.println("yf= "+yf);
//}
}
catch (Exception e){
System.out.println("MMMM");
}
//repaint();
refrescar();
}
public static void main(String arg[]){
Borrado b=new Borrado();
}
}
import java.awt.Toolkit;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Image;
import javax.swing.JFrame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Random;
import java.awt.Rectangle;
import java.awt.GraphicsEnvironment;
import java.awt.GraphicsDevice;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.MouseEvent;
import javax.swing.*;
import java.awt.Robot;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.Image;
class Borrado extends JFrame implements MouseListener, MouseMotionListener{
Image img;
Random r;
GraphicsDevice grafica;
int Alto,Ancho;
int xi=200,yi=200,xf,yf;
Toolkit toolkit;
Dimension dq;
Robot rob;
// Image img;
public Borrado(){
try{
toolkit = Toolkit.getDefaultToolkit();
dq = toolkit.getScreenSize();
rob = new Robot();
img = rob.createScreenCapture(new Rectangle(dq));
}
catch(Exception e){}
Toolkit tk = Toolkit.getDefaultToolkit();
Dimension d = tk.getScreenSize();
Alto = d.height;
Ancho = d.width;
setUndecorated(false);
addMouseMotionListener(this);
grafica= GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
grafica.setFullScreenWindow(this);
setTitle("Borrado");
setVisible(true);
addWindowListener(wa);
r=new Random();
refrescar();
}
public void mouseClicked( MouseEvent evento ){}
public void mousePressed( MouseEvent evento ){}
public void mouseReleased( MouseEvent evento ){}
public void mouseEntered( MouseEvent evento ){}
public void mouseExited( MouseEvent evento ){}
public void mouseDragged( MouseEvent evento ){}
public void mouseMoved( MouseEvent evento ){
System.exit(1);
}
WindowAdapter wa=new WindowAdapter(){
public void windowClosing(WindowEvent we){
System.exit(0);
}
};
public void paint(Graphics g){
setBackground(Color.black);
g.drawImage(img, 0, 0, this);
}
public void refrescar(){
try{
Thread.sleep(1000); // Pausa de un segundo
Graphics g=getGraphics();
int ro=0;
//while(ro<800){
Graphics2D g2 = (Graphics2D) g;
g2.setStroke(new BasicStroke(15.0f));
g.setColor( Color.BLACK);
Thread.sleep(r.nextInt(300));
//xf=r.nextInt(1000);
//xf=r.nextInt(1000);
xf=300;
yf=100;
System.out.println("xi= "+xi);
System.out.println("yi= "+yi);
//g.drawArc( xi,yi,xf,yf,r.nextInt(180),r.nextInt(180));
g.drawArc( 100,100,300,300,180,180);
g.drawArc( 380,90,300,400,160,210);
//g.drawArc( 100,100,300,300,100,100);
Thread.sleep(300);
g2.setStroke(new BasicStroke(15.0f));
g.setColor( Color.RED);
//g.drawArc( xi,yi,xf,yf,90,300);
//g.drawArc( 100,100,300,300,100,100);
//g.drawLine( 0,0,300,126);
g.drawLine( 0,0,250,100);
//xi=xf;
//yi=yf;
ro++;
System.out.println("xf= " +xf);
System.out.println("yf= "+yf);
//}
}
catch (Exception e){
System.out.println("MMMM");
}
//repaint();
refrescar();
}
public static void main(String arg[]){
Borrado b=new Borrado();
}
}