commit 1cf7f495f30eca6280d958ed76009deedd0f2df0 parent a4a75a9ec2204d6f1132fa6781988a9947278c11 Author: Tomas Hlavaty <tom@logand.com> Date: Thu, 2 Dec 2010 21:31:21 +0100 more imports in swing.l and swing9.l example added Diffstat:
M | swing.l | | | 5 | +++-- |
A | swing9.l | | | 28 | ++++++++++++++++++++++++++++ |
2 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/swing.l b/swing.l @@ -1,7 +1,8 @@ (import javax.swing JFrame JButton JLabel JTextField JPanel JComboBox BoxLayout BorderFactory ImageIcon JTable JScrollPane Box JCheckBox JColorChooser JComboBox JDialog JFileChooser JList JMenu JMenuBar JMenuItem JProgressBar JRadioButton - JSeparator JSplitPane JTabbedPane JTextField JToolBar JTree SwingConstants ) + JSeparator JSplitPane JTabbedPane JTextField JToolBar JTree SwingConstants + Timer ) (import javax.swing.table DefaultTableModel) (import java.awt Container BorderLayout GridLayout) -(import java.awt.event ActionListener) +(import java.awt.event ActionListener MouseListener) diff --git a/swing9.l b/swing9.l @@ -0,0 +1,28 @@ +# implements http://rosettacode.org/wiki/Animation#Java.2FSwing +# TODO implement 'rot' and 'do' + +(load "swing.l") + +(de mouse (E) + (when (= "mouseClicked" E) + (println E) + #(setq Dir (if (= 1 Dir) 12 1)) + ) ) + +(de timer (E) + (println E) + #(L 'setText (pack (do Dir (rot Text)))) + ) + +(setq + Dir 1 + Text (chop "Hello World! ") + F (jnew JFrame "Animation") + L (jnew JLabel (pack Text)) + A (jproxy NIL 'timer ActionListener) ) + +(L 'addMouseListener (jproxy NIL 'mouse MouseListener)) +(F 'add L) +(F 'pack) +(F 'show) +((jnew Timer 200 A) 'start)