示例#1
0
  public static void main(String[] args) {

    MyView view = new MyView();
    MyModel model = new MyModel();

    Presenter presenter = new Presenter(model, view);
    model.addObserver(presenter);
    view.addObserver(presenter);
    view.start();
  }
示例#2
0
  public static void main(String[] args) {

    MyModel m = new MyModel();
    MyView v = new MyView();
    MazeClientHandler ch = new MazeClientHandler();
    ServerWindow sw = new ServerWindow(235, 80, "Maze Server");
    Presenter p = new Presenter(m, v, ch, sw);
    m.addObserver(p);
    v.addObserver(p);
    ch.addObserver(p);
    sw.addObserver(p);
    sw.run();
  }
示例#3
0
文件: Run.java 项目: guygolanIL/CLI
  public static void main(String[] args) {

    MyModel model = new MyModel();
    MyView view =
        new MyView(
            new BufferedReader(new InputStreamReader(System.in)), new PrintWriter(System.out));

    MyController controller = new MyController(model, view);
    model.setController(controller);
    view.setController(controller);

    view.start();
  }
 public MyView addScrollPanes(
     MyView updatedView,
     JTextArea jtext,
     int boundsX,
     int boundsY,
     int boundsWidth,
     int boundsHeight) {
   JScrollPane scroll = new JScrollPane(jtext);
   // scroll.setSize(10, jtext.getHeight());
   // scroll.add(jtext);
   scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
   scroll.setVisible(true);
   scroll.setBounds(boundsX, boundsY, boundsWidth, boundsHeight);
   updatedView.add(scroll);
   return updatedView;
 }
  // add buttons
  public JButton addButtons(
      MyView viewToSetup,
      String buttonName,
      int boundsX,
      int boundsY,
      int boundsWidth,
      int boundsHeight) {

    JButton thisButton = new JButton(buttonName);
    thisButton.setBounds(boundsX, boundsY, boundsWidth, boundsHeight);
    viewToSetup.add(thisButton);
    thisButton.setVisible(true);
    System.out.println("Button added");
    // add the button to the overall button list
    buttonList.add(thisButton);

    return thisButton;
  }