- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 8
- Posts with Upvotes
- 8
- Upvoting Members
- 8
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
High school student
- PC Specs
- MacBook Pro 17", 2.5 GHz Intel Core 2 Duo, 2 GB RAM, 1920x1200 LED-backlit display
45 Posted Topics
![]() | Re: The Toolkit class provides you with a method [inlinecode]createCustomCursor(Image cursor, Point hotspot, String name)[/inlinecode]. [inlinecode]cursor[/inlinecode] is the Image of the cursor, [inlinecode]hotspot[/inlinecode] is point from the top left corner of the Image where the actual click of the cursor is, and [inlinecode]name[/inlinecode] is just the name of the cursor. Anyway, … |
Re: You'd compare an object to [icode]null[/icode] with [icode]==[/icode]. I think you want one of the following. It's hard to determine the exact behavior you're looking for from your code. [code=Java]if (child == null) child = new Lista(c, null); // Or: if (child.getData() == null) child = new Lista(c, null);[/code] | |
Re: Do you have a firewall that's getting in the way? | |
Re: Use [icode]==[/icode] to compare values; [icode]=[/icode] performs [i]assignment[/i], not comparison. | |
Re: Your post did not get formatted correctly. Please edit it to use code tags. | |
Re: Java doesn't support creating variable names dynamically. | |
Re: Applets shouldn't have constructors because an applet isn't guaranteed to have a full environment until [icode]init[/icode] is called. So the code you would normally put in your constructor should go into the [icode]init()[/icode] method. Also, things such as width and height of an are automagically pulled from the HTML for … | |
Re: This topic was [url=http://www.daniweb.com/forums/thread155995.html]recently discussed[/url]. | |
Re: Can you edit your post to include code tags please? [[i][/i]code=Java] your code here [[i][/i]/code] | |
Re: [QUOTE=dickersonka;732548]masijade is correct, i think its more of a convention to follow though[/QUOTE] It's not just a convention, it's a good programming practice. If you incorrectly attempt to override a superclass's method without the annotation, your error will be [i]silently ignored[/i]. If you do include it, you will get a … | |
Re: [url]http://forums.devshed.com/java-help-9/java-help-plz-569400.html[/url] | |
Re: I'll go through each of the errors I see. 1) [icode]new int[5] //Constructing the array[/icode] This line does nothing useful and is missing a semicolon. You should remove the line completely. 2) [icode]int[0] = input.nextInt[/icode] This line should be using the variable name, not the variable type to reference the … | |
Re: Objects are destroyed for you by the garbage collector. | |
Re: [QUOTE=stultuske;729819]I take it getRadius is a method, so call it like a method, not like some static variable[/QUOTE] You mean public variable. | |
Re: Keep in mind you aren't looping here, so the sum variable is not doing anything useful. You can rewrite javaAddict's code to be like this: [code=Java]public static int myMethod(int counter) { if (counter == 0) return 0; else return counter + myMethod(counter - 1); }[/code] | |
Re: You have all the right logic, you're just missing half a line. Looks like a silly mistake on your part. [code]char c = word.charAt(0); [b]reverseWord += [/b]reverse(word.substring(1)); reverseWord += c;[/code] | |
Re: A superclass must always be constructed before its children. There are two things that are implicit in your MainClass class. 1) Since you did not specify any constructors, you have an implicit default constructor: [code=Java]public MainClass() { }[/code] 2) Since you did not specify which constructor for your superclass to … | |
Re: You have to compare each one explicitly. [code=Java]boolean invalidColor = (FColour != 'B' && FColour != 'L' && FColour != 'W' && FColour != 'R' && FColour != 'Y' && FColour != 'G');[/code] | |
Re: Every class has a [icode]hashCode[/icode] method. Just don't use the URL class for this because it's broken. use the URI class. | |
Re: The [icode]java.util.Stack[/icode] class is a legacy class. You should use the [icode]java.util.Deque[/icode] interface instead, which supports LIFO. | |
Re: Is this just a syntax question? Because your psuedocode is (nearly) correct. [code=Java]// MyObject is the class of the object you want to compare public boolean(MyObject obj1, MyObject obj2){ if (obj1.getSomeProperty() == obj2.getSomeProperty()) return true; else return false }[/code] Or, more simply: [code=Java]public boolean(MyObject obj1, MyObject obj2){ return obj1.getSomeProperty() == … | |
Re: [QUOTE=vladdy191;729445]I'm trying to read in a text file character by character. However, when I try to read it in it using the readChar method in DataInputStream it gives me a IOException. Heres what I have so far [CODE] FileInputStream stream; try { // Open an input stream stream = new … | |
Re: The [icode]Math[/icode] class is imported by default; you don't need to import it manually. masijade was suggesting that you [i]look in that class[/i] for a method that might be useful to you. | |
Re: Try Googling "validating JTextField." First result was your question covered in depth: [url]http://java.sun.com/developer/JDCTechTips/2001/tt1120.html[/url] | |
Re: This is what files are for. Just store the data from the non-Java application into a file, and then read that data from your Java application. | |
Re: What is with the poll? | |
Re: Please post an [url=http://mindprod.com/jgloss/sscce.html]SSCCE[/url] so that it is easier for us to help you. You're posting a lot of extraneous code if all you need help with is removing a node from a linked-list. | |
Re: How can [icode]hashCode[/icode] be returning [icode]null[/icode]? [icode]hashCode[/icode] returns an [icode]int[/icode]. Also, if you are using the [icode]URL[/icode] class, don't. Its [icode]equals[/icode] and [icode]hashCode[/icode] methods are broken. Use the [icode]URI[/icode] class instead. | |
Re: Can you post a [URL="http://mindprod.com/jgloss/sscce.html"]SSCCE[/URL] to demonstrate your problem? | |
Re: Just wondering... why do you want to do this? The BigInteger class is immutable, so two instances sharing memory will never be a problem. | |
Re: Have you attempted this yet? Also, please use code tags to post code. | |
Re: So you need to get input from a user and store it in a text file? By the way, ".txt" is the extension typically used for a text file. | |
Re: Being helped already over [URL="http://forums.devshed.com/java-help-9/while-loop-566648.html"]here[/URL]. | |
Re: You don't need to use a loop if you take advantage of the API. If you take the length of the array returned "scanning" for your substring with [inlinecode]String#scan[/inlinecode], you will have number of occurrences of that substring. | |
Re: Here's a recursive one in Java since it seems no one has done one recursively or done one in Java. [b]Java[/b] [code] public static void main(String[] args) { System.out.println(count(1, 10)); } private static String count(int min, int max) { if (min > max) { return ""; } else { return … | |
Re: [QUOTE=totalnewb++]this is the email I recieved from her: the function should get its input from the parameter list, not directly from the user. For most functions, there shouldn’t be anything that deals with computer’s user interface such as keyboard or monitor. Please change this program and resend. Thanks. Thank you … | |
Re: You can just add a listener to each button. [code] JButton[] buttonArray = new JButton[25]; for (int i = 0; i < buttonArray.length; i++) { buttonArray[i] = new JButton(String.valueOf(i + 1)); buttonArray[i].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.out.println("actionPerformed(ActionEvent)"); } }); // maybe set location of buttonArray[i] // maybe … | |
Re: [QUOTE=fdrage]for a start tidy your code up... declare all the variables at the top before even using them[/QUOTE] No, don't declare all your variables at the top. Declare them at the beginning of their scope. Eg: [quote=Java's Coding Conventions][code] void myMethod() { int int1 = 0; // beginning of method … | |
Re: Your syntax for if statements is wrong. The syntax is as follows: [code] if (someCondition) { // do something }[/code] | |
My title might be a bit misleading; I've created many games before and did know where to start with those. Now, after creating many easy arcade games (pong, tetris, hardball, and several fight games), I'm getting bored. I would like to start writing a RPG. I don't plan on the … | |
Re: [QUOTE=porterrj]void displayStars (int rows, int cols) { for (int across = 0; across < rows; across++) { for (int down = 0; down < cols; down++) cout << "*"; cout <<endl; } }[/QUOTE] Well... You need to check for conditions. [code] void drawRect(int width, int height) { for (int i … |
The End.