Topic: 图片添加问题?

  Print this page

1.图片添加问题? Copy to clipboard
Posted by: jsxww2002
Posted on: 2005-03-08 07:14

我想通过点击菜单来添加一个可拖动的图片?请问这个怎么实现?

2.Re:图片添加问题? [Re: jsxww2002] Copy to clipboard
Posted by: jsxww2002
Posted on: 2005-03-08 14:47

有没有高手帮忙啊,关键的不分我不会写?????????
import java.awt.*;
import java.awt.event.*;
public class ceshi
{
public static void main(String[] args)
{
MenuFrame form = new MenuFrame();
form.setVisible(true);
}
}
class MenuFrame extends Frame implements ActionListener
{
MenuBar m_MenuBar=new MenuBar();
Menu menuFile = new Menu("文件");
MenuItem f1 = new MenuItem("添加图片");
MenuItem f2 = new MenuItem("退出");
MenuFrame()
{
super("实验");
setLayout(new FlowLayout());
m_MenuBar.add(menuFile);
menuFile.add(f1);
f1.addActionListener(this);
menuFile.add(f2);
f2.addActionListener(this);
setMenuBar(m_MenuBar);
setSize(200,300);
addWindowListener(new Tuichu());
}
public void actionPerformed(ActionEvent e)
{
if(e.getActionCommand()=="添加图片")
{
}
if(e.getActionCommand()=="退出")
{
System.exit(0);
}
}
}
class Tuichu extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923