Le but:
- faire apparaitre une fenêtre modale
- avoir autre chose qu'un simple textField
- choisir l'icône
L'appel se fait par le code suivant :
icon = shared.ITMATION.gui.getIconFromImageManagement('Builtin/icons/48/camera2.png')
options = ['Python','Java','C#','C','Ruby','Pascal','Assembly','Javascript']
print shared.ITMATION.gui.listBox(message = 'What is the best language?',
title = 'Select an Option',
icon = icon,
defaultSel = options[0],
options = options)Les fonctions 'shared.ITMATION.gui' sollicitées sont :
def listBox(message = 'What is the best language?',title = 'Select an Option', icon = None, defaultSel = '', options = None):
from javax.swing import JOptionPane
jop = JOptionPane()
messageType = -1
if options ==None:
options = ['Python','Java','C#','C','Ruby','Pascal','Assembly','Javascript']
bestLang = jop.showInputDialog(None,message,title,messageType,icon,options,defaultSel)
return bestLang
def getIconFromImageManagement(iconPath):
from java.net import URL
from javax.swing import ImageIcon
from javax.imageio import ImageIO
try:
imagePath = system.tag.read("[System]Client/Network/GatewayAddress").value+"/system/images/" + iconPath
url = URL(imagePath)
image = ImageIO.read(url)
return ImageIcon(image)
except:
return NonePlus d'info sur : https://imss-www.upmf-grenoble.fr/prevert/Prog/Java/swing/JOptionPane.html
Cet article a-t-il été utile ?
C'est super !
Merci pour votre commentaire
Désolé ! Nous n'avons pas pu vous être utile
Merci pour votre commentaire
Commentaires envoyés
Nous apprécions vos efforts et nous allons corriger l'article