- Upvotes Received
- 4
- Posts with Upvotes
- 4
- Upvoting Members
- 4
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
37 Posted Topics
Re: One doesn't not get a degree in computer programming, there is Computer Science, Software Engineering, Computer Engineering to name a few. Any of these degrees will require at least some programming skills, and an individual with on of these degrees could get a job that is primarily computer programming, but … | |
Re: In your drawing class, move is set to 10 and never changes. There are a few ways to fix this the first is: [CODE] //in the Drawing class public void paintComponent (Graphics g){ super.paintComponent(g); //This line calls the parent class, check out inheritance if you need a better explanation move++; … | |
Re: Have you tested this program? It looks like your Tile method will keep running until your computer runs out of RAM. | |
Re: You could try using JLabels instead of JButtons in the GUI, then in the keyListener change the background of the JLabel as needed. Do you have the keyListener defined in the same class as your JButtons? If not you may run into communication problems between the two. | |
Re: yes, I agree. If you decremented the seconds of 12:12:12, you would get 12:12:11. So I would try something like: [CODE] public void decrementSeconds() { sec--; if(sec < 0) { sec = 59; decrementMinutes(); } } [/CODE] Getting to 0 is the trigger to decrement, not 59. So when you … | |
Re: DefaultWeightedEdge.class is a simple edge factory. It is a default way of making your edges. So by calling that you save yourself the trouble of having to make and define your own edge factory. Take a look in the api [URL="http://www.jgrapht.org/javadoc/"]http://www.jgrapht.org/javadoc/[/URL] I hope this helps | |
Re: You have the main method in the MailClient.java. The only way I know to get that error is if you accidentally try to run a class with no main, so I would say try it again and make sure you run the MailClient class. | |
Re: I can hear the words of my Tech. Writing teacher. "Tech stuff is already difficult to understand, so there is absolutely no reason to make it harder than it needs to be. So apply the KISS principle liberally." I can understand the need for cleaner code especially for large projects. … | |
Re: You have a problem in your constructor. You are sending a parameter but you are not using the parameter to set the value of the private variable (private int choice). I added this one line to your code and it ran just fine. [CODE] //inside you constructor public Shapes(int UserChoice) … | |
Re: Please put you code in the code tags, this will make the code easier to read. Have you tried writing any of the code for Student.java? I'm not going to do your homework for you, but I will give you a simple example: [CODE] public class MyMain { public static … | |
Re: Do you want to take a String an make a char array out of it? If so, This is one way to do it. [CODE] String name = "Phillip"; char[] arrayName = new char[name.length()]; for(int i = 0; i < name.length(); i++)//.length() is a method for the String class, so … | |
Re: Is userNumber a String?(In the original code it isn't, but after following the posts it might be now) If userNumber is a String, you have to put parenthesis after length because it is a method of the String class Ex. [CODE] if(userNumber.length()<2){ //your code } else if(userNumber.length > 5){ //your … | |
Re: [CODE] Timer timer_1, timer_2; timer_1 = new Timer(new TimerAction1()); timer_2 = new Timer(new TimerAction2()); //the 2 timers call different methods //define the 2 methods class TimerAction1 implements ActionListener { public void actionPerformed(ActionEvent e) { //whatever you want the first timer to do } } class TimerAction2 implements ActionListener { public … | |
Re: masijade is right, since you are new to Java this is just a general structure that I use for Exceptions and Errors, [CODE] public static void main(String[] args) { try { //whatever class call may cause a Throwable Error/Exception //In this case: an instance of the Example class } catch(APossibleException) … | |
Re: Have you set the JLabels to any value? Based on the code snippets you've posted, you have instantiated the array, but not the elements in the array. Try, [CODE] for (int i = 0; i < mc.getTermYears(); i++) for (int v = 295; v <= 1; v += 25) { … | |
Re: On line 16: [CODE] int listsize = level.size()-1; [/CODE] The last element in an array is always the length(or size in this case) - 1. Your while loop is running one time too many. | |
Re: In your while loop, you have while(0 < 10). O will always be less than 10 so it would never come out of the while loop.You need: [CODE] while(counter < 10) [/CODE] You may want to use doubles for total, grade, and average. Integer division will drop off the decimal(i.e. … | |
Re: You need to look at the ASCII chart, and figure out what characters your program will look for.(i.e. 65-90 correspond to A-Z, 97-122 correspond to a-z) There is a distinction between upper case and lower case letters. I'll write in pseudo-code to get you started. [CODE] //import the Scanner class … | |
Re: Please post your code, it will make it easier to find the problem. | |
Re: Java doesn't support multiple inheritance because there are logical problems associated with multiple inheritance. Ex. Class1 Attributes: name, age....(ect.) Methods: toString(), ... (ect.) Class2 Attributes: name, number,...(ect.) Methods: toString(), ....(ect.) If MyNewClass where to inherit from both Class1 and Class2, there would be a problem. Does MyNewClass inherit its name … | |
Re: It looks like you code is working right, you just don't have a print statement that will make the table. [CODE] for(int i = 0; i < emp1.getCount(); i++) { emp1.getEmployee(i).toString()// } [/CODE] emp1.getEmployee(i) returns an Employee object, the toString() prints out the Employee object. This is how you would … | |
Re: Strings are not primitive types, so you can't use ==. you have to use the .equals("String") Ex. put this in the parenthesis of the if statement [CODE] if(choice.equals("1")) [/CODE] The == operator will only work with primitive types, since a String is an object, you have to use a method … | |
Re: The while loop should terminate when the user enters 0 for the variable value. You need to define value before the loop starts otherwise there will be errors [CODE] value = 1; while(value != 0)//when the user enter 0 the loop will terminate { //lines 11 - 63 go inside … | |
Re: Parsing - changes a String into a primitive data type(may be other uses) Casting - changes from one primitive data type to another, can also be used to cast objects. Use, if you have a string and need to convert it into a primitive type us Parsing i.e. [CODE] String … | |
Re: The method toUpper has a parameter, when you call the method you are not sending it a parameter. Line 18 is where you call the toUpper method. This is how is should look. [CODE] toUpper('a'); [/CODE] The reason why I took the System.out.println out of the code is because the … | |
Re: The String array is a good idea. It looks like you've got everything you need for the stats in the array. Are you trying to print the results in the endGame() method? I ask because you're using outText, but I couldn't find a place where you updated outText with the … | |
Re: Your base case for the recursive function covers all the possible outcomes. The reason why it only returns the first element is because that one of the base cases. [CODE] //int i will keep up with which element you are evaluating public String recursionMethod(int i) { File p = new … | |
Re: You can also try using the getActionCommand() inside the actionPerformed part of the listener. This function returns a String so you should be able to avoid casting. ![]() | |
Re: You are going to have to ask the user for 3 different things. 1. What kind of value are they entering (have them enter a char, ex. b for binary, d for decimal, h for hex) 2. What kind of value do they want to convert to. 3. The actual … | |
Re: Check out java.awt.geom in the Java API. The CubicCurve2D may work for you. | |
Hi, I'm new to DaniWeb, as implied by this self intro. I have an AA in Computer Science and am currently working on BA in Computer Science and am about a year away from graduating. Right now I am spending a lot of quality time with Java. Goodbye for now, … |
The End.