private void showTipPopupMenu(String msg, int x, int y, int time) {
if (tipPopupMenu == null) {
tipPopupMenu = new JPopupMenu("Tip");
tipPopupMenu.setBorder(BorderFactory.createLineBorder(Color.black));
tipPopupMenu.setBackground(SystemColor.info);
JLabel l = new JLabel(msg);
l.setFont(new Font(null, Font.PLAIN, 10));
l.setBorder(BorderFactory.createEmptyBorder(2, 4, 2, 4));
tipPopupMenu.add(l);
} else {
((JLabel) tipPopupMenu.getComponent(0)).setText(msg);
}
tipPopupMenu.show(this, x, y);
if (time > 0) {
Timer timer = new Timer(time, new ActionListener() {
public void actionPerformed(ActionEvent e) {
tipPopupMenu.setVisible(false);
}
});
timer.setRepeats(false);
timer.setInitialDelay(time);
timer.start();
}
}
View2D.java 文件源码
java
阅读 20
收藏 0
点赞 0
评论 0
项目:energy2d
作者:
评论列表
文章目录