作者needFresh (腻了新鲜感)
看板java
标题[问题] 有关JMF截图问题
时间Tue Oct 27 13:15:29 2009
这是片段的程式码
private class ButtonHandler implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
// Grab a frame
// Convert it to an image
FrameGrabbingControl fgc =
(FrameGrabbingControl)playerL.getControl("javax.media.control.FrameGrabbingControl");
buf = fgc.grabFrame();
btoi = new BufferToImage((VideoFormat)buf.getFormat());
img = btoi.createImage(buf);
// show the image
imgpanelLeft.setImage(img);
imgpanelLeft.repaint();
savePNG(img,"test");
}
}
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at SwingCapture$ButtonHandler.actionPerformed(SwingCapture.java:120)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
错误讯息是指向FrameGrabbingControl
其中还有很多函式的汇入都是显示(Unknow Sorce)
想请问大家这个FrameGrabbingControl到底是什麽出现问题??
可以麻烦各位神手为我解惑吗...
这个问题我想一两个礼拜了...
麻烦大家了
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 122.122.146.55
1F:推 PsMonkey:错误讯息呢? 不然违反版规喔.... 10/27 13:40
※ 编辑: needFresh 来自: 122.122.146.55 (10/27 13:59)
2F:→ needFresh:感谢提醒 10/27 13:59
3F:推 PsMonkey:唉... 这样有什麽用? 没人知道 120 行在哪里? 10/27 14:24
4F:→ needFresh:我有说是指向FrameGrabbingControl... 10/27 14:38
5F:→ kanandg1:所以是getControl return了null?您有去查api吗? 10/27 16:41
6F:→ needFresh:查过了 是它的func. "getFrame()"回传null的样子 10/27 19:14
7F:→ kanandg1:无法理解= ="func. "getFrame()"未出现在内文中... 10/27 19:58
8F:→ needFresh:糟糕我打错了!! 是grabFrame() 真是抱歉= =a 10/27 21:01
9F:→ abruce042:会不会...import根本没定义...(应该不会吧?) 10/28 14:58