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)...
Type: Posts; User: Trunk Monkeey
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)...
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:
...
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...
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...
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.
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...
I got rid of the inset but whenever I make y or x larger there is nothing in the 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.
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
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...
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...
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...
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
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...
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...
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...
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...
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.
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>();
...
Ah yeah I forgot that everything is one less in an array
thanks
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...
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...
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...
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:
...
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
{
...