コード例 #1
0
ファイル: JImage.java プロジェクト: RussTedrake/lcm
    public void mouseDragged(MouseEvent e) {
      int mods = e.getModifiersEx();
      Point dragEnd = e.getPoint();
      boolean shift = (mods & MouseEvent.SHIFT_DOWN_MASK) > 0;
      boolean ctrl = (mods & MouseEvent.CTRL_DOWN_MASK) > 0;
      boolean alt = shift & ctrl;
      ctrl = ctrl & (!alt);
      shift = shift & (!alt);
      boolean nomods = !(shift | ctrl | alt);

      if (dragBegin == null) dragBegin = dragEnd;

      nodrag = false;

      if ((mods & InputEvent.BUTTON3_DOWN_MASK) > 0 || true) {
        double dx = dragEnd.getX() - dragBegin.getX();
        double dy = dragEnd.getY() - dragBegin.getY();

        synchronized (JImage.this) {
          t.preConcatenate(AffineTransform.getTranslateInstance(dx, dy));
        }

        dragBegin = dragEnd;
        repaint();
      }
    }
コード例 #2
0
 // ------------------------------
 public void
     scrollToCaret() { // not called - fixed with putting visible scrollbars on JScrollPane
   //
   Rectangle rect1 = scroller1.getViewport().getViewRect();
   double x1 = rect1.getX();
   double y1 = rect1.getY();
   double r1height = rect1.getHeight();
   double r1width = rect1.getWidth();
   Caret caret1 = editor1.getCaret();
   Point pt2 = caret1.getMagicCaretPosition(); // the end of the string
   double x2 = pt2.getX();
   double y2 = pt2.getY();
   if (((x2 > x1) && (x2 < (x1 + r1width))) && ((y2 > y1) && (y2 < (y1 + r1height)))) {
     // inview
   } else {
     double newheight = r1height / 2;
     double newwidth = r1width / 2;
     double x3 = pt2.getX() - newwidth;
     double y3 = pt2.getY() - newheight;
     if (x3 < 0) x3 = 0;
     if (y3 < 0) y3 = 0;
     Rectangle rect3 = new Rectangle((int) x3, (int) y3, (int) newwidth, (int) newheight);
     editor1.scrollRectToVisible(rect3);
   }
 } // end scrollToCaret
コード例 #3
0
 public Geobuf.Data.Geometry pointToGeobuf(Point point) {
   return Geobuf.Data.Geometry.newBuilder()
       .setType(Geobuf.Data.Geometry.Type.POINT)
       .addCoords((long) (point.getX() * precisionMultiplier))
       .addCoords((long) (point.getY() * precisionMultiplier))
       .build();
 }
コード例 #4
0
ファイル: LoginBox.java プロジェクト: timburrow/ovj3
  /** Write file with position and size of the login box */
  public static void writePersistence() {

    Messages.postDebug("LoginBox", "LoginBox.writePersistence");
    // If the panel has not been created, don't try to write a file
    if (position == null) return;

    String filepath = FileUtil.savePath("USER/PERSISTENCE/LoginPanel");

    FileWriter fw;
    PrintWriter os;
    try {
      File file = new File(filepath);
      fw = new FileWriter(file);
      os = new PrintWriter(fw);
      os.println("Login Panel");

      os.println(height);
      os.println(width);
      double xd = position.getX();
      int xi = (int) xd;
      os.println(xi);
      double yd = position.getY();
      int yi = (int) yd;
      os.println(yi);

      os.close();
    } catch (Exception er) {
      Messages.postError("Problem creating  " + filepath);
      Messages.writeStackTrace(er);
    }
  }
コード例 #5
0
  private void showSliderMenu() {
    Point location = new Point(getX(), getY() + getHeight());

    SwingUtilities.convertPointToScreen(location, InputVolumeControlButton.this.getParent());

    if (isFullScreen()) {
      location.setLocation(
          location.getX(),
          location.getY() - sliderMenu.getPreferredSize().getHeight() - getHeight());
    }

    sliderMenu.setLocation(location);

    sliderMenu.addPopupMenuListener(
        new PopupMenuListener() {
          public void popupMenuWillBecomeVisible(PopupMenuEvent ev) {
            sliderMenuIsVisible = true;
          }

          public void popupMenuWillBecomeInvisible(PopupMenuEvent ev) {
            sliderMenuIsVisible = false;
          }

          public void popupMenuCanceled(PopupMenuEvent ev) {}
        });

    sliderMenu.setVisible(!sliderMenu.isVisible());
  }
コード例 #6
0
 /** Returns the coordinates of the top left corner of the value at the given index. */
 public Point getCoordinates(int index) {
   JScrollBar bar = scrollPane.getVerticalScrollBar();
   Rectangle r = segmentTable.getCellRect(index, 1, true);
   segmentTable.scrollRectToVisible(r);
   setTopLevelLocation();
   return new Point(
       (int) (r.getX() + topLevelLocation.getX()), (int) (r.getY() + topLevelLocation.getY()));
 }
コード例 #7
0
ファイル: BoardImpl.java プロジェクト: alhenk/snake
 @Override
 public List<Point> getFreeCells() {
   List<Point> result = new LinkedList<Point>();
   for (Point cell : getCells()) {
     boolean isSapper = cell.equals(getSapper());
     boolean isBoard =
         cell.getX() == 0
             || cell.getY() == 0
             || cell.getX() == size.getValue() - 1
             || cell.getY() == size.getValue() - 1; // TODO test me
     boolean isMine = isMine(cell);
     if (!isSapper && !isMine && !isBoard) {
       result.add(cell);
     }
   }
   return result;
 }
コード例 #8
0
ファイル: FirePower.java プロジェクト: wuilkysb/net-bomberman
 public void run() {
   picNo++;
   if (picNo == imageLen) {
     timer.cancel();
     map[(int) p.getX()][(int) p.getY()][1] = null;
     interfaz.refresh();
     return;
   }
   image = orgImage.getSubimage(0 + picNo * 32, picType * 32, 32, 32);
   interfaz.refresh();
 }
コード例 #9
0
  public void parseFile(Plate plate, String attributeName, File envisionFile) {

    Sheet sheet = StringTable.openWorkSheet(envisionFile).getSheetAt(0);

    Point tableTopLeftPos = StringTable.findNextPlatePosition(sheet, new Point(1, 1));

    int numSkipTables = propTableIndex.getIntValue() - 1;
    while (tableTopLeftPos != null && numSkipTables > 0) {
      tableTopLeftPos =
          StringTable.findNextPlatePosition(
              sheet, new Point((int) tableTopLeftPos.getX(), (int) (tableTopLeftPos.getY() + 1)));
      numSkipTables--;
    }

    if (tableTopLeftPos == null) {
      throw new RuntimeException("Could not find readout-table in file " + envisionFile);
    }

    Rectangle tableBounds = StringTable.guessPlateBounds(sheet, tableTopLeftPos);
    StringTable envisionTable = StringTable.readStringGridFromExcel(tableBounds, sheet);

    // either set the plate dimensions or validate them
    if (plate.getNumRows() < 0) {
      plate.setNumColumns(envisionTable.getWidth() - 1);
      plate.setNumRows(envisionTable.getHeight() - 1);
    } else {
      assert envisionTable.getWidth() - 1 == plate.getNumColumns();
      assert envisionTable.getHeight() - 1 == plate.getNumRows();
    }

    for (int colIndex = 0; colIndex < plate.getNumColumns(); colIndex++) {
      for (int rowIndex = 0; rowIndex < plate.getNumRows(); rowIndex++) {
        int plateRow = rowIndex + 1; // this inversion looks weired but it is correct
        int plateColumn = colIndex + 1;

        Well well = plate.getWell(plateColumn, plateRow);
        if (well == null) {
          well = new Well();

          well.setPlateRow(plateRow);
          well.setPlateColumn(plateColumn);
          well.setPlate(plate);

          plate.addWell(well);
        }

        Double readout = ScreenImportUtils.parseDouble(envisionTable.get(plateRow, plateColumn));
        if (readout != null) {
          well.getWellStatistics().put(attributeName, readout);
        }
      }
    }
  }
コード例 #10
0
ファイル: AOJ0081.java プロジェクト: t8m8/AOJ
 static void solve() {
   String[] s = in.next().split(",");
   Point p =
       reflect(
           new Line(
               Double.parseDouble(s[0]),
               Double.parseDouble(s[1]),
               Double.parseDouble(s[2]),
               Double.parseDouble(s[3])),
           new Point(Double.parseDouble(s[4]), Double.parseDouble(s[5])));
   out.println(p.getX() + " " + p.getY());
 }
コード例 #11
0
ファイル: ColorPickerPanel.java プロジェクト: ryokbys/Akira
        public void mousePressed(MouseEvent e) {
          requestFocus();
          Point p = e.getPoint();
          int size =
              Math.min(
                  MAX_SIZE,
                  Math.min(
                      getWidth() - imagePadding.left - imagePadding.right,
                      getHeight() - imagePadding.top - imagePadding.bottom));
          p.translate(-(getWidth() / 2 - size / 2), -(getHeight() / 2 - size / 2));
          if (mode == ColorPicker.BRI || mode == ColorPicker.SAT) {
            // the two circular views:
            double radius = ((double) size) / 2.0;
            double x = p.getX() - size / 2.0;
            double y = p.getY() - size / 2.0;
            double r = Math.sqrt(x * x + y * y) / radius;
            double theta = Math.atan2(y, x) / (Math.PI * 2.0);

            if (r > 1) r = 1;

            if (mode == ColorPicker.BRI) {
              setHSB((float) (theta + .25f), (float) (r), bri);
            } else {
              setHSB((float) (theta + .25f), sat, (float) (r));
            }
          } else if (mode == ColorPicker.HUE) {
            float s = ((float) p.x) / ((float) size);
            float b = ((float) p.y) / ((float) size);
            if (s < 0) s = 0;
            if (s > 1) s = 1;
            if (b < 0) b = 0;
            if (b > 1) b = 1;
            setHSB(hue, s, b);
          } else {
            int x2 = p.x * 255 / size;
            int y2 = p.y * 255 / size;
            if (x2 < 0) x2 = 0;
            if (x2 > 255) x2 = 255;
            if (y2 < 0) y2 = 0;
            if (y2 > 255) y2 = 255;

            if (mode == ColorPicker.RED) {
              setRGB(red, x2, y2);
            } else if (mode == ColorPicker.GREEN) {
              setRGB(x2, green, y2);
            } else {
              setRGB(x2, y2, blue);
            }
          }
        }
コード例 #12
0
ファイル: NodeRenderer.java プロジェクト: jamartinb/dinapter
 public void paintComponent(Graphics g) {
   if (position == null) return;
   int x = (int) position.getX();
   int y = (int) position.getY();
   if (parent.inFirstPath(this)) {
     g.setColor(Color.yellow);
     g.fillOval(x - RADIUS, y - RADIUS, 2 * RADIUS, 2 * RADIUS);
   } else if (parent.inQueue(this)) {
     g.setColor(Color.orange);
     g.fillOval(x - RADIUS, y - RADIUS, 2 * RADIUS, 2 * RADIUS);
   }
   g.setColor(getColor());
   g.drawOval(x - RADIUS, y - RADIUS, 2 * RADIUS, 2 * RADIUS);
   if (parent.isGoalNode(this)) g.setColor(Color.green);
   else if (parent.isStartNode(this)) g.setColor(Color.blue);
   g.drawString(toString(), x, y);
   if (!parent.getHideHeur()) g.drawString(model.getHeuristic() + "", x + RADIUS, y + RADIUS);
 }
コード例 #13
0
  /**
   * @param className объект класса, позицию фрейма которого нужно получить
   * @return координату фрейма
   */
  public Point getWindowLocation(Class className) {
    if (locationWindows == null) locationWindows = new HashMap<>();

    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension frameSize = getWindowSize(className);
    if (!locationWindows.containsKey(className)) {
      Integer x = (int) (screenSize.width / 2 - frameSize.getWidth() / 2);
      Integer y = (int) (screenSize.height / 2 - frameSize.getHeight() / 2);
      locationWindows.put(className, new Point(x, y));
    }

    Point point = locationWindows.get(className);
    if (screenSize.getWidth() < point.getX() + frameSize.getWidth()
        || screenSize.getHeight() < point.getY() + frameSize.getHeight()) {
      Integer x = (int) (screenSize.width / 2 - frameSize.getWidth() / 2);
      Integer y = (int) (screenSize.height / 2 - frameSize.getHeight() / 2);
      point = new Point(x, y);
      locationWindows.put(className, point);
    }

    return point;
  }
コード例 #14
0
  /**
   * Wrapper method around the <tt>paintText()</tt> method of the <tt>VisualEdgePainter</tt>
   * interface. This method performs the calculation to determine the position where the text will
   * be drawn.
   */
  private void paintText(VisualEdge vEdge, Graphics2D g2d) {
    Point fromPoint = new Point();
    Point toPoint = new Point();
    GeneralPath gPath = vEdge.getGeneralPath();
    PathIterator iterator = gPath.getPathIterator(null);
    FontMetrics fontMetrics;
    float edgeSegment[] = new float[6];
    double currentLength = 0;
    float cumulativeLength = 0;
    float x1 = 0, y1 = 0, x2 = 0, y2 = 0;
    int segmentType;
    boolean firstPointInitialized = false;

    // Get the total length of the edge
    float edgeLength = vEdge.getEdgeLength(vEdge, fromPoint, toPoint);

    while (!iterator.isDone()) {
      segmentType = iterator.currentSegment(edgeSegment);

      switch (segmentType) {
        case PathIterator.SEG_LINETO:
        case PathIterator.SEG_MOVETO:
          x2 = edgeSegment[0];
          y2 = edgeSegment[1];
          break;
        case PathIterator.SEG_QUADTO:
          x2 = edgeSegment[2];
          y2 = edgeSegment[3];
          break;
        case PathIterator.SEG_CUBICTO:
          x2 = edgeSegment[4];
          y2 = edgeSegment[5];
      }

      if (firstPointInitialized) {
        currentLength = Point2D.distance(x1, y1, x2, y2);
        cumulativeLength += currentLength;
      }

      iterator.next();

      // If we are halfway through the length of the edge,
      // then paint the text
      if (cumulativeLength >= (edgeLength / 2) || cumulativeLength >= edgeLength) {
        // Ratio of the remaining half-length over the length of the current edge
        double ratio = ((edgeLength / 2) - (cumulativeLength - currentLength)) / currentLength;
        fontMetrics = vEdge.getFontMetrics();

        // Take into account the text's length
        this.paintText(
            g2d,
            vEdge.getFont(),
            vEdge.getFontcolor(),
            vEdge.getLabel(),
            (float)
                    (fromPoint.getX() < toPoint.getX()
                        ? (x1 + (Math.abs(x2 - x1) * ratio))
                        : (x1 - (Math.abs(x2 - x1) * ratio)))
                - fontMetrics.stringWidth(vEdge.getLabel()) / 2,
            (float)
                (fromPoint.getY() < toPoint.getY()
                    ? (y1 + (Math.abs(y2 - y1) * ratio))
                    : (y1 - (Math.abs(y2 - y1) * ratio))));
        break;
      }

      x1 = x2;
      y1 = y2;

      if (!firstPointInitialized) {
        firstPointInitialized = true;
      }
    }
  }
コード例 #15
0
  /**
   * Shows/hides the security panel.
   *
   * @param isVisible <tt>true</tt> to show the security panel, <tt>false</tt> to hide it
   */
  public void setSecurityPanelVisible(final boolean isVisible) {
    if (!SwingUtilities.isEventDispatchThread()) {
      SwingUtilities.invokeLater(
          new Runnable() {
            public void run() {
              setSecurityPanelVisible(isVisible);
            }
          });
      return;
    }

    final JFrame callFrame = callRenderer.getCallContainer().getCallWindow().getFrame();

    final JPanel glassPane = (JPanel) callFrame.getGlassPane();

    if (!isVisible) {
      // Need to hide the security panel explicitly in order to keep the
      // fade effect.
      securityPanel.setVisible(false);
      glassPane.setVisible(false);
      glassPane.removeAll();
    } else {
      glassPane.setLayout(null);
      glassPane.addMouseListener(
          new MouseListener() {
            public void mouseClicked(MouseEvent e) {
              redispatchMouseEvent(glassPane, e);
            }

            public void mouseEntered(MouseEvent e) {
              redispatchMouseEvent(glassPane, e);
            }

            public void mouseExited(MouseEvent e) {
              redispatchMouseEvent(glassPane, e);
            }

            public void mousePressed(MouseEvent e) {
              redispatchMouseEvent(glassPane, e);
            }

            public void mouseReleased(MouseEvent e) {
              redispatchMouseEvent(glassPane, e);
            }
          });

      Point securityLabelPoint = securityStatusLabel.getLocation();

      Point newPoint =
          SwingUtilities.convertPoint(
              securityStatusLabel.getParent(),
              securityLabelPoint.x,
              securityLabelPoint.y,
              callFrame);

      securityPanel.setBeginPoint(new Point((int) newPoint.getX() + 15, 0));
      securityPanel.setBounds(0, (int) newPoint.getY() - 5, this.getWidth(), 130);

      glassPane.add(securityPanel);
      // Need to show the security panel explicitly in order to keep the
      // fade effect.
      securityPanel.setVisible(true);
      glassPane.setVisible(true);

      glassPane.addComponentListener(
          new ComponentAdapter() {
            /** Invoked when the component's size changes. */
            @Override
            public void componentResized(ComponentEvent e) {
              if (glassPane.isVisible()) {
                glassPane.setVisible(false);
                callFrame.removeComponentListener(this);
              }
            }
          });
    }
  }
コード例 #16
0
ファイル: NodeRenderer.java プロジェクト: jamartinb/dinapter
 boolean containsPoint(Point p) {
   if (position == null) return false;
   return Math.pow(p.getX() - position.getX(), 2) + Math.pow(p.getY() - position.getY(), 2)
       <= Math.pow(RADIUS, 2);
 }
コード例 #17
0
ファイル: AOJ0081.java プロジェクト: t8m8/AOJ
 public String toString() {
   return "[(" + p1.getX() + "," + p1.getY() + "),(" + p2.getX() + "," + p2.getY() + ")]";
 }
コード例 #18
0
ファイル: AOJ0081.java プロジェクト: t8m8/AOJ
 public double getX2() {
   return p2.getX();
 }
コード例 #19
0
ファイル: AOJ0081.java プロジェクト: t8m8/AOJ
 public double getX1() {
   return p1.getX();
 }
コード例 #20
0
ファイル: AOJ0081.java プロジェクト: t8m8/AOJ
 public Vector plus(Point p) {
   return new Vector(this.x + p.getX(), this.y + p.getY());
 }
コード例 #21
0
ファイル: VTabbedToolPanel.java プロジェクト: timburrow/ovj3
    public void mouseClicked(MouseEvent evt) {
      int btn = evt.getButton();
      if (btn == MouseEvent.BUTTON3) {
        JPopupMenu helpMenu = new JPopupMenu();
        String helpLabel = Util.getLabel("CSHMenu");
        JMenuItem helpMenuItem = new JMenuItem(helpLabel);
        helpMenuItem.setActionCommand("help");
        helpMenu.add(helpMenuItem);

        ActionListener alMenuItem =
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                String topic = "";
                try {
                  JComponent c1 = (JComponent) tabbedPane.getSelectedComponent();
                  // This component should contain the following embedded items.
                  // We want m_helplink out of the top VGroup.
                  //   PushpinObj
                  //     XMLToolPanel
                  //       JScrollpane
                  //         JViewport
                  //           JPanel
                  //             VGroup
                  // Work down to the VGroup, checking for class type along
                  // the way.
                  if (c1 instanceof PushpinObj) {
                    Component c2[] = c1.getComponents();
                    int cnt;
                    for (cnt = 0; cnt < c2.length; cnt++) {
                      // The PushpinObj can have multiple items, find the one we want
                      if (c2[cnt] instanceof XMLToolPanel) break;
                    }
                    if (cnt < c2.length && c2[cnt] instanceof XMLToolPanel) {
                      Component c3[] = ((JComponent) c2[cnt]).getComponents();
                      if (c3[0] instanceof JScrollPane) {
                        Component c4[] = ((JComponent) c3[0]).getComponents();
                        if (c4[0] instanceof JViewport) {
                          Component c5[] = ((JComponent) c4[0]).getComponents();
                          if (c5[0] instanceof JPanel) {
                            Component c6[] = ((JComponent) c5[0]).getComponents();
                            if (c6[0] instanceof VGroup) {
                              // Get the helplink info from the VGroup
                              topic = ((VGroup) c6[0]).getAttribute(VObjDef.HELPLINK);
                            }
                          }
                        }
                      }
                    }
                  }
                  // If no helplink found, try the Tab's name
                  if (topic == null || topic.length() == 0) {
                    topic = c1.getName();
                    if (topic.equals("Locator")) topic = getLocatorName();
                    topic = topic.replace(" ", "_");
                  }
                } catch (Exception ex) {
                }
                // Get the ID and display the help content
                CSH_Util.displayCSHelp(topic);
              }
            };
        helpMenuItem.addActionListener(alMenuItem);

        Point pt = evt.getPoint();
        helpMenu.show(VTabbedToolPanel.this, (int) pt.getX(), (int) pt.getY());
      }
    }
コード例 #22
0
ファイル: KnightMoves.java プロジェクト: pmauviel/pmIGN
  // Check all possible moves, avoiding going off the board and repeating a square
  private static void calculateMoves(LinkedList list, Point pos, int[][] board) {
    // Up - Left
    if (pos.getX() - 1 >= 0 && pos.getY() + 2 < sizey) {
      Point p = new Point(pos.getX() - 1, pos.getY() + 2);

      if (board[p.getX()][p.getY()] == 0) {
        list.add(p);
      }
    }

    // Up - Right
    if (pos.getX() + 1 < sizex && pos.getY() + 2 < sizey) {
      Point p = new Point(pos.getX() + 1, pos.getY() + 2);
      if (board[p.getX()][p.getY()] == 0) {
        list.add(p);
      }
    }

    // Right - Up
    if (pos.getX() + 2 < sizex && pos.getY() + 1 < sizey) {
      Point p = new Point(pos.getX() + 2, pos.getY() + 1);
      if (board[p.getX()][p.getY()] == 0) {
        list.add(p);
      }
    }

    // Right - Down
    if (pos.getX() + 2 < sizex && pos.getY() - 1 >= 0) {
      Point p = new Point(pos.getX() + 2, pos.getY() - 1);
      if (board[p.getX()][p.getY()] == 0) {
        list.add(p);
      }
    }

    // Down - Left
    if (pos.getX() - 1 >= 0 && pos.getY() - 2 >= 0) {
      Point p = new Point(pos.getX() - 1, pos.getY() - 2);
      if (board[p.getX()][p.getY()] == 0) {
        list.add(p);
      }
    }

    // Down - Right
    if (pos.getX() + 1 < sizex && pos.getY() - 2 >= 0) {
      Point p = new Point(pos.getX() + 1, pos.getY() - 2);
      if (board[p.getX()][p.getY()] == 0) {
        list.add(p);
      }
    }

    // Left - Up
    if (pos.getX() - 2 >= 0 && pos.getY() + 1 < sizey) {
      Point p = new Point(pos.getX() - 2, pos.getY() + 1);
      if (board[p.getX()][p.getY()] == 0) {
        list.add(p);
      }
    }

    // Left - Down
    if (pos.getX() - 2 >= 0 && pos.getY() - 1 >= 0) {
      Point p = new Point(pos.getX() - 2, pos.getY() - 1);
      if (board[p.getX()][p.getY()] == 0) {
        list.add(p);
      }
    }
  }
コード例 #23
0
ファイル: KnightMoves.java プロジェクト: pmauviel/pmIGN
  private static void getAnswer(int[][] board, Point pos, int numberOfMoves) {

    // Set square just moved to the numberOfMoves
    board[pos.getX()][pos.getY()] = numberOfMoves;

    // Check winning conditions.
    if (checkBoard(board)) {
      return;
    }

    // will hold possible moves from current square
    LinkedList moves = new LinkedList();

    // fills the moves List
    calculateMoves(moves, pos, board);

    // iterator for list
    ListIterator iter = moves.listIterator();

    Point p; // Current possible move

    if (moves.isEmpty()) {
      // no possible moves in direct viscinity
      return;
    } else {

      // holds each move's possible moves
      LinkedList temporaryList;

      // List with shortest size from possible moves
      LinkedList finalList = new LinkedList();

      // next move
      Point nextPoint = new Point(0, 0);

      while (iter.hasNext()) {

        // p is now next possible move
        p = (Point) (iter.next());

        // create a new empty List
        temporaryList = new LinkedList();

        // fill List with possible moves from Point p
        calculateMoves(temporaryList, p, board);

        /* If the temporary list is smaller than the current best
         * answer's List, then replace it and change the current best
         * answer.
         */

        if (finalList.size() > temporaryList.size() || finalList.size() == 0) {
          finalList = temporaryList;
          nextPoint = new Point(p);
        }
      }

      // Move on and continue.
      getAnswer(board, nextPoint, numberOfMoves + 1);
    }
  }
コード例 #24
0
 public void setPopupLocation(Point location) {
   setPopupLocation((int) location.getX(), (int) location.getY());
 }
コード例 #25
0
ファイル: AOJ0081.java プロジェクト: t8m8/AOJ
 public Vector(Point target, Point source) {
   this.x = target.getX() - source.getX();
   this.y = target.getY() - source.getY();
 }