[問題] 有關JMF截圖問題

看板java作者 (膩了新鮮感)時間16年前 (2009/10/27 13:15), 編輯推噓2(207)
留言9則, 4人參與, 最新討論串1/1
這是片段的程式碼 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

10/27 13:40, , 1F
錯誤訊息呢? 不然違反版規喔....
10/27 13:40, 1F
※ 編輯: needFresh 來自: 122.122.146.55 (10/27 13:59)

10/27 13:59, , 2F
感謝提醒
10/27 13:59, 2F

10/27 14:24, , 3F
唉... 這樣有什麼用? 沒人知道 120 行在哪裡?
10/27 14:24, 3F

10/27 14:38, , 4F
我有說是指向FrameGrabbingControl...
10/27 14:38, 4F

10/27 16:41, , 5F
所以是getControl return了null?您有去查api嗎?
10/27 16:41, 5F

10/27 19:14, , 6F
查過了 是它的func. "getFrame()"回傳null的樣子
10/27 19:14, 6F

10/27 19:58, , 7F
無法理解= ="func. "getFrame()"未出現在內文中...
10/27 19:58, 7F

10/27 21:01, , 8F
糟糕我打錯了!! 是grabFrame() 真是抱歉= =a
10/27 21:01, 8F

10/28 14:58, , 9F
會不會...import根本沒定義...(應該不會吧?)
10/28 14:58, 9F
文章代碼(AID): #1Ave7pa8 (java)