Advertisement
Guest User

Untitled

a guest
Oct 10th, 2014
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. import javax.swing.*;
  2.  
  3. import java.awt.*;
  4.  
  5. public class Koordi extends JFrame {
  6.  
  7. public Koordi (){
  8.  
  9. setTitle ("ponovitev");
  10. setSize (1000,1000);
  11. setResizable (false);
  12. setDefaultCloseOperation (EXIT_ON_CLOSE);
  13. setVisible (true);
  14.  
  15. }
  16.  
  17. public void paint (Graphics g){
  18. g.drawRect(300 , 300, 400, 400);
  19. g.drawLine(0, 500, 1000, 500);
  20. g.drawLine(500, 0, 500, 1000);
  21. }
  22. public static void main (String []args){
  23.  
  24. Koordi p = new Koordi ();
  25.  
  26. while (true){
  27.  
  28. Point e = MouseInfo.getPointerInfo().getLocation();
  29. int x = e.x;
  30. int y = e.y;
  31. System.out.println ("x koordinata je " +x +" y pa " +y);
  32.  
  33. }
  34. }
  35.  
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement