【发布时间】:2011-11-15 02:30:08
【问题描述】:
我有一些 JButton 的代码:
solutionButton = new JButton("Solution");
solutionButton.setBorderPainted( false);
solutionButton.setContentAreaFilled( false );
solutionButton.setFocusPainted( false);
solutionButton.setFont( new Font("Arial",Font.BOLD,16));
solutionButton.setForeground( new Color(80,21,25));
solutionButton.setRolloverIcon(
new ImageIcon(getClass().getResource( "images/game.png")));
solutionButton.setRolloverEnabled( true );
add(solutionButton);
如果我只是简单地设置图标,它就可以正常工作,我会看到图标。如果我执行上述操作并尝试设置鼠标悬停图标,当我将鼠标悬停在按钮上时,我看不到任何图标。
我做错了什么?
谢谢
【问题讨论】:
-
比较这个example。