SHARE
TWEET

Untitled

a guest Oct 20th, 2017 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/jython
  2. from javax.swing import JButton, JFrame, JPanel, WindowConstants, JTextArea
  3. from java.awt import GridLayout, Component, BorderLayout, FlowLayout
  4.  
  5. class Display(object):
  6.     def __init__(self):
  7.         self.frame = JFrame('COBOL Code Analyzer',
  8.                            defaultCloseOperation = WindowConstants.EXIT_ON_CLOSE)
  9.         self.frame.size = (800,300)
  10.         self.frame.layout = GridLayout(0,2,10,10)
  11.  
  12.         self.codePanel = JPanel(BorderLayout(), visible=True)
  13.         self.outputPanel = JPanel(BorderLayout(), visible=True)
  14.        
  15.         self.codeArea = JTextArea(text = 'Insert code here..', alignmentX = Component.LEFT_ALIGNMENT, wrapStyleWord = True)
  16.         self.outputArea = JTextArea(text = 'Hello world', editable = False, alignmentX = Component.LEFT_ALIGNMENT)
  17.         self.outputArea.editable = False
  18.         self.testButton = JButton('Test code', actionPerformed = self.test)
  19.         self.clearButton = JButton('Clear', actionPerformed = self.clear)
  20.  
  21.         self.codePanel.add(self.codeArea, BorderLayout.CENTER)
  22.         self.codePanel.add(self.clearButton, BorderLayout.SOUTH)
  23.         self.outputPanel.add(self.outputArea, BorderLayout.CENTER)
  24.         self.outputPanel.add(self.testButton, BorderLayout.SOUTH)
  25.  
  26.         self.frame.add(self.codePanel)
  27.         self.frame.add(self.outputPanel)
  28.        
  29.         #self.frame.pack()
  30.         self.show()
  31.    
  32.     def test(self,event):
  33.         print 'testing button works'
  34.  
  35.     def clear(self,event):
  36.         self.codeArea.text = ''
  37.  
  38.     def show(self):
  39.         self.frame.visible = True
  40.  
  41. if __name__ == '__main__':
  42.     Display()
RAW Paste Data
Top