为什么会出现如下错误?然后怎样改正?

gongtaixiang 2009-10-29 09:49:59
// 为内部窗体添加Action的方法
private JButton createFrameButton(String fName, String cname) {
String imgUrl = "res/ActionIcon/" + fName + ".png";
String imgUrl_roll = "res/ActionIcon/" + fName + "_roll.png";
String imgUrl_down = "res/ActionIcon/" + fName + "_down.png";
Icon icon = new ImageIcon(imgUrl);
Icon icon_roll = null;
if (imgUrl_roll != null)
icon_roll = new ImageIcon(imgUrl_roll);
Icon icon_down = null;
if (imgUrl_down != null)
icon_down = new ImageIcon(imgUrl_down);
Action action = new openFrameAction(fName, cname, icon);
JButton button = new JButton(action);
button.setMargin(new Insets(0, 0, 0, 0));
button.setHideActionText(true);//出现这样的错误:The method setHideActionText(boolean) is undefined for the type JButton
button.setFocusPainted(false);
button.setBorderPainted(false);
//button.setContentAreaFilled(false);
if (icon_roll != null)
button.setRolloverIcon(icon_roll);
if (icon_down != null)
button.setPressedIcon(icon_down);
return button;
}
...全文
188 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
gongtaixiang 2009-11-01
  • 打赏
  • 举报
回复
谢谢大家了! 确是如此
sabrina1013 2009-10-30
  • 打赏
  • 举报
回复
同解
dbx915 2009-10-29
  • 打赏
  • 举报
回复
估计是JDK版本太低的问题,LZ用1.6试试吧
loveofmylife 2009-10-29
  • 打赏
  • 举报
回复
LZ从来都不结贴
看这个类的API:
从以下版本开始:
1.6
所以是你的编译器使用的JDK版本太低,估计是1.5
dajiadebeibei9 2009-10-29
  • 打赏
  • 举报
回复
jdk1.6才能使用的方法 是不是你的jdk版本不对

62,621

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧