Sample Swing - MarkyVasconcelos/cajuscript GitHub Wiki

#summary How you can use CajuScript with Swing

=Swing=

Creating an simple window using Java Swing.

Command line:

java -jar cajuscript.jar swing.cj

swing.cj: {{{ $java.lang $javax.swing $java.awt

frame = JFrame()
frame.setTitle("CajuScript")
frame.setVisible(true)
frame.setSize(100, 100)
frame.getContentPane().setLayout(BorderLayout())

textArea = JTextArea()
textArea.setText("Hello World!")
frame.add(textArea, BorderLayout.CENTER)

button = JButton("Ok!")
frame.add(button, BorderLayout.SOUTH)

frame.pack()

frame.setSize(300, 300)

}}}