How applet use external resource?

mryyzx 2003-10-03 02:26:53
I use jtree to show a tree structure to the user. Now I want to add some modification when user clicked the node. So I need to upload a gif picture to my website. When user clicked the node, the tree icon will replaced by the new gif picture.

But how I can implement this? I cannot get the resource from the applet. I have already jar the class files and the picture middle.gif in one jar file. But how I access the middle.gif in the jar file from the applet?
...全文
30 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
YuLimin 2003-10-03
  • 打赏
  • 举报
回复
u can

openFolder = new ImageIcon("button_lit.jpg");
closedFolder = new ImageIcon("button.jpg");
leafIcon = new ImageIcon("leaf.gif");

JTree tree = new JTree();
JScrollPane scrollPane = new JScrollPane(tree);
DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();

renderer.setClosedIcon(closedFolder);
renderer.setOpenIcon(openFolder);
renderer.setLeafIcon(leafIcon);

tree.setCellRenderer(renderer);
tree.setEditable(true);
getContentPane().add(scrollPane);

62,614

社区成员

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

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