ZKX's LAB

java 获取中心坐标点 java怎样获取鼠标在屏幕的坐标

2020-10-10知识10

java窗体坐标获取 给你一个简单的例子吧,自己刚写的,看看是不是你想要的吧。import java.awt.event.*;import java.awt.*;import javax.swing.JFrame;public class GetSize_Test extends JFrame implements ActionListener{static GetSize_Test frame=null;param argspublic GetSize_Test(){addWindowListener(new WindowDestroyer());this.getContentPane();setTitle(\"Welcome。setBounds(300,200,400,300);setVisible(true);}private void getFrameSize(){Rectangle test=frame.getBounds();System.out.println(\"窗体的坐标:(\"+test.x+\",\"+test.y+\")\");System.out.println(\"窗体的大小(高,宽):(\"+test.height+\",\"+test.width+\")\");}public class WindowDestroyer extends WindowAdapter {public void windowClosing(WindowEvent e){System.exit(0);}}public void actionPerformed(ActionEvent e){}public static void main(String[]args){frame=new GetSize_Test();frame.getFrameSize();}}既然获取了A的坐标那么直接B.setBounds(test.x,test.x,int i,int j);就行了啊。

java怎样获取鼠标在屏幕的坐标 public void mousePosition(MouseEvent me){mouseX=me.getX();mouseY=me.getY();}或者试试下面这个:public void mousePosition(MouseEvent me){mouseX=me.getXOnScreen();mouseY=me.getYOnScreen();}当然,mouseX、mouseY是要提前定义好的,用来存储鼠标当前的XY坐标,然后调用mouseX和mouseY,你想干嘛就干嘛了

用java怎么获得一张图片上的一个文字的坐标点 求高手解答 /提示:坐标依次打印在命令符窗口提示:坐标依次打印在命令符窗口提示:坐标依次打印在命令符窗口不就是监听鼠标事件吗?import javax.swing.*;import java.awt.*;import java.awt.event.*;import javax.swing.border.Border;我想建立个界面,可以加载本机中图片。加载后可以通过鼠标点击获得图片上任意点坐标。提问者:sunny929929-试用期 一级public class MyPicture extends JFrame implements MouseListener{private JLabel tipLabel;main()public static void main(String[]args){MyPicture frame=new MyPicture();frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.setVisible(true);}constructorpublic MyPicture(){setSize(800,600);根据要求调整大小setLocation(100,100);setTitle(\"获得图片上任意点坐标\");setResizable(false);Container con=getContentPane();ImageIcon bgIcon=new ImageIcon(\"bgpic.jpg\");注意图片的路径ImagePanel backpicPanel=new ImagePanel(bgIcon);backpicPanel.addMouseListener(this);con.add(backpicPanel,BorderLayout.CENTER);tipLabel=new JLabel(\"-提示:坐标依次打印在屏幕上。con.add(tipLabel,。

JAVA 如何获取HTML节点的具体坐标。 用js取得div的offset然后http请求传给java…基本原理都没搞懂

java获取一条线的中间点坐标 这样啊。比如坐标(0,0)(a,b).取b个点的坐标。String[][]zb=new String[][];for(inti=0;i<;(int)a;i+){zb[i]=[i][b/a*i]}

#窗体

随机阅读

qrcode
访问手机版