Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
31
Task/Window-creation-X11/Groovy/window-creation-x11.groovy
Normal file
31
Task/Window-creation-X11/Groovy/window-creation-x11.groovy
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import javax.swing.*
|
||||
import java.awt.*
|
||||
import java.awt.event.WindowAdapter
|
||||
import java.awt.event.WindowEvent
|
||||
import java.awt.geom.Rectangle2D
|
||||
|
||||
class WindowCreation extends JApplet implements Runnable {
|
||||
void paint(Graphics g) {
|
||||
(g as Graphics2D).with {
|
||||
setStroke(new BasicStroke(2.0f))
|
||||
drawString("Hello Groovy!", 20, 20)
|
||||
setPaint(Color.blue)
|
||||
draw(new Rectangle2D.Double(10d, 50d, 30d, 30d))
|
||||
}
|
||||
}
|
||||
|
||||
void run() {
|
||||
new JFrame("Groovy Window Demo").with {
|
||||
addWindowListener(new WindowAdapter() {
|
||||
void windowClosing(WindowEvent e) {
|
||||
System.exit(0)
|
||||
}
|
||||
})
|
||||
|
||||
getContentPane().add("Center", new WindowCreation())
|
||||
pack()
|
||||
setSize(new Dimension(150, 150))
|
||||
setVisible(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue