예제 #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();
  }
예제 #4
0
 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;
 }
예제 #5
0
  // 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;
  }