jpypeでswing
- javaのコード
http://www.hellohiro.com/swing.htm
import javax.swing.*; public class HelloWorldSwing { public static void main(String[] args) { JFrame frame = new JFrame("HelloWorldSwing"); final JLabel label = new JLabel("Hello World"); frame.getContentPane().add(label); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); } }
- jpypeでのソース
from jpype import startJVM, getDefaultJVMPath, JPackage, shutdownJVM startJVM(getDefaultJVMPath()) JFrame = JPackage('javax').swing.JFrame JLabel = JPackage('javax').swing.JLabel frame = JFrame('HelloWorldSwing') label = JLabel("Hello World") frame.getContentPane().add(label) frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) frame.pack() frame.setVisible(True) shutdownJVM()