Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.*;
- import java.awt.*;
- public class Koordi extends JFrame {
- public Koordi (){
- setTitle ("ponovitev");
- setSize (1000,1000);
- setResizable (false);
- setDefaultCloseOperation (EXIT_ON_CLOSE);
- setVisible (true);
- }
- public void paint (Graphics g){
- g.drawRect(300 , 300, 400, 400);
- g.drawLine(0, 500, 1000, 500);
- g.drawLine(500, 0, 500, 1000);
- }
- public static void main (String []args){
- Koordi p = new Koordi ();
- while (true){
- Point e = MouseInfo.getPointerInfo().getLocation();
- int x = e.x;
- int y = e.y;
- System.out.println ("x koordinata je " +x +" y pa " +y);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement