Search:

Type: Posts; User: ice

Page 1 of 3 1 2 3

Search: Search took 0.20 seconds.

  1. Replies
    7
    Views
    3,053

    Re: Can scanner read the specified line?

    oh ok I see now.
    Thanks KevinWorkman.
  2. Replies
    7
    Views
    3,053

    Re: Can scanner read the specified line?

    Thank you so much JavaPF!! ..especially the example you provided.
    , you mean Scanner can read the specified line from a file? If so, then how to do that? :) 
  3. Replies
    7
    Views
    3,053

    Can scanner read the specified line?

    Hi guys

    Can Scanner read the specified line from user's input?

    For example, I want Scanner to find the 50th line of input and read it only, not from the first line, how to do that?

    Many...
  4. Replies
    13
    Views
    2,899

    Need explanation for this line of code

    Thank you guys.
    I got a piece of sample code here for shortest path, it is working. But I don't understand vertexQueue.remove(v), my understanding is "after executing Vertex u =...
  5. Replies
    7
    Views
    1,073

    Re: What can be legally inside FOR statement?

    ok, what about there are many lines of statements under for(int i = 0; i <= 5; ++i), EG.:

    for(int i = 0; i <= 5; ++i)
    System.out.println(i); // statements A
    ........................;...
  6. Replies
    7
    Views
    1,073

    Re: What can be legally inside FOR statement?

    :) I see....Thanks a lot for the explanation.
    so is still a kind of loop, but doesn't statement need to be wrapped inside a pair of {}? (otherwise how could it know which statement is the thing...
  7. Replies
    7
    Views
    1,073

    What can be legally inside FOR statement?

    Hi guys

    I have a question for how many ways to use FOR statement?
    I thought FOR is only used in starting a loop, like below two forms:
    for (initialization; termination; increment) or For each...
  8. Replies
    13
    Views
    2,899

    Re: CHALLENGE - find the shortest path

    Hi Helloworld922

    Thanks for your advice. ..If I really want to try those "ready-to-use" methods, do I just need to put "import org.graphstream.algorithm.Dijkstra" at the top? like import things...
  9. Replies
    1
    Views
    660

    The difference between two Java libraries

    Hi Guys

    Can anyone tell me - What is the difference between and ? (They all seem to provide methods of Classes)

    Thanks heaps
  10. Replies
    13
    Views
    2,899

    Re: CHALLENGE - find the shortest path

    I found these two mehtods getShortestPath() and treeWeight() provided in Class Dijkstra in below link: http://graphstream.sourceforge.net/javadoc/org/miv/graphstream/algorithm/Dijkstra.html
    Any idea...
  11. Replies
    13
    Views
    2,899

    Re: CHALLENGE - find the shortest path

    Thank you for your advice. :) Ok, will have two classes.

    If the cities are a number of vertexs, and put them into an arraylist, but how to show the connections between them?

    Thanks heaps
  12. Replies
    8
    Views
    1,289

    Re: How to define a string pattern using variables?

    ok, the english rule for a raod descriorion is:
    <roadName> <cityA> <AB distance> <cityB> [<BC distance> <cityC> […]]

    But how to write just one pattern in java that can represent above?

    Thanks...
  13. Replies
    8
    Views
    1,289

    Re: How to define a string pattern using variables?

    Thanks KevinWorkman, I didn't express my question well, I mean how to write a general pattern for a given string with string variables. For example:
    Here are some strings, each string represent one...
  14. Replies
    13
    Views
    2,899

    Re: CHALLENGE - find the shortest path

    Thank you helloworld!
    Dijkstra on Wikipedia gives below Pseudocode, I am surprised you said their pseudo-code can be used verbatim, it still looks far too simple to me. :o After reading the...
  15. Replies
    13
    Views
    2,899

    Re: CHALLENGE - find the shortest path

    ok, I have read class Dijkstra, I think the mehtods getShortestPath() and treeWeight() sounds useful, but I don't know how to use them.
    :) Any chance you could continue to tell me a bit more about...
  16. Replies
    13
    Views
    2,899

    CHALLENGE - find the shortest path

    Hi guys
    I got a CHALLENGE here, below question is From the ACM South Pacific Regional Programming Contest 2009. It is a bit long reading, :) hope you have some patience. Will anyone be able to tell...
  17. Replies
    8
    Views
    1,289

    How to define a string pattern using variables?

    Hi guys

    Firstly Happy new year to you soon,:) can someone please tell me this:

    I understand how to write a pattern with single character of regular-expression (eg. [a-zA-Z]), but how to define...
  18. Replies
    21
    Views
    4,329

    Re: How to drag the shape to move?

    oh, my god! It finally did it! =D>
    Thank u a lot copeg!!!
    :)
  19. Replies
    21
    Views
    4,329

    Re: How to drag the shape to move?

    Wow, it does have some magic! Now mouseClick part works, selectedOctagon can get selected. But something odd happened: As soon as I start to drag selectedOctagon, it moves very very quickly to...
  20. Replies
    21
    Views
    4,329

    Re: How to drag the shape to move?

    great, that souds promising, :) here is Octagon Class:

    import java.awt.*;
    import java.util.Random;

    public class Octagon extends Polygon
    {
    private int[] x;
    private int[] y;
    ...
  21. Replies
    21
    Views
    4,329

    Re: How to drag the shape to move?

    ok, after I tidied up the code to new one below, I think I have found out a big error here:
    selectedOctagon never got selected in the methods private Octagon hitTest(MouseEvent e) and public void...
  22. Replies
    21
    Views
    4,329

    Re: How to drag the shape to move?

    In fact I don't know what exact I should print to analyse; then I tried to put System.out.println(xtrans + " " + ytrans);inside mousedragged method, is that right thing to print? but it print out...
  23. Replies
    21
    Views
    4,329

    Re: How to drag the shape to move?

    Hi guys, don't give up here yet, the problem is still not solved yet.

    :-w
  24. Replies
    21
    Views
    4,329

    Re: How to drag the shape to move?

    Thanks copeg, but it didn't work out for me, I still don't know how to fix it. :o
    Is there any way yo point out the error inside the code?
    Thanks heaps
  25. Replies
    21
    Views
    4,329

    Re: How to drag the shape to move?

    How could System.out.println help it? It just simply print text out, I still don't know what is going on. As for debugger, I am hopeless on that. :o
    Is there other ways to tell whic part of code is...
Results 1 to 25 of 62
Page 1 of 3 1 2 3