Here is a code snippet to add look and feel using java's UIManager in jython.
Add this snippet to your code and then reference it in your class __init__ function.
Example
from javax.swing import UIManager
class App:
def __init__(self):
setTheme("Nimbus") #If none specified it uses default LAF
#...Rest of code
#ADD THIS FUNCTION
def setTheme(theme=None):
lookAndFeel = None
for info in UIManager.getInstalledLookAndFeels():
if info.getName() == theme:
lookAndFeel = info.getClassName()
if lookAndFeel:
UIManager.setLookAndFeel(lookAndFeel)
else:
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName())
Comments
Post a Comment