JFrame frame = new JFrame("title");
..........//JFrame 得其他处理
JDesktopPane desktop = new JDesktopPane();
MyInternalFrame myframe = new MyInternalFrame();
myframe.setVisible(true); //necessary as of 1.3
desktop.add(myframe);
try {
frame.setSelected(true);
} catch (java.beans.PropertyVetoException e) {}
}
frame.getContentPane().add(desktop,BorderLayout.CENTER);class MyInternalFrame extends JInternalFrame
{
MyInternaleFrame()
{
super("title",true,true,true);
setSize(300,400);
setLocation(400,400);
addMouseListener(new MyMouseListener());
addMouseMotionListener(new MyMouseListener());}}如何在MyInternalFrame中响应鼠标事件? 我是如上面得程序注册鼠标监听器,可是不能响应鼠标事件啊?
请帮帮忙
..........//JFrame 得其他处理
JDesktopPane desktop = new JDesktopPane();
MyInternalFrame myframe = new MyInternalFrame();
myframe.setVisible(true); //necessary as of 1.3
desktop.add(myframe);
try {
frame.setSelected(true);
} catch (java.beans.PropertyVetoException e) {}
}
frame.getContentPane().add(desktop,BorderLayout.CENTER);class MyInternalFrame extends JInternalFrame
{
MyInternaleFrame()
{
super("title",true,true,true);
setSize(300,400);
setLocation(400,400);
addMouseListener(new MyMouseListener());
addMouseMotionListener(new MyMouseListener());}}如何在MyInternalFrame中响应鼠标事件? 我是如上面得程序注册鼠标监听器,可是不能响应鼠标事件啊?
请帮帮忙
解决方案 »
- 想做一个悬浮框,置顶于桌面(悬浮于任何桌面显示的东西之上),用Swing,请问如何写?
- Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
- Swing JButton 计算器
- java socket 访问网络返回乱码,请高手指点。
- TOMCAT如何安装
- 内部类继承问题
- 怎么重命名文件 在线等待
- 如何使用JList添加记录项????
- JBuilder中连接Employee.jds的密码和用户名
- (SOS 在线等待,马上给分)Java -D用法问题
- JDK1.4.2能在Mac OS 9.0下运行吗?
- HP-UX下,File类的getName()为何方法无法识别反斜杠"\\"分隔的路径?
你要实现什么效果出来哦?
我试着把InternalFrame加在了JFrame的中央(CENTER),然后在JFrame的北部(NORTH)加了工具兰。
我又创建了一个类派生自JPanel,用来在它上面画图,然后将此类加在InternalFrame中,可是画图时连工具栏也画出来了。
还有一个问题是:派生自JComponent的类不能设置背景颜色,怎么回事啊?
唉,面对庞大的Swing体系结构,不理解其中底层的机理,进行编程真是寸步难行啊。哪里有什么讲述Swing各个类的深层含义的资料吗?