/** Listener to handle button actions */
 public void actionPerformed(ActionEvent e) {
   // Check if the user changed the service filter option
   if (e.getSource() == service_box) {
     service_list.setEnabled(service_box.isSelected());
     service_list.clearSelection();
     remove_service_button.setEnabled(false);
     add_service_field.setEnabled(service_box.isSelected());
     add_service_field.setText("");
     add_service_button.setEnabled(false);
   }
   // Check if the user pressed the add service button
   if ((e.getSource() == add_service_button) || (e.getSource() == add_service_field)) {
     String text = add_service_field.getText();
     if ((text != null) && (text.length() > 0)) {
       service_data.addElement(text);
       service_list.setListData(service_data);
     }
     add_service_field.setText("");
     add_service_field.requestFocus();
   }
   // Check if the user pressed the remove service button
   if (e.getSource() == remove_service_button) {
     Object[] sels = service_list.getSelectedValues();
     for (int i = 0; i < sels.length; i++) {
       service_data.removeElement(sels[i]);
     }
     service_list.setListData(service_data);
     service_list.clearSelection();
   }
 }
Пример #2
0
  void install() {
    Vector components = new Vector();
    Vector indicies = new Vector();
    int size = 0;

    JPanel comp = selectComponents.comp;
    Vector ids = selectComponents.filesets;

    for (int i = 0; i < comp.getComponentCount(); i++) {
      if (((JCheckBox) comp.getComponent(i)).getModel().isSelected()) {
        size += installer.getIntegerProperty("comp." + ids.elementAt(i) + ".real-size");
        components.addElement(installer.getProperty("comp." + ids.elementAt(i) + ".fileset"));
        indicies.addElement(new Integer(i));
      }
    }

    String installDir = chooseDirectory.installDir.getText();

    Map osTaskDirs = chooseDirectory.osTaskDirs;
    Iterator keys = osTaskDirs.keySet().iterator();
    while (keys.hasNext()) {
      OperatingSystem.OSTask osTask = (OperatingSystem.OSTask) keys.next();
      String dir = ((JTextField) osTaskDirs.get(osTask)).getText();
      if (dir != null && dir.length() != 0) {
        osTask.setEnabled(true);
        osTask.setDirectory(dir);
      } else osTask.setEnabled(false);
    }

    InstallThread thread =
        new InstallThread(installer, progress, installDir, osTasks, size, components, indicies);
    progress.setThread(thread);
    thread.start();
  }
 /** Constructor */
 public SOAPMonitorFilter() {
   // By default, exclude NotificationService and
   // EventViewerService messages
   filter_exclude_list = new Vector();
   filter_exclude_list.addElement("NotificationService");
   filter_exclude_list.addElement("EventViewerService");
 }
Пример #4
0
  public void mousePressed(MouseEvent e) {
    System.out.println("mousePressed");
    Point1 p2;
    switch (toolFlag) {
      case 3: // 直线
        x = (int) e.getX();
        y = (int) e.getY();
        p2 = new Point1(x, y, c, toolFlag, con);
        paintInfo.addElement(p2);
        break;

      case 4: // 圆
        x = (int) e.getX();
        y = (int) e.getY();
        p2 = new Point1(x, y, c, toolFlag, con);
        paintInfo.addElement(p2);
        break;

      case 5: // 矩形
        x = (int) e.getX();
        y = (int) e.getY();
        p2 = new Point1(x, y, c, toolFlag, con);
        paintInfo.addElement(p2);
        break;

      default:
    }
  }
 public void addMenuItem(String text, String loc) {
   locations.put(text, loc);
   if (filenames.contains("Test Text")) {
     filenames.remove("Test Text");
     filenames.addElement(text);
   } else {
     filenames.addElement(text);
   }
   createPopupMenu();
 }
Пример #6
0
 public void addUser(
     String strChannel, String strUserName, String strConnectDate, String strHost) {
   if (strChannel.equals(mstrChannel)) return;
   removeUser(strChannel);
   Vector vtData = new Vector();
   vtData.addElement(strChannel);
   vtData.addElement(strUserName);
   vtData.addElement(strConnectDate);
   vtData.addElement(strHost);
   tblUser.addRow(vtData);
 }
Пример #7
0
 /*==========================================================
  * public methods
  *==========================================================*/
 public void processData(Object data) {
   Vector v = new Vector();
   NameValuePairs obj = (NameValuePairs) data;
   v.addElement(
       new JLabel(
           obj.get(IMPL_NAME),
           CMSAdminUtil.getImage(CMSAdminResources.IMAGE_RULE_PLUGIN),
           JLabel.LEFT));
   v.addElement(obj.get(IMPL_CLASS));
   // v.addElement(obj.getValue(IMPL_DESC));
   addRow(v, data);
 }
 /** Remove all messages from the table (but leave "most recent") */
 public void clearAll() {
   int last_row = data.size() - 1;
   if (last_row > 0) {
     data.removeAllElements();
     SOAPMonitorData soap = new SOAPMonitorData(null, null, null);
     data.addElement(soap);
     if (filter_data != null) {
       filter_data.removeAllElements();
       filter_data.addElement(soap);
     }
     fireTableDataChanged();
   }
 }
 /** Add data to the table as a new row */
 public void addData(SOAPMonitorData soap) {
   int row = data.size();
   data.addElement(soap);
   if (filter_data != null) {
     if (filterMatch(soap)) {
       row = filter_data.size();
       filter_data.addElement(soap);
       fireTableRowsInserted(row, row);
     }
   } else {
     fireTableRowsInserted(row, row);
   }
 }
Пример #10
0
  /** Constructs a Level with no label */
  public Level() {
    draw = new LevelDraw();
    label = new JLabel("interface", JLabel.CENTER);

    TableLayout table = new TableLayout();
    this.setLayout(table);
    this.add("0 0 ", draw);
    this.add("0 1 hH", label);

    Vector v = new Vector(2);
    v.addElement(draw);
    v.addElement(label);
    table.sameWidth(v);
  }
Пример #11
0
  private void assembleAction() {
    String line;
    messages = new Vector();

    mainFrame.resetExecWindow();

    save();

    assembleFailed = false;
    haveAssemblyErrors = false;

    if (Assembler.version()) {
      while ((line = Assembler.output()) != null) {
        messages.addElement(line);
      }

      Assembler.setPaths(baseName, sourcePath);

      if (Assembler.assemble()) {
        while ((line = Assembler.output()) != null) {
          System.out.println(line);

          messages.addElement(line);

          if (line.startsWith(" [ERROR:")) {
            haveAssemblyErrors = true;
          }
        }

        messageList.setListData(messages);
        messageList.ensureIndexIsVisible(0);

        mainFrame.showExecWindow(baseName);
      } else {
        assembleFailed = true;
      }
    } else {
      assembleFailed = true;
    }

    if (assembleFailed) {
      String message =
          String.format(
              "Autocoder failed!\nVerify the correctness of autocoder path\n%s",
              AssemblerOptions.assemblerPath);
      System.out.println(message);

      JOptionPane.showMessageDialog(this, message, "ROPE", JOptionPane.ERROR_MESSAGE);
    }
  }
Пример #12
0
  /**
   * Expands the sub folders and image informations under the specified node.
   *
   * @param node the node.
   */
  protected void expandNode(DefaultMutableTreeNode node) {
    try {
      Object[] paths = node.getPath();

      String path_str = "";
      Vector folder_list = new Vector();
      for (int i = 1; i < paths.length; i++) {
        String name = (String) ((DefaultMutableTreeNode) paths[i]).getUserObject();
        path_str += "/" + name;

        // Converts January...December to 1...12.
        if (mode == DATE_ORIENTED && i == 2) {
          for (int m = 1; m <= 12; m++) {
            if (JulianDay.getFullSpellMonthString(m).equals(name)) name = String.valueOf(m);
          }
        }

        folder_list.addElement(name);
      }

      // When to expand sub folders.
      Vector folders = new Vector();
      if (mode == DATE_ORIENTED) folders = db_manager.getDateOrientedFolders(folder_list);
      if (mode == PATH_ORIENTED) folders = db_manager.getPathOrientedFolders(folder_list);
      addNode(node, folders);

      // When to expand image informations.
      XmlDBAccessor accessor = null;
      if (mode == DATE_ORIENTED) accessor = db_manager.getDateOrientedAccessor(folder_list);
      if (mode == PATH_ORIENTED) accessor = db_manager.getPathOrientedAccessor(folder_list);
      if (accessor != null) {
        Vector name_list = new Vector();
        XmlInformation info = (XmlInformation) accessor.getFirstElement();
        while (info != null) {
          name_list.addElement(info.getPath());
          hash_info.put(path_str + "/" + info.getPath(), info);
          info = (XmlInformation) accessor.getNextElement();
        }
        addNode(node, name_list);
      }

      revalidate();
      repaint();
    } catch (IOException exception) {
      String message = "Failed to read the database.";
      JOptionPane.showMessageDialog(pane, message, "Error", JOptionPane.ERROR_MESSAGE);
    }
  }
Пример #13
0
 /**
  * Add the graph item to the graph.
  *
  * @param graphItem Item to be added to the graph.
  */
 public void addGraphItem(GraphItem graphItem) {
   if (graphItem != null) {
     graphItems.addElement(graphItem);
     graphItem.addGraphItemListener(graphItemListener);
   }
   repaint();
 }
Пример #14
0
 public Vector getAssociatedLevelLists() {
   Vector levelLists = new Vector();
   Vector endPts = CollectionHelper.makeVector("Keyword");
   Hashtable keywordParents =
       oncotcap.Oncotcap.getDataSource()
           .getParentTree(
               "Keyword", endPts, CollectionHelper.makeVector(this), TreeDisplayModePanel.ROOT);
   // Take each of the parents and get the associated level lists
   if (keywordParents.size() <= 0) return levelLists;
   Hashtable levelListsHashtable =
       oncotcap.Oncotcap.getDataSource()
           .getInstanceTree(
               "EnumLevelList",
               new Vector(),
               makeLevelListFilter(keywordParents),
               TreeDisplayModePanel.ROOT);
   for (Enumeration e = keywordParents.keys(); e.hasMoreElements(); ) {
     System.out.println("Keyword.getAssociatedLevelLists: " + e.nextElement());
   }
   // Collect all the level lists from the hashtable
   Vector selectedItems = CollectionHelper.makeVector(keyword);
   for (Enumeration e = levelListsHashtable.keys(); e.hasMoreElements(); ) {
     Object obj = e.nextElement();
     if (obj instanceof EnumLevelList) {
       levelLists.addElement(obj);
     }
   }
   return levelLists;
 }
Пример #15
0
  public Vector getItems() {
    Vector items = new Vector();

    ActionListener al = new PopupMenuHandler();

    JMenuItem colorItem = new JMenuItem(colorString);
    colorItem.addActionListener(al);
    items.addElement(colorItem);

    JCheckBoxMenuItem dashedItem = new JCheckBoxMenuItem(dashedString);
    dashedItem.setSelected(dashed);
    dashedItem.addActionListener(al);
    items.addElement(dashedItem);

    return items;
  }
Пример #16
0
 public UserSettings(String filename) {
   visibleViewIds = new Vector();
   for (int i = 0; i < defaultVisibleViewIds.length; i++) {
     visibleViewIds.addElement(new Integer(defaultVisibleViewIds[i]));
   }
   load(filename);
 }
Пример #17
0
    private JPanel createCompPanel() {
      filesets = new Vector();

      int count = installer.getIntegerProperty("comp.count");
      JPanel panel = new JPanel(new GridLayout(count, 1));

      String osClass = OperatingSystem.getOperatingSystem().getClass().getName();
      osClass = osClass.substring(osClass.indexOf('$') + 1);

      for (int i = 0; i < count; i++) {
        String os = installer.getProperty("comp." + i + ".os");

        if (os != null && !osClass.equals(os)) continue;

        JCheckBox checkBox =
            new JCheckBox(
                installer.getProperty("comp." + i + ".name")
                    + " ("
                    + installer.getProperty("comp." + i + ".disk-size")
                    + "Mb)");
        checkBox.getModel().setSelected(true);
        checkBox.addActionListener(this);
        checkBox.setRequestFocusEnabled(false);

        filesets.addElement(new Integer(i));

        panel.add(checkBox);
      }

      Dimension dim = panel.getPreferredSize();
      dim.width = Integer.MAX_VALUE;
      panel.setMaximumSize(dim);

      return panel;
    }
 protected void addPage(String _typeOfPage, String _name, String _code, boolean _enabled) {
   cardLayout.show(finalPanel, "TabbedPanel");
   _name = getUniqueName(_name);
   Editor page = createPage(_typeOfPage, _name, _code);
   page.setFont(myFont);
   page.setColor(myColor);
   int index = tabbedPanel.getSelectedIndex();
   if (index == -1) {
     pageList.addElement(page);
     if (tabbedPanel.getTabCount() == 0) {
       tabbedPanel.addTab(
           page.getName(),
           null,
           page.getComponent(),
           tooltip); // This causes an exception sometimes
     } else {
       tabbedPanel.insertTab(
           page.getName(), null, page.getComponent(), tooltip, tabbedPanel.getTabCount());
     }
     index = 0;
   } else {
     index++;
     pageList.insertElementAt(page, index);
     tabbedPanel.insertTab(page.getName(), null, page.getComponent(), tooltip, index);
   }
   tabbedPanel.setSelectedComponent(page.getComponent());
   page.setActive(_enabled);
   if (!_enabled) tabbedPanel.setTitleAt(index, page.getName() + " (D)");
   updatePageCounterField(pageList.size());
   // tabbedPanel.validate(); This hangs the computer when reading a file at start-up !!!???
   tabbedPanel.repaint();
   changed = true;
 }
Пример #19
0
 public boolean setSquare(boardObject b, int x, int y) {
   if ((x < 0) || (x >= xdim) || (y < 0) || (y >= ydim)) return false; // out of range
   if (USEVEC) {
     boardContainer thisSquare = new boardContainer(new Dimension(x, y), b);
     boardVec.addElement(thisSquare);
   } else board[x][y] = b;
   return true;
 }
Пример #20
0
 /** Constructs ... */
 public JListDemo() {
   super("JList demo");
   JPanel jp = new JPanel();
   getContentPane().add(jp);
   JScrollPane sp = new JScrollPane();
   jp.add(sp);
   Vector dlist = new Vector();
   dlist.addElement("Anchovies");
   dlist.addElement("Bananas");
   dlist.addElement("Cilantro");
   dlist.addElement("Doughnuts");
   dlist.addElement("Escarrole");
   JList list = new JList(dlist);
   sp.getViewport().add(list);
   setSize(200, 200);
   setVisible(true);
 }
 /** Constructor */
 public SOAPMonitorTableModel() {
   data = new Vector();
   // Add "most recent" entry to top of table
   SOAPMonitorData soap = new SOAPMonitorData(null, null, null);
   data.addElement(soap);
   filter_include = null;
   filter_exclude = null;
   filter_active = false;
   filter_complete = false;
   filter_data = null;
   // By default, exclude NotificationService and
   // EventViewerService messages
   filter_exclude = new Vector();
   filter_exclude.addElement("NotificationService");
   filter_exclude.addElement("EventViewerService");
   filter_data = new Vector();
   filter_data.addElement(soap);
 }
 public Vector getStrings() {
   int size = _fields.size();
   Vector res = new Vector(size);
   for (int i = 0; i < size; i++) {
     JTextField tf = (JTextField) _fields.elementAt(i);
     res.addElement(tf.getText());
   }
   return res;
 }
Пример #23
0
  /*==========================================================
   * public methods
   *==========================================================*/
  public void processData(Object data) {
    Vector v = new Vector();

    NameValuePairs obj = (NameValuePairs) data;

    // XXX NEED TO CHANGE if we are going to have multi-column table
    v.addElement(
        new JLabel(
            obj.get(CERT_NAME),
            CMSAdminUtil.getImage(CMSAdminResources.IMAGE_CERTICON_SMALL),
            JLabel.LEFT));
    addRow(v, data);
  }
Пример #24
0
 public Vector collectShadows() {
   Vector shadowBoxes = new Vector();
   if (visibleDrawables == null) visibleDrawables = getVisibleDrawables();
   for (int i = 0; i < visibleDrawables.size(); i++) {
     Vector curVis = (Vector) visibleDrawables.elementAt(i);
     for (int j = 0; j < curVis.size(); j++) {
       Drawable dsf = (Drawable) curVis.elementAt(j);
       DrawableUtil.setBoxBounds(dsf, transformer, manager);
       shadowBoxes.addElement(dsf.getBoxBounds());
     }
   }
   return shadowBoxes;
 }
Пример #25
0
 private Vector getChildren(Keyword keyword, Vector allKids) {
   allKids.addElement(keyword);
   // 			System.out.println("Addtoallkids " + keyword + "  " + allKids );
   Vector children = keyword.getChildren();
   if (children != null) {
     Iterator i = children.iterator();
     while (i.hasNext()) {
       Keyword child = (Keyword) i.next();
       getChildren(child, allKids);
     }
   }
   return allKids;
 }
Пример #26
0
  public void mouseDragged(MouseEvent e) {
    System.out.println("mouseDragged");
    Point1 p1;
    switch (toolFlag) {
      case 0: // 画笔
        x = (int) e.getX();
        y = (int) e.getY();
        p1 = new Point1(x, y, c, toolFlag, con);
        paintInfo.addElement(p1);
        repaint();
        break;

      case 1: // 橡皮
        x = (int) e.getX();
        y = (int) e.getY();
        p1 = new Point1(x, y, null, toolFlag, Econ);
        paintInfo.addElement(p1);
        repaint();
        break;

      default:
    }
  }
Пример #27
0
  /*==========================================================
   * public methods
   *==========================================================*/
  public Vector parse(Object entry) throws ParseException {
    String logEntry = (String) entry;
    // parsing the log Entry and return segments
    // Debug.println("LogDataModel: DefaultLogParser: parse() -" +logEntry);
    int x = logEntry.indexOf("[");
    if (x == -1) throw new ParseException(logEntry, 0);
    String temp = logEntry.substring(x + 1);
    x = temp.indexOf("]");
    if (x == -1) throw new ParseException(logEntry, 0);

    String dateStr = temp.substring(0, x);
    // Debug.println("LogDataModel: DefaultLogParser: parse() -"+dateStr+" "+temp);
    SimpleDateFormat format = new SimpleDateFormat(DATE_PATTERN);
    Date date = format.parse(dateStr);
    String dateColumn = DateFormat.getDateInstance().format(date);
    String timeColumn = DateFormat.getTimeInstance().format(date);

    // Debug.println("LogDataModel: DefaultLogParser: parse() -"+dateColumn+" "+timeColumn);
    temp = temp.substring(x + 2);
    x = temp.indexOf("]");
    if (x == -1) throw new ParseException(logEntry, 0);
    String source = temp.substring(1, x);
    temp = temp.substring(x + 2);
    x = temp.indexOf("]");
    if (x == -1) throw new ParseException(logEntry, 0);
    String level = temp.substring(1, x);
    temp = temp.substring(x + 2);
    Vector row = new Vector();
    row.addElement(getSourceString(source));
    row.addElement(getLevelString(level));
    row.addElement(dateColumn);
    row.addElement(timeColumn);
    JLabel detail = new JLabel(temp);
    detail.setToolTipText(temp);
    row.addElement(detail);
    return row;
  }
Пример #28
0
  private void buildList() {
    Vector<String> params = new Vector<String>();
    OpenDataFile of = (OpenDataFile) mFileViewer.mOpenFiles.currElement();
    Section sech = (Section) of.mSections.currElement();
    for (int i = 0; i < sech.getNumStnVars(); i++) {
      params.addElement(sech.getStnVar(i));
    }

    if (mList == null) {
      mList = new JOAJList(params);
    } else {
      mList.setListData(params);
      mList.invalidate();
    }
  }
Пример #29
0
 public MyPanel() {
   // 在我的panel里构造一个坦克
   hero = new Hero(100, 100);
   for (int i = 0; i < enemySize; i++) {
     //			创建敌人的坦克,并加入到敌人坦克集合中。
     EnemyTank et = new EnemyTank((i + 1) * 50, 0);
     et.setColor(0);
     et.setDirection(2);
     Thread t = new Thread(et);
     t.start();
     ets.addElement(et);
   }
   image1 = Toolkit.getDefaultToolkit().getImage(Panel.class.getResource("/bomb_1.gif"));
   image2 = Toolkit.getDefaultToolkit().getImage(Panel.class.getResource("/bomb_2.gif"));
   image3 = Toolkit.getDefaultToolkit().getImage(Panel.class.getResource("/bomb_3.gif"));
 }
Пример #30
0
  private void updateList() {
    ActionSet actionSet = (ActionSet) combo.getSelectedItem();
    EditAction[] actions = actionSet.getActions();
    Vector listModel = new Vector(actions.length);

    for (int i = 0; i < actions.length; i++) {
      EditAction action = actions[i];
      String label = action.getLabel();
      if (label == null) continue;

      listModel.addElement(new ToolBarOptionPane.Button(action.getName(), null, null, label));
    }

    MiscUtilities.quicksort(listModel, new ToolBarOptionPane.ButtonCompare());
    list.setListData(listModel);
  }