View Javadoc
1 /* 2 * $Id: SequenceAcessor.java,v 1.2 2003/04/02 19:49:02 austvold Exp $ 3 * Copyright 2003 OErjan Nygaard Austvold. All rights reserved. 4 */ 5 6 package com.zanthan.sequence; 7 8 import javax.swing.*; 9 import java.awt.event.WindowAdapter; 10 import java.awt.event.WindowEvent; 11 import java.awt.*; 12 13 /*** 14 * 15 * <p>Changelog: 16 * <pre> 17 * $Log: SequenceAcessor.java,v $ 18 * Revision 1.2 2003/04/02 19:49:02 austvold 19 * Minor updates. Mostly adaptation to new event and eventlistener name. 20 * General brush-up on javadoc comments. 21 * Removal of auto-added revision and date-of-commit members. 22 * 23 * Revision 1.1.1.1 2003/03/28 08:18:23 austvold 24 * Initial import. 25 * 26 * </pre> 27 * 28 * @author Ørjan Nygaard Austvold <austvold@acm.org> 29 * @version $Id: SequenceAcessor.java,v 1.2 2003/04/02 19:49:02 austvold Exp $ 30 */ 31 public class SequenceAcessor { 32 private static Model model; 33 private static Display display; 34 35 public static void appendModelText(final String text) { 36 final String s = model.getText(); 37 model.setText(s + text, s); 38 SwingUtilities.invokeLater(new Runnable() { 39 public void run() { 40 display.modelTextChanged(new ModelTextEvent(s, s + text)); 41 } 42 }); 43 } 44 45 public static void launchSequence() { 46 model = new Model(); 47 model.setText(" ", model); 48 49 // copied from com.zanthan.sequence.Display to allow access to 50 // the model object 51 JFrame frame = new JFrame("FrameDemo"); 52 frame.addWindowListener(new WindowAdapter() { 53 public void windowClosing(WindowEvent e) { 54 System.exit(0); 55 } 56 }); 57 display = new Display(model); 58 frame.getContentPane().add(new JScrollPane(display, 59 JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, 60 JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS), 61 BorderLayout.CENTER); 62 63 frame.pack(); 64 frame.setSize(new Dimension(300, 300)); 65 frame.setVisible(true); 66 67 display.init(model.getText()); 68 } 69 }

This page was automatically generated by Maven