예제 #1
0
  @Override
  public void doOutput(String componentName, Vector<Object> arguments) {
    String compName = componentName.toUpperCase();
    Component component;

    if (compName.compareTo(PDAComponents.CLEAR.toString()) == 0) {

      component = components.get(PDAComponents.PROOPINION.toString());
      if (component != null && component instanceof JTextArea) {
        JTextArea ta = (JTextArea) component;
        ta.setText(null);
      }
      component = components.get(PDAComponents.CONOPINION.toString());
      if (component != null && component instanceof JTextArea) {
        JTextArea ta = (JTextArea) component;
        ta.setText(null);
      }
    } else {
      if (!components.containsKey(compName)) {
        System.err.println(
            "component [" + componentName + "] not found."); // FIXME: get a log from somewhere
        return;
      }

      component = components.get(compName);
      if (component instanceof JTextArea) {
        if (arguments.size() > 0) {
          JTextArea ta = (JTextArea) component;
          ta.append((String) arguments.get(0) + "\n");
          ta.repaint();
        }
      }
    }
  }
예제 #2
0
  public PDAAgentGui(AgentGuiConfig configuration) {

    config = configuration;
    components = new Hashtable<String, Component>();
    window = new JFramePDA();

    window.jLabel4.setText(config.windowName);

    components.put(PDAComponents.JOIN.toString(), window.jTextField1);
    components.put(PDAComponents.ADD.toString(), window.jTextField2);
    components.put(PDAComponents.DELETE.toString(), window.jTextField3);
    components.put(PDAComponents.PROOPINION.toString(), window.jTextArea1);
    components.put(PDAComponents.CONOPINION.toString(), window.jTextArea2);
    components.put(PDAComponents.AGENT_NAME.toString(), window.jLabel4);

    window.setVisible(true);
  }