Please turn on javascript in your browser to play chess.
Developers Forum

Developers Forum

  1. Donation !~TONY~!
    1...c5!
    23 May '04 03:39
    Ok, so in my AP CompSci class we have to make a final project, and I decided on Connect Four; I mean, who wouldn't? Anyway, I started off making the GUI with a package called BreezySwing, which pretty much sucks....So then I asked my teacher if she would give me Extra Credit if I used Swing, and she said yes. First off, since this is to be in applet form, what changes do I have to make to a normal class that extends JFrame to make it into an applet? And second, which is the more troubling question, since Swing only has text fields, and I need a textField to enter in the column of the move, how do I convert the string extracted by textfield.getText() into a usable int for my methods checkMove(int col) and move(int col)? Thanks for your help...sorry to bother you much more experienced guys in here!
  2. 02 Jul '04 14:48
    The class you're looking for is javax.swing.JApplet. But remember, JApplet (like Applet) is a panel, not a frame. Thereafter, I believe you just use JApplet as you would Applet.

    To convert a String ot an int, you could use, new Integer(textfield.getText()).intValue(), checking for a NumberFormatException on the Integer constructor.

    Hope that helps.

    Gareth
  3. Subscriber jcandance
    White Hats Rule!
    02 Aug '04 09:22
    Originally posted by mcsmilerg
    The class you're looking for is javax.swing.JApplet. But remember, JApplet (like Applet) is a panel, not a frame. Thereafter, I believe you just use JApplet as you would Applet.

    To convert a String ot an int, you could use, new Integer(textfield.getText()).intValue(), checking for a NumberFormatException on the Integer constructor.

    Hope that helps.

    Gareth
    swing is a pain. You need to put a jbox in a jwindow on a jpane, wich is a jpain. I have never really liked anything made with swing anyway..
  4. 22 Jul '05 16:21
    cause jdont know what jdoing
  5. 31 Jul '05 08:26
    Originally posted by dinky the destroyer
    cause jdont know what jdoing