gui-test.scm 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. (require 'swing-gui)
  2. (define test-image
  3. (image-read "http://nelsoncove.us/NC-USGS-topo.jpg"))
  4. ;(define test-image
  5. ; (image-read "file:///home/charles/Projects/kawa/testsuite/NC-USGS-topo.jpg"))
  6. (define Yes-button :: <gnu.kawa.models.Button>
  7. (Button text: "Yes"
  8. action: (lambda (e)
  9. (*:setText Yes-button "Yes!")
  10. (format #t "Yes button pressed!~%~!"))))
  11. (define p3 (polygon 0+0i 0+80i 150+20i))
  12. (define oval (java.awt.geom.Ellipse2D$Float:new 10.0 10.0 50.0 30.0))
  13. (define fill-p3 (fill p3))
  14. (define draw-p3 (draw p3))
  15. (define text-field-1 (gnu.kawa.models.Text "Hello ..."))
  16. ;(set! Yes-button p3)
  17. (run-application
  18. (Window title: "Kawa GUI Test"
  19. #|
  20. menubar: (menubar
  21. (menu label: "File"
  22. (menuitem label: "New"
  23. oncommand: (lambda (e)
  24. (format #t "New menuitem pressed!~%~!")))
  25. (menuitem label: "Close"
  26. oncommand:
  27. (lambda (e)
  28. (format #t "Close menuitem pressed!~%~!")
  29. (exit))))
  30. (menu label: "Edit"
  31. (menuitem label: "Cut"
  32. oncommand: (lambda (e)
  33. (format #t "Cut menuitem pressed!~%~!")))))
  34. |#
  35. (Row
  36. draw-p3
  37. (Column
  38. text-field-1
  39. Yes-button
  40. text-field-1
  41. Yes-button)
  42. (scroll (Image test-image) h: 200 w: 200)
  43. (with-composite
  44. (with-paint color-red fill-p3)
  45. (composite-src-over 0.5)
  46. (fill oval))
  47. (with-composite draw-p3
  48. (with-transform (rotation -0.5)
  49. fill-p3))))
  50. )