我正在使用jFlashPlayer(目前已由VersaEdge Software停止使用)。
我在一个jWindow中显示FlashPanel,并希望在它上面放置一个glassPane来绘制flash图像,但是当FlashPanel可见时,glassPane不起作用。当FlashPanel不可见/未启动时,glassPane正常工作。
代码的相关部分如下:
public displayWindow() throws AWTException{
showOnScreen(1, this);
createFlashPanel();
glass = new JPanel()
{
public void paintComponent(Graphics g)
{
g.setColor(Color.RED);
g.fillOval(point.x, point.y, 10, 10);
}
};
glass.setOpaque(true);
this.setGlassPane(glass);
glass.setVisible(true);
}
,其中
void createFlashPanel() {
com.jpackages.jflashplayer.FlashPanel.installFlash("6");
String flashVersionRequired = "9";
try {
String flashFilePath = "FarmacistDispensaryWS.swf";
if (!com.jpackages.jflashplayer.FlashPanel.hasFlashVersion("9")) {
flashFilePath = "FarmacistDispensaryWS.swf";
flashVersionRequired = "6";
}
com.jpackages.jflashplayer.FlashPanel.setRequiredFlashVersion(flashVersionRequired);
FlashPanel = new FlashPanel(new File(flashFilePath));
} catch (JFlashLibraryLoadFailedException e) {
exitErrorr("A required library (DLL) is missing or damaged.");
} catch (FileNotFoundException e) {
exitErrorr("Failed to find SWF file specified.");
} catch (JFlashInvalidFlashException e) {
exitErrorr("Required version " + flashVersionRequired + " of Flash is not installed.");
}
this.getContentPane().add(FlashPanel, BorderLayout.CENTER);
FlashPanel.setFlashCallObject(this);
FlashPanel.addFlashPanelListener(this);
FlashPanel.setVariables("myGreeting=hi&myNumber=1&myVar=good%20job");
}
(直接取自他们提供的例子)和
public static void showOnScreenn( int screen, displayWindow displayWindow )
{
GraphicsEnvironment ge = GraphicsEnvironment
.getLocalGraphicsEnvironment();
GraphicsDevice[] gs = ge.getScreenDevices();
if( screen > -1 && screen < gs.length )
{
gs[screen].setFullScreenWindow(displayWindow);
}
else if( gs.length > 0 )
{
gs[0].setFullScreenWindow( displayWindow );
}
else
{
throw new RuntimeException( "No Screens Found" );
}
}
此代码在两台显示器上运行。一个用于控制闪存文件的监视器(代码未显示),另一个用于显示它。 glassPane在另一台显示器上工作正常,并且在此监视器上工作IFF FlashPanel未启动/不可见。
Flash文件运行正常并且使用提供的代码按预期工作 - 这不是我的问题。
jFlashPlayer(库等)的所有支持文件的副本可在http://java-flash-player-jflashplayer.soft32.com
找到提前致谢!