Search:

Type: Posts; User: Trunk Monkeey

Search: Search took 0.29 seconds.

  1. Replies
    0
    Views
    144

    Cloning object problem

    So I am trying to clone an Object MyGraph and it contains two arraylists for vertices and edges. My code so far is:


    public static MyGraph deepCopy(MyGraph G){
    MyGraph Copy = (MyGraph)...
  2. Replies
    1
    Views
    699

    If arraylist value is null

    So I have written a for loop that will go through my arraylist and should check if the value is empty. When it finds an empty arraylist value it will add the new vertex. So far it is like this:

    ...
  3. Replies
    2
    Views
    440

    Re: Source from a JComboBox

    I changed it so the action listener is set to the combo box instead of the button and it prints when I click on one of the options in the drop down box, but I wanted it so that you select the option...
  4. Replies
    2
    Views
    440

    Source from a JComboBox

    So I have a JComboBox and a button. I want the user to select an option from the combo box, then click the delete button which will call the action listener:


    ActionListener DeleteVert = new...
  5. Replies
    4
    Views
    1,278

    Re: Action Listener in a static method

    There isn't an exception. Its just that nothing is happening. The frame should pop up once I press the button but it does nothing.
  6. Replies
    4
    Views
    1,278

    Action Listener in a static method

    So I am trying to make a button that opens a new frame.

    The problem is that my main method is static so I can't put an action listener in the main part. I assume that I can make another class to...
  7. Replies
    11
    Views
    781

    Re: Points in a JPanel

    I got rid of the inset but whenever I make y or x larger there is nothing in the JPanel
  8. Replies
    11
    Views
    781

    Re: Points in a JPanel

    Well h and w are 10 and x and y range between like 1-10

    If I try to put a higher value for x and y nothing will come up.
  9. Replies
    11
    Views
    781

    Re: Points in a JPanel

    Yeah I put in some print statements and I tried just changing the numbers of h and w but it stays the same size but with less points
  10. Replies
    11
    Views
    781

    Re: Points in a JPanel

    So at this point:


    for (int i=0; i<1000; i++) {
    int x = r.nextInt() % w;
    int y = r.nextInt() % h;
    g2d.drawLine(x, y, x, y);
    }

    What should I...
  11. Replies
    11
    Views
    781

    Re: Points in a JPanel

    The GUI and the JPanel work alright

    the points are the problem. The area they are drawn into is really small and when I try to change the size of the area it doesn't work at all

    So I want the...
  12. Replies
    11
    Views
    781

    Points in a JPanel

    So i am making a GUI that lets you add in vertices onto a JPanel and so far I have:


    import javax.swing.*;

    import java.awt.*;
    import java.util.ArrayList;
    import java.awt.Dimension;
    import...
  13. Replies
    7
    Views
    780

    Re: undo delete method

    Well I was thinking that method would would be kind of similar to the deleting method only backwards and i'm assuming quite abit more coding
  14. Replies
    7
    Views
    780

    Re: undo delete method

    It is a big set of code we were given as part of our coursework. Its basically made up of Blocks which can linked together for the file system. I just couldn't think of how I could link up a...
  15. Replies
    7
    Views
    780

    Re: undo delete method

    Its an API file system, the method doesn't delete it just unlink the chain of blocks and can then be over written

    I want a method that would re-connect the block as long as it hasn't been over...
  16. Replies
    7
    Views
    780

    undo delete method

    So I have a method to delete a file from my file system but I wanted to write another method that could restore the previously deleted file. the only problem is I don't know how I would start writing...
  17. Replies
    1
    Views
    1,448

    Looping an inputstream

    So I am trying to write some code that checks each char of an inputstream if it is a number and adds them up. I can handle most of it but it is just that I don't really understand inputstreams.

    I...
  18. Replies
    3
    Views
    1,801

    Re: Basic treemap loop

    Well with the example I am doing I have to do it with either a treemap or a hashmap. I just need to know what I would put inside the brackets for a for loop so it will check through each record.
  19. Replies
    3
    Views
    1,801

    Basic treemap loop

    So I want to make a for loop for a tree map to get the highest number right now I have:



    public void findRichestInList()
    {
    bank = new TreeMap<String, Integer>();
    ...
  20. Replies
    5
    Views
    1,485

    Re: Basic array list

    Ah yeah I forgot that everything is one less in an array

    thanks
  21. Replies
    5
    Views
    1,485

    Basic array list

    I am trying practise questions on arrays but I am stuck on a question.
    It says to make a code which will return true if the first or last number is a 6.

    So far I have:
    public boolean...
  22. Replies
    23
    Views
    1,452

    Re: looping and arrays

    I know about while loops and I know abit about arraylists

    But I am not sure how I could write it so it would start to loop through the members

    I think I could get the rest but there is nothing...
  23. Replies
    23
    Views
    1,452

    Re: looping and arrays

    I only have the one arraylist which would have all the members that have joined

    I want a part of the code that checks each member on the list to see if they joined in that certain month and add a...
  24. Replies
    23
    Views
    1,452

    looping and arrays

    I am trying to write a method for a club that holds information on the members. The method is when a month is entered it will tell you how many members joined in that month. My code is like this:
    ...
  25. Replies
    1
    Views
    988

    expected

    So I am doing some questions for my programming class using blueJ and I am not very good

    But on the question we have to complete a code but I have started abit and got:

    public class Screen
    {
    ...
Results 1 to 25 of 25