#!/usr/bin/env jython import java.lang as lang import javax.swing as swing import java.awt as awt import os import sys import glob class SimpleFlashExample(swing.JPanel): def __init__(self): swing.JPanel(awt.BorderLayout()) from chrriis.common import UIUtils from chrriis.dj.nativeswing.swtimpl import NativeInterface from chrriis.dj.nativeswing.swtimpl.components import JFlashPlayer flashPlayer = JFlashPlayer() flashPlayer.load(getClass(), "resource/Movement-pointer_or_click.swf") add(flashPlayer, awt.BorderLayout.CENTER) def launch(self): UIUtils.setPreferredLookAndFeel() NativeInterface.open() swing.SwingUtilities.invokeLater(FlashThread()) NativeInterface.runEventPump() class FlashThread(lang.Runnable): def run(this): frame = swing.JFrame("DJ Native Swing Test") frame.setDefaultCloseOperation(swing.JFrame.EXIT_ON_CLOSE) frame.getContentPane().add(SimpleFlashExample(), awt.BorderLayout.CENTER) frame.setSize(800, 600) frame.setLocationByPlatform(True) frame.setVisible(True) def set_classpath(libDir): """ Add Jython .jar files to the classpath. """ classPaths = glob.glob('%s%s*.jar' % (libDir, os.sep)) for classPath in classPaths: sys.path.append(classPath) if __name__ == "__main__": libDir = "DJNativeSwing-SWT-0-9-8" set_classpath(libDir) app = SimpleFlashExample() app.launch()