在 Eclipse 中运行 JAVA 应用程序时,会显示 JFrame 标题,但在运行导出的 JAR 文件时,框架上没有显示标题。
public void mouseMoved(MouseEvent e) {
f.setTitle("X: " + location.x + " , Y: " + location.y);
recenterMouse();
}
public void init() {
// add frame
f = new JFrame("Muis Meet");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setSize(screensizex, screensizey);
f.getContentPane().add(this, FlowLayout.LEFT);
f.setVisible(true);
centerLocation.x = getWidth() / 2;
centerLocation.y = getHeight() / 2;
recenterMouse();
addMouseListener(this);
addMouseMotionListener(this);
}
public static void main(String[] args) {
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
MuisMeet muismeet = new MuisMeet();
muismeet.init();
}});
}
@Override
public void mousePressed(MouseEvent arg0) {
recenterMouse();
location.x = 0;
location.y = 0;
f.setTitle("X: 0 , Y: 0");
}
}