!636 !actionListener { static boolean showPicture = true; // global switch. if false, you get the normal text display instead of the smiley static L emotions = litlist( "#1001283", "happy", "#1001284", "unhappy", "#1001285", "oh", "#1001286", "bored", "#1001287", "wide mouth"); static int borderColor = 0xFFFFFFFF; static S lastEmotion; static JFrame emo_frame; static ImageSurface img; static JTextField textField; static void emo(S emotion) { if (!showPicture) return; if (emo_frame == null) { emo_frame = new JFrame("Leo vx"); img = new ImageSurface(); img.setImage(loadImage(emotions.get(0))); textField = new JTextField(); textField.addActionListener(actionListener { textField.selectAll(); handleText(textField.getText()); }); emo_frame.getContentPane().setLayout(new BorderLayout); emo_frame.getContentPane().add(BorderLayout.CENTER, img); emo_frame.getContentPane().add(BorderLayout.SOUTH, textField); emo_frame.pack(); centerFrame(emo_frame); emo_frame.setVisible(true); } int i; for (i = 0; i < emotions.size(); i += 2) if (emotions.get(i+1).equalsIgnoreCase(emotion)) break; if (i >= emotions.size()) { print("Emotion not found: " + emotion); // use the last one from the list as default i -= 2; } lastEmotion = emotions.get(i+1); img.setImage(loadImage(emotions.get(i))); } static void setBorderColor(int color) { } static void happy() { emo("happy"); } static void unhappy() { emo("unhappy"); } static void oh() { emo("oh"); } static void bored() { emo("bored"); } static void wideMouth() { emo("wide mouth"); } static void disappear() { happy(); if (emo_frame != null) { emo_frame.dispose(); emo_frame = null; } swingLater(1000, runnable { img.setImage((RGBImage) null); swingLater(1000, runnable { System.exit(0); }); }); }