java swing打印窗体的位置,javaswing打印窗体,package cn.opackage cn.outofmemory.snippets.desktop;import java.awt.event.ComponentEvent;import java.awt.event.ComponentListener;import javax.swing.JFrame;public class WidowPosition extends JFrame implements ComponentListener { public WidowPosition() { addComponentListener(this); setSize(410, 300); setLocationRelativeTo(null); setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true); } @Override public void componentResized(ComponentEvent event) { } @Override public void componentMoved(ComponentEvent event) { int x = event.getComponent().getX(); int y = event.getComponent().getY(); System.out.println("x: " + x); System.out.println("y: " + y); } @Override public void componentShown(ComponentEvent event) { } @Override public void componentHidden(ComponentEvent event) { } public static void main(String[] args) { new WidowPosition(); }}
java swing 位置,java swing打印窗体的位置,javaswing打印窗体,package cn.o
最新推荐文章于 2024-07-13 02:21:37 发布