Esempio n. 1
1
    // create from a dataset
    public VariableBean(Variable vs) {
      this.vs = vs;
      // vs = (v instanceof VariableEnhanced) ? (VariableEnhanced) v : new VariableStandardized( v);

      setName(vs.getShortName());
      setDescription(vs.getDescription());
      setUnits(vs.getUnitsString());
      setDataType(vs.getDataType().toString());

      // Attribute csAtt = vs.findAttribute("_coordSystems");
      // if (csAtt != null)
      //  setCoordSys( csAtt.getStringValue());

      // collect dimensions
      StringBuilder lens = new StringBuilder();
      StringBuilder names = new StringBuilder();
      java.util.List dims = vs.getDimensions();
      for (int j = 0; j < dims.size(); j++) {
        ucar.nc2.Dimension dim = (ucar.nc2.Dimension) dims.get(j);
        if (j > 0) {
          lens.append(",");
          names.append(",");
        }
        String name = dim.isShared() ? dim.getName() : "anon";
        names.append(name);
        lens.append(dim.getLength());
      }
      setDimensions(names.toString());
      setShape(lens.toString());
    }
  private void resetSemImEditor() {
    java.util.List<SemEstimator> semEstimators = wrapper.getMultipleResultList();

    if (semEstimators.size() == 1) {
      SemEstimator estimatedSem = semEstimators.get(0);
      SemImEditor editor = new SemImEditor(new SemImWrapper(estimatedSem.getEstimatedSem()));
      panel.removeAll();
      panel.add(editor, BorderLayout.CENTER);
      panel.revalidate();
      panel.repaint();

    } else {
      JTabbedPane tabs = new JTabbedPane();

      for (int i = 0; i < semEstimators.size(); i++) {
        SemEstimator estimatedSem = semEstimators.get(i);
        SemImEditor editor = new SemImEditor(new SemImWrapper(estimatedSem.getEstimatedSem()));
        JPanel _panel = new JPanel();
        _panel.setLayout(new BorderLayout());
        _panel.add(editor, BorderLayout.CENTER);
        tabs.addTab(estimatedSem.getDataSet().getName(), _panel);
      }

      panel.removeAll();
      panel.add(tabs);
      panel.validate();
    }
  }
Esempio n. 3
0
  private void spawnRandomers() {
    for (int i = 0; i < randomN; i++) {
      float x = (float) Math.random() * width;
      float y = (float) Math.random() * height;
      float r =
          (float)
              Math.sqrt(
                  Math.pow(((Player) players.get(0)).getX() - x, 2)
                      + Math.pow(((Player) players.get(0)).getY() - x, 2));

      while (r < distanceLimit) {
        x = (float) Math.random() * width;
        y = (float) Math.random() * height;
        r =
            (float)
                Math.sqrt(
                    Math.pow(((Player) players.get(0)).getX() - x, 2)
                        + Math.pow(((Player) players.get(0)).getY() - y, 2));
      }

      enemies.add(new EnemyTypes.Random(x, y, 0.5f, borders));
    }

    spawnRandomersB = false;
  }
Esempio n. 4
0
 public void removeRow(int index) {
   remove(rows.get(index));
   remove(struts.get(index));
   rows.remove(index);
   struts.remove(index);
   repaint();
   updateUI();
 }
Esempio n. 5
0
  private void listPeople() {

    try {

      jScrollPane1.getViewport().setView(null);

      JFlowPanel jPeople = new JFlowPanel();
      jPeople.applyComponentOrientation(getComponentOrientation());

      java.util.List people = m_dlSystem.listPeopleVisible();

      for (int i = 0; i < people.size(); i++) {

        AppUser user = (AppUser) people.get(i);

        JButton btn = new JButton(new AppUserAction(user));
        btn.applyComponentOrientation(getComponentOrientation());
        btn.setFocusPainted(false);
        btn.setFocusable(false);
        btn.setRequestFocusEnabled(false);
        btn.setHorizontalAlignment(SwingConstants.LEADING);
        btn.setMaximumSize(new Dimension(150, 50));
        btn.setPreferredSize(new Dimension(150, 50));
        btn.setMinimumSize(new Dimension(150, 50));

        jPeople.add(btn);
      }
      jScrollPane1.getViewport().setView(jPeople);

    } catch (BasicException ee) {
      ee.printStackTrace();
    }
  }
 /** Retrieve item types and fill in the item types combo box. */
 private void init() {
   Response res = ClientUtils.getData("loadItemTypes", new GridParams());
   Domain d = new Domain("ITEM_TYPES");
   if (!res.isError()) {
     ItemTypeVO vo = null;
     list = ((VOListResponse) res).getRows();
     for (int i = 0; i < list.size(); i++) {
       vo = (ItemTypeVO) list.get(i);
       d.addDomainPair(vo.getProgressiveHie02ITM02(), vo.getDescriptionSYS10());
     }
   }
   controlHierarchy.setDomain(d);
   controlHierarchy
       .getComboBox()
       .addItemListener(
           new ItemListener() {
             public void itemStateChanged(ItemEvent e) {
               if (e.getStateChange() == e.SELECTED) {
                 ItemTypeVO typeVO = (ItemTypeVO) list.get(controlHierarchy.getSelectedIndex());
                 treePanel.setCompanyCode(typeVO.getCompanyCodeSys01ITM02());
                 treePanel.setProgressiveHIE02((BigDecimal) controlHierarchy.getValue());
                 DetailSupplierVO vo =
                     (DetailSupplierVO) supplierPanel.getVOModel().getValueObject();
                 treePanel.setCompanyCode(vo.getCompanyCodeSys01REG04());
                 treePanel.reloadTree();
                 itemsGrid.clearData();
               }
             }
           });
   if (d.getDomainPairList().length == 1) controlHierarchy.getComboBox().setSelectedIndex(0);
   else controlHierarchy.getComboBox().setSelectedIndex(-1);
 }
Esempio n. 7
0
 public void setTablaPrincipal(java.util.List val) {
   DefaultTableModel modelo = ((DefaultTableModel) this.tablaPrincipal.getModel());
   for (int i = 0; i < val.size(); i++) {
     modelo.addRow(((java.util.ArrayList) val.get(i)).toArray());
   }
   this.calculaSumas();
 }
  private void handleEntryAction(ActionEvent actionEvent)
      throws IOException, ParserConfigurationException, XPathExpressionException, SAXException,
          NoItemException {
    if (this.getGazetteer() == null) {
      Util.getLogger().severe("No gazeteer is registered");
      return;
    }

    String lookupString;

    JComboBox cmb = ((JComboBox) actionEvent.getSource());
    lookupString = cmb.getSelectedItem().toString();

    if (lookupString == null || lookupString.length() < 1) return;

    java.util.List<PointOfInterest> results = this.gazetteer.findPlaces(lookupString);
    if (results == null || results.size() == 0) return;

    this.controller.moveToLocation(results.get(0));

    // Add it to the list if not already there
    for (int i = 0; i < cmb.getItemCount(); i++) {
      Object oi = cmb.getItemAt(i);
      if (oi != null && oi.toString().trim().equals(lookupString)) return; // item exists
    }
    cmb.insertItemAt(lookupString, 0);
  }
  private void reestimate() {
    SemOptimizer optimizer;

    String type = wrapper.getSemOptimizerType();

    if ("Regression".equals(type)) {
      optimizer = new SemOptimizerRegression();
    } else if ("EM".equals(type)) {
      optimizer = new SemOptimizerEm();
    } else if ("Powell".equals(type)) {
      optimizer = new SemOptimizerPowell();
    } else if ("Random Search".equals(type)) {
      optimizer = new SemOptimizerScattershot();
    } else if ("RICF".equals(type)) {
      optimizer = new SemOptimizerRicf();
    } else if ("Powell".equals(type)) {
      optimizer = new SemOptimizerPowell();
    } else {
      throw new IllegalArgumentException("Unexpected optimizer " + "type: " + type);
    }

    int numRestarts = wrapper.getNumRestarts();
    optimizer.setNumRestarts(numRestarts);

    java.util.List<SemEstimator> estimators = wrapper.getMultipleResultList();
    java.util.List<SemEstimator> newEstimators = new ArrayList<>();

    for (SemEstimator estimator : estimators) {
      SemPm semPm = estimator.getSemPm();

      DataSet dataSet = estimator.getDataSet();
      ICovarianceMatrix covMatrix = estimator.getCovMatrix();

      SemEstimator newEstimator;

      if (dataSet != null) {
        newEstimator = new SemEstimator(dataSet, semPm, optimizer);
        newEstimator.setNumRestarts(numRestarts);
        newEstimator.setScoreType(wrapper.getScoreType());
      } else if (covMatrix != null) {
        newEstimator = new SemEstimator(covMatrix, semPm, optimizer);
        newEstimator.setNumRestarts(numRestarts);
        newEstimator.setScoreType(wrapper.getScoreType());
      } else {
        throw new IllegalStateException(
            "Only continuous "
                + "rectangular data sets and covariance matrices "
                + "can be processed.");
      }

      newEstimator.estimate();
      newEstimators.add(newEstimator);
    }

    wrapper.setSemEstimator(newEstimators.get(0));

    wrapper.setMultipleResultList(newEstimators);
    resetSemImEditor();
  }
Esempio n. 10
0
 public void assignRobotRepresent(VivaeRobotRepresent repr) {
   int activePositionsCnt = positions.size();
   PositionMark pattern = positions.get(actives.size() % activePositionsCnt);
   repr.getBody().setPosition((float) pattern.getX(), (float) pattern.getY());
   repr.setArena(this);
   repr.setWorld(getWorld());
   addActive((Active) repr);
 }
  /**
   * Creates a single Style from the passed in styles. The passed in List is reverse sorted, that is
   * the most recently added style found to match will be first.
   */
  private SynthStyle mergeStyles(java.util.List styles) {
    int size = styles.size();

    if (size == 0) {
      return null;
    } else if (size == 1) {
      return (SynthStyle) ((DefaultSynthStyle) styles.get(0)).clone();
    }
    // NOTE: merging is done backwards as DefaultSynthStyleFactory reverses
    // order, that is, the most specific style is first.
    DefaultSynthStyle style = (DefaultSynthStyle) styles.get(size - 1);

    style = (DefaultSynthStyle) style.clone();
    for (int counter = size - 2; counter >= 0; counter--) {
      style = ((DefaultSynthStyle) styles.get(counter)).addTo(style);
    }
    return style;
  }
Esempio n. 12
0
  public static DefaultPieDataset getPieDataset(String chartName, DBSeerDataSet dataset) {
    StatisticalPackageRunner runner = DBSeerGUI.runner;

    runner.eval(
        "[title legends Xdata Ydata Xlabel Ylabel timestamp] = plotter.plot" + chartName + ";");

    String title = runner.getVariableString("title");
    Object[] legends = (Object[]) runner.getVariableCell("legends");
    Object[] xCellArray = (Object[]) runner.getVariableCell("Xdata");
    Object[] yCellArray = (Object[]) runner.getVariableCell("Ydata");
    String xLabel = runner.getVariableString("Xlabel");
    String yLabel = runner.getVariableString("Ylabel");
    timestamp = runner.getVariableDouble("timestamp");

    DefaultPieDataset pieDataSet = new DefaultPieDataset();

    int numLegends = legends.length;
    int numXCellArray = xCellArray.length;
    int numYCellArray = yCellArray.length;
    int dataCount = 0;

    if (numXCellArray != numYCellArray) {
      JOptionPane.showMessageDialog(
          null,
          "The number of X dataset and Y dataset does not match.",
          "The number of X dataset and Y dataset does not match.",
          JOptionPane.ERROR_MESSAGE);
      return null;
    }

    final java.util.List<String> transactionTypeNames = dataset.getTransactionTypeNames();

    for (int i = 0; i < numYCellArray; ++i) {
      double[] xArray = (double[]) xCellArray[i];
      runner.eval("yArraySize = size(Ydata{" + (i + 1) + "});");
      runner.eval("yArray = Ydata{" + (i + 1) + "};");
      double[] yArraySize = runner.getVariableDouble("yArraySize");
      double[] yArray = runner.getVariableDouble("yArray");

      int xLength = xArray.length;
      int row = (int) yArraySize[0];
      int col = (int) yArraySize[1];

      for (int c = 0; c < col; ++c) {
        if (c < transactionTypeNames.size()) {
          String name = transactionTypeNames.get(c);
          if (!name.isEmpty()) {
            pieDataSet.setValue(name, yArray[c]);
          } else {
            pieDataSet.setValue("Transaction Type " + (c + 1), yArray[c]);
          }
        }
      }
    }

    return pieDataSet;
  }
Esempio n. 13
0
  private void mRemoveNode() {
    String old_node = (String) lstNodes.getSelectedValue();

    java.util.List remove_list =
        ConfigUtilities.getElementsWithDefinition(mBroker.getElements(mContext), old_node);
    for (int i = 0; i < remove_list.size(); i++) {
      mBroker.remove(mContext, (ConfigElement) remove_list.get(i));
    }
  }
Esempio n. 14
0
 public void mouseReleased(MouseEvent e) {
   armed = -1;
   int mx = e.getX();
   int partIndex = partIndex(mx);
   if (partIndex == -1) return;
   java.util.List<Network> networks = getNetworkParts();
   Network selectedNetwork = networks.get(partIndex);
   if (selectedNetwork != null) document.setCurrentNetwork(selectedNetwork);
   repaint();
 }
Esempio n. 15
0
    public BGnodeFrame(
        String name,
        java.util.List<SingleProducer> producers,
        java.util.List<SingleConsumer> consumers,
        NodeID nid,
        ScatterGather sg) {
      super(name);

      BGnodePanel b = new BGnodePanel(nid, producers, consumers, sg);
      getContentPane().add(b);
      getContentPane().setLayout(new FlowLayout());

      for (int i = 0; i < consumers.size(); i++)
        b.addConsumer(consumers.get(i), null); // null means autolabel
      for (int i = 0; i < producers.size(); i++)
        b.addProducer(producers.get(i), null); // null means autolabel

      this.setLocation(hPos, vPos);
      vPos += 200;
    }
Esempio n. 16
0
 public Object getValueAt(int row, int column) {
   if (column == 0) {
     return selectedRangeTypes.get(row);
   } else if (column == 1) {
     return typeRangeName.get((String) getValueAt(row, 0));
   } else if (column == 2) {
     return (ranges.get((String) getValueAt(row, 1)).getStart());
   } else {
     return (ranges.get((String) getValueAt(row, 1)).getEnd());
   }
 }
Esempio n. 17
0
 protected void paintToImage(Component c, Image image, Graphics g, int w, int h, Object[] args) {
   Graphics2D g2 = (Graphics2D) g;
   java.util.List gradient = (java.util.List) args[0];
   boolean isVertical = ((Boolean) args[1]).booleanValue();
   // Render to the VolatileImage
   if (isVertical) {
     drawVerticalGradient(
         g2,
         ((Number) gradient.get(0)).floatValue(),
         ((Number) gradient.get(1)).floatValue(),
         (Color) gradient.get(2),
         (Color) gradient.get(3),
         (Color) gradient.get(4),
         w,
         h);
   } else {
     drawHorizontalGradient(
         g2,
         ((Number) gradient.get(0)).floatValue(),
         ((Number) gradient.get(1)).floatValue(),
         (Color) gradient.get(2),
         (Color) gradient.get(3),
         (Color) gradient.get(4),
         w,
         h);
   }
 }
 public void start() {
   int i = 0;
   while (true) {
     lbl_rollNo.setFont(fonts.get(i));
     i = (i + 1) % fonts.size();
     // Code to sleep for 3 seconds
     try {
       Thread.currentThread().sleep(3000);
     } catch (InterruptedException iex) {
       iex.printStackTrace();
     }
   }
 }
Esempio n. 19
0
 public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
   if (rowIndex >= getRowCount()) {
     return;
   }
   final Row row = myData.get(rowIndex);
   switch (columnIndex) {
     case NAME_TABLE_COLUMN:
       row.name = (String) aValue;
       break;
     case EXPRESSION_TABLE_COLUMN:
       row.value = (TextWithImports) aValue;
       break;
   }
 }
Esempio n. 20
0
 public void jButton9_actionPerformed(ActionEvent e) {
   java.util.List OutList = new LinkedList();
   if (rtc != null) {
     OutList = rtc.GetTerminalOnLineStatus(TerminalInfoList);
   } else {
     System.out.println("no object,create it first");
   }
   if (OutList != null) {
     for (int i = 0; i < OutList.size(); i++) {
       TerminalOnLineStatus to = (TerminalOnLineStatus) OutList.get(i);
       memo1.append(to.TerminalAddress + " OnLineStatus is " + to.OnLineStatus + "\r\n");
     }
   }
 }
Esempio n. 21
0
 public Object getValueAt(int rowIndex, int columnIndex) {
   if (rowIndex >= getRowCount()) {
     return null;
   }
   final Row row = myData.get(rowIndex);
   switch (columnIndex) {
     case NAME_TABLE_COLUMN:
       return row.name;
     case EXPRESSION_TABLE_COLUMN:
       return row.value;
     default:
       return null;
   }
 }
Esempio n. 22
0
 void drawScribbles(Graphics g) {
   if ((scribbles == null) || (scribbles.size() == 0)) {
     return;
   }
   DrawObject L = (DrawObject) scribbles.get(0);
   int scribbleCounter = L.scribbleNum;
   g.setColor(scribbleColor);
   ((Graphics2D) g).setStroke(new BasicStroke(2f));
   int prevX = L.scribbleX;
   int prevY = L.scribbleY;
   for (int i = 1; i < scribbles.size(); i++) {
     L = (DrawObject) scribbles.get(i);
     if (L.scribbleNum == scribbleCounter) {
       // Keep drawing.
       g.drawLine(prevX, prevY, L.scribbleX, L.scribbleY);
       prevX = L.scribbleX;
       prevY = L.scribbleY;
     } else {
       scribbleCounter = L.scribbleNum;
       prevX = L.scribbleX;
       prevY = L.scribbleY;
     }
   }
 }
Esempio n. 23
0
  public static JTable createErrorTable(PredictionCenter center) {
    JTable errorTable = null;
    DefaultTableModel errorTableModel = null;
    StatisticalPackageRunner runner = DBSeerGUI.runner;

    Object[] maeList = (Object[]) runner.getVariableCell("meanAbsError");
    Object[] mreList = (Object[]) runner.getVariableCell("meanRelError");
    Object[] headers = (Object[]) runner.getVariableCell("errorHeader");

    if (maeList.length > 0 || mreList.length > 0) {
      errorTableModel =
          new DefaultTableModel() {
            @Override
            public boolean isCellEditable(int row, int column) {
              return false;
            }
          };
      // errorTable = new JTable();
      errorTableModel.addColumn(null, new String[] {"", "MAE", "MRE"}); // first empty column

      final java.util.List<String> transactionNames =
          center.getTrainConfig().getDataset(0).getTransactionTypeNames();
      for (int i = 0; i < maeList.length; ++i) {
        Object maeObj = maeList[i];
        Object mreObj = mreList[i];

        double[] mae = (double[]) maeObj;
        double[] mre = (double[]) mreObj;

        String header = (String) headers[i];
        for (int j = 0; j < transactionNames.size(); ++j) {
          if (header.contains("Type " + (j + 1))) {
            headers[i] = header.replace("Type " + (j + 1), transactionNames.get(j));
            break;
          }
        }

        errorTableModel.addColumn(
            null,
            new Object[] {
              headers[i], String.format("%.3f", mae[0]), String.format("%.3f", mre[0])
            });
      }
      errorTable = new JTable(errorTableModel);
    }

    return errorTable;
  }
Esempio n. 24
0
 public void selectRow(int index) {
   int count = 0;
   for (JPanel row : rows) {
     if (count % 2 == 0) {
       row.setBackground(new Color(200, 200, 230));
     } else {
       row.setBackground(new Color(240, 240, 240));
     }
     ++count;
   }
   if (index != -1) {
     rows.get(index).setBackground(new Color(170, 250, 170));
   }
   repaint();
   updateUI();
 }
Esempio n. 25
0
 private void showInfoActionPerformed() {
   java.util.List itemList = grid.getCheckedRows();
   if (itemList.size() > 0) {
     ViewRecordScreen screen = new ViewRecordScreen(getSubsystemApp());
     List selectedRows = new ArrayList();
     for (int i = 0; i < itemList.size(); i++) {
       CopyRightReportRowData data = (CopyRightReportRowData) itemList.get(i);
       TempCopyrightRecord copyrightRecord = (TempCopyrightRecord) data.getEntity();
       selectedRows.add(copyrightRecord);
     }
     screen.setData(selectedRows);
     screen.showModal();
   } else {
     MessagePanes.showWarningDialog(
         this, props.getProperty(StandardActionNames.SELECT_ONE_ROW), local);
   }
 }
Esempio n. 26
0
    public VariableBean(VariableEnhanced v) {
      this.ve = v;

      setName(v.getFullName());
      setDescription(v.getDescription());
      setUnits(v.getUnitsString());

      // collect dimensions
      StringBuilder lens = new StringBuilder();
      StringBuilder names = new StringBuilder();
      java.util.List dims = v.getDimensions();
      for (int j = 0; j < dims.size(); j++) {
        ucar.nc2.Dimension dim = (ucar.nc2.Dimension) dims.get(j);
        if (j > 0) {
          lens.append(",");
          names.append(",");
        }
        String name = dim.isShared() ? dim.getShortName() : "anon";
        names.append(name);
        lens.append(dim.getLength());
      }
      setDims(names.toString());
      setShape(lens.toString());

      StringBuilder buff = new StringBuilder();
      List<CoordinateSystem> csList = v.getCoordinateSystems();
      for (CoordinateSystem cs : csList) {
        if (firstCoordSys == null) firstCoordSys = cs;
        else buff.append("; ");

        buff.append(cs.getName());

        Formatter gridBuff = new Formatter();
        if (GridCoordSys.isGridCoordSys(gridBuff, cs, v)) {
          addDataType("grid");
        } /* else if (PointDatasetDefaultHandler.isPointFeatureDataset(ds)) {
            addDataType("point");
          } */
      }
      setCoordSys(buff.toString());
    }
Esempio n. 27
0
  private void createNodes(DefaultMutableTreeNode root, XmlNode xmlNode) {
    if (xmlNode != null) {
      Object topicsObject = xmlNode.getElement("topic");
      if (topicsObject instanceof java.util.List) {
        java.util.List subtopics = (java.util.List) topicsObject;
        for (int i = 0; i < subtopics.size(); i++) {
          XmlNode xmlSubNode = (XmlNode) subtopics.get(i);

          String id = xmlSubNode.getAttribute("id");
          String title = xmlSubNode.getAttribute("title");
          Object subs = xmlSubNode.getElement("topic");
          int subtopicCount = subs instanceof java.util.List ? ((java.util.List) subs).size() : 0;

          TopicInfo topicInfo = new TopicInfo(id, title, subtopicCount);
          DefaultMutableTreeNode node = new DefaultMutableTreeNode(topicInfo);
          this.treeModel.insertNodeInto(node, root, root.getChildCount());
          createNodes(node, xmlSubNode);
        }
      }
    }
  }
Esempio n. 28
0
  public void initializeComponents() {

    samplesPanel = new SamplesPanel(this, taxa);
    treesPanel = new TreesPanel(this, trees.get(0));

    tabbedPane.addTab("Sample Dates", samplesPanel);
    tabbedPane.addTab("Analysis", treesPanel);

    JPanel panel = new JPanel(new BorderLayout(6, 6));
    panel.setBorder(new BorderUIResource.EmptyBorderUIResource(new Insets(12, 12, 12, 12)));
    panel.add(tabbedPane, BorderLayout.CENTER);

    panel.add(statusLabel, BorderLayout.SOUTH);

    getContentPane().setLayout(new BorderLayout(0, 0));
    getContentPane().add(panel, BorderLayout.CENTER);

    setSize(new Dimension(1024, 768));

    setStatusMessage();
  }
Esempio n. 29
0
  @Override
  protected void paintComponent(Graphics g) {
    java.util.List<Network> networks = getNetworkParts();
    positions = new int[networks.size()];
    Graphics2D g2 = (Graphics2D) g;

    g2.setFont(SMALL_BOLD_FONT);

    g2.setPaint(addressGradientPaint);
    g2.fill(g2.getClipBounds());
    // g2.drawImage(addressGradient, 0, 0, getWidth(), 26, null);

    int x = 14;

    for (int i = 0; i < networks.size(); i++) {
      Network part = networks.get(i);
      if (i == armed) {
        g2.setColor(TEXT_ARMED_COLOR);
      } else {
        g2.setColor(TEXT_NORMAL_COLOR);
      }
      String displayName = part.getDisplayName();
      SwingUtils.drawShadowText(g2, displayName, x, 16);

      int width = (int) g2.getFontMetrics().stringWidth(displayName);
      x += width + 5;
      positions[i] = x + 10;
      g2.drawImage(addressArrow, x, 0, null);
      x += 15;
    }

    String version = Application.getInstance().getVersion();
    int versionX = getWidth() - g2.getFontMetrics().stringWidth(version) - 10;
    SwingUtils.drawShadowText(g2, version, versionX, 16);

    if (renderException != null) {
      g2.drawImage(addressExclamation, versionX - 30, 0, null);
    }
  }
Esempio n. 30
0
  private void spawnCircles() {
    if (circular) {
      for (int i = 0; i < ballN; i++) {
        double degree = Math.random() * 2 * Math.PI;
        float x = ((Player) players.get(0)).getX() + distance * (float) Math.sin(degree * i);
        float y = ((Player) players.get(0)).getY() + distance * (float) Math.cos(degree * i);
        enemies.add(new EnemyTypes.Circle(x, y, invSpeed));
      }
    } else {
      for (int i = 1; i < (ballN / 2); i++) {
        float x = (i * 2 * width) / (ballN);
        float y = 0;
        enemies.add(new EnemyTypes.Circle(x, y, invSpeed));
      }

      for (int i = (ballN / 2) + 1; i < ballN; i++) {
        float x = ((i - ballN / 2) * 2 * width) / ballN;
        float y = height;
        enemies.add(new EnemyTypes.Circle(x, y, invSpeed));
      }
    }
    spawnIncrease = false;
  }