from javax.swing import *
#from java.awt.event import *
from java.awt import *
from java.lang import *
win = JFrame("This is a frame")
win.bounds = 100,100,100,100
win.defaultCloseOperation = 3 #EXIT_ON_CLOSE
menuBar = JMenuBar()
fileMenu = JMenu("File")
menuBar.add(fileMenu);
newMenuItem = JMenuItem("New")
newMenuItem.actionPerformed=lambda event : System.out.println("Clicked on New Menu Item")
fileMenu.add(newMenuItem)
openMenuItem = JMenuItem("Open")
openMenuItem.actionPerformed=lambda event : System.out.println("Clicked on Open Menu Item")
fileMenu.add(openMenuItem)
saveMenuItem = JMenuItem("Save")
saveMenuItem.actionPerformed=lambda event : System.out.println("Clicked on Save Menu Item")
fileMenu.add(saveMenuItem)
saveMenuItem.enabled = 0 #false
win.JMenuBar = menuBar
contentPane = win.contentPane
contentPane.layout = GridLayout()
buttonOne = JButton("Button One")
buttonOne.actionPerformed=lambda event : System.out.println("Clicked on Button One")
contentPane.add(buttonOne)
buttonTwo = JButton("Button Two")
buttonTwo.actionPerformed=lambda event : System.out.println("Clicked on Button Two")
contentPane.add(buttonTwo)
buttonThree = JButton("Button Three")
buttonThree.actionPerformed=lambda event : System.out.println("Clicked on Button Three")
contentPane.add(buttonThree)
win.pack()
win.show()
No comments:
Post a Comment