# Using javax.swing import JOptionPane issues

**URL:** <https://discourse.processing.org/t/using-javax-swing-import-joptionpane-issues/43215>\
**Category:** Processing.py\
**Created:** [November 15, 2023, 10:23am UTC](https://discourse.processing.org/t/using-javax-swing-import-joptionpane-issues/43215 "2023-11-15T10:23:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dwu09](https://avatars.discourse-cdn.com/v4/letter/d/71c47a/32.png) [@dwu09](https://discourse.processing.org/u/dwu09)\
**Post date:** [November 15, 2023, 10:23am UTC](https://discourse.processing.org/t/using-javax-swing-import-joptionpane-issues/43215/1 "2023-11-15T10:23:18Z")

</div>

Hi,

trying to use the JOptionpane in Processing and get following message:

java.lang.reflect.InaccessibleObjectException: Unable to make public abstract javax.swing.TransferHandler javax.swing.TransferHandler$HasGetTransferHandler.getTransferHandler() accessible: module java.desktop does not “opens javax.swing” to unnamed module @256216b3

Anyone knows how to fix this?

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [November 15, 2023, 3:34pm UTC](https://discourse.processing.org/t/using-javax-swing-import-joptionpane-issues/43215/2 "2023-11-15T15:34:34Z")

</div>

May we see the source code that generates this error message?

---

<div class="post-metadata">

**Author:** ![dwu09](https://avatars.discourse-cdn.com/v4/letter/d/71c47a/32.png) [@dwu09](https://discourse.processing.org/u/dwu09)\
**Post date:** [November 15, 2023, 3:41pm UTC](https://discourse.processing.org/t/using-javax-swing-import-joptionpane-issues/43215/3 "2023-11-15T15:41:55Z")

</div>

Sure, this is the code:

import json  
from javax.swing import JOptionPane

parteifarben = {  
1: color(30,144,255), #FDP  
2: color(255,97,3), #CVP  
3: color(235,0,0), #SP  
4: color(34,139,34), #SVP  
5: color(255,215,0), #EVP  
6: color(255,0,0), #PdA/Sol.  
7: color(0,255,0), #Grüne  
8: color(214,214,214), #EDU  
9: color(0,0,255), #Lega  
10: color(0,205,0), #GLP  
11: color(0,0,0) #BDP  
}

parteinamen = {  
1: “FDP”,  
2: “CVP”,  
3: “SP”,  
4: “SVP”,  
5: “EVP”,  
6: “PdA”,  
7: “GPS”,  
8: “EDU”,  
9: “LEGA”,  
10: “GLP”,  
11: “BDP”  
}

def setup():  
size(500, 500)  
background(255, 255, 255)  
f = open(‘nrw\_test.json’)  
global data  
global kanton  
data = json.load(f)  
kanton = input(‘Bitte geben Sie den Kantonsnamen auf Deutsch ein:’)

def draw():  
background(255, 255, 255)  
fill(0, 0, 0)  
textSize(18)  
text(kanton, 40, 70)  
xPos = 30  
for datensatz in range (0,189):  
anzahl = data[datensatz][“anzahl\_gewaehlte”]  
if data[datensatz][“kanton\_bezeichnung”] == kanton:  
if data[datensatz][“anzahl\_gewaehlte”] \> 0:  
fill(parteifarben[data[datensatz][“partei\_id”]])  
figur(xPos, 350, anzahl_8)  
textSize(13)  
text(data[datensatz][“anzahl\_gewaehlte”],xPos + anzahl_3,370)  
for z in range (1,12):  
if data[datensatz][“partei\_id”] == z:  
fill(parteifarben[z])  
text(parteinamen[z],xPos + anzahl_3,430)  
rect(xPos + anzahl_3,400,10,10)  
else:  
pass  
xPos = xPos + anzahl\*8 + 20  
else:  
pass  
else:  
pass

def input(message):  
return JOptionPane.showInputDialog(frame, message)

def figur(xPos, yPos, anzahl):  
triangle(xPos, yPos, xPos + anzahl, yPos, xPos + anzahl/2, yPos - anzahl\*1.5)  
circle(xPos + anzahl/2, yPos - anzahl/0.7, anzahl/1.5)

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [November 15, 2023, 4:00pm UTC](https://discourse.processing.org/t/using-javax-swing-import-joptionpane-issues/43215/4 "2023-11-15T16:00:39Z")

</div>

Are you using ‘Python’?

---

<div class="post-metadata">

**Author:** ![dwu09](https://avatars.discourse-cdn.com/v4/letter/d/71c47a/32.png) [@dwu09](https://discourse.processing.org/u/dwu09)\
**Post date:** [November 15, 2023, 4:11pm UTC](https://discourse.processing.org/t/using-javax-swing-import-joptionpane-issues/43215/5 "2023-11-15T16:11:49Z")

</div>

Yeah, exactly using Python on processing

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [November 15, 2023, 4:30pm UTC](https://discourse.processing.org/t/using-javax-swing-import-joptionpane-issues/43215/6 "2023-11-15T16:30:28Z")

</div>

There are some members in this forum who use Python mode and I will defer to them.

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [November 15, 2023, 4:33pm UTC](https://discourse.processing.org/t/using-javax-swing-import-joptionpane-issues/43215/7 "2023-11-15T16:33:19Z")

</div>

[how-to-use-input-with-python-processing-running-on-a-mac](https://Forum.Processing.org/two/discussion/23646/how-to-use-input-with-python-processing-running-on-a-mac)
