23 February 2005 - java_dev (original) (raw)

Java developers

February 23rd, 2005

08:08 am - hyper_goat - Curved Lines I'm not as advanced with Java as most of you seem to be, but I have a question.. For my AP Programming class, my teachers very hands off and lazy. I'm supposed to be making more advanced graphical applets, and when I say advanced.. I don't mean too advanced. But anyways, I need to learn how to draw a curved line in an applet, I've looked for a way to do this before, with no luck, and the teacher refuses to help me out here. Can anyone possibly give me an example of what I'd have to do to get a curved line? Any help would be appreciated.
08:29 am - erikwilson - Integer.parseInt() Hi everyone,I'm having a problem getting parseInt to work right.Here's my problem:Let's say I haveString string1 = "+9999999999";and I want to pull apart the sign and then the digits and store the digits in a new int.Currently I'm trying:StringTokenizer token = new StringTokenizer(string1, "+-"); String string2 = token.nextToken(); //THIS WILL RETURN A STRING WHICH IS "9999999999"Next I try to parse it to an integer:int int1 = Integer.parseInt(string2);However, when I do this, it throws a numberFormatException because my String is not in the proper format. I've every way I can think of to take string1 apart and store the digits but everyway results in a numberFormatException.Do anyone have any other ideas how I could do this or where I'm going wrong?
12:50 pm - jennjen I have to make a rock paper scissors game. I am having quite a bit of trouble just getting it so when the player clicks rock paper or scissors, it says "you chose rock" or "you chose paper" or "you chose scissors"
09:52 pm - fre0n Right... I'm fairly new to java so this is probably pretty basic...I'm trying to make a card game which uses swing components for the GUI. There are 3 computer players and after the player takes their turn each computer player plays in sequence. After the logic class plays the card I call a method in the view class which draws the last played card. Naturally this all happens too fast for the player to see anything but the card played by the final player so I tried adding Thread.sleep(1000) to the program to slow things down. However the result is that the frame goes grey. I think that perhaps pausing the main thread means that the repaint method is not being called for too long. On the other hand I don't know anything about GUIs (they taught me Perl at uni...) so what do I know? :)Does anyone have any suggestions for possible problems / fixes / reading i can do?Thanks