Skip to content

JPypeDemoDoesn'tRun #471

Closed Answered by vsquared
vsquared asked this question in Q&A
Jun 3, 2024 · 3 comments · 11 replies
Discussion options

You must be logged in to vote

AppHelper is the key to running this on a Mac:

import jpype
import jpype.imports

jpype.startJVM()

import java
import javax
from javax.swing import *
from PyObjCTools import AppHelper

def buildWnd():
    print("buildWnd called.")
    print("frame in buildWnd =",frame)
    btn = javax.swing.JButton("Button")
    btn.setBounds(30,60,100,24)
    frame.add(btn)
    frame.setVisible(True)
    print("btn =",btn)
    print("EDT =",javax.swing.SwingUtilities.isEventDispatchThread())
    print("Done in buildWnd.")
    
def main():
    global frame

    frame = javax.swing.JFrame("Swing EDT")
    frame.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE)
    frame.setBounds(100,100,400,400)…

Replies: 3 comments 11 replies

Comment options

You must be logged in to vote
6 replies
@vsquared
Comment options

@villares
Comment options

@hx2A
Comment options

@vsquared
Comment options

@hx2A
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by villares
Comment options

You must be logged in to vote
5 replies
@villares
Comment options

@villares
Comment options

@vsquared
Comment options

@villares
Comment options

@vsquared
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants