コード例 #1
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;
 }
コード例 #2
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;
  }