CS130 - 3/28/2011

  1. Java news
  2. "native"? American news
  3. What are the two complete names of your home page? I.e. from the web and from your perspective (like, how to access it to edit it?).
  4. Ruby as a binary to decimal converter: Ruby starts at home with 1000 coins in her bag. There is a binary number whose most significant bit is under her feet; it continues out in front of her, and the least significant bit is followed by 2 coins. Her task is to put the number of coins it represents one block north of home.
    If the initial coins were 10012 (she starts standing on the first 1), she should put 9 coins down. If initially the coins were 110112, she should put down 27.
  5. Building a Java web-based calculator
    1. The Java part
      1. Components
        1. Frame
        2. Button
        3. TextField
        4. Why naming them well helps
      2. Event handlers
        1. actionPerformed for the TextField
        2. actionPerfomed for Buttons (like +, -, etc)
      3. Interacting with TextFields
        1. TextFields contain text; you can set it with setText(String), and get it with getText()
        2. inTF.getText() returns a String, so before you can to arithmetic you must convert that String to an int, like this:
          int x;
          String s;
          s = inTF.getText();
          x = Integer.parseInt(s);
    2. The web part
      1. The easiest way to go it to store your project under public_html
      2. Use the broom (clean and build), then run the applet in NetBeans, then the html to run it is under build (right next to src), you can link to this directly, or copy the <APPLET> tag from it to your index.html file (note that you can adjust the size in the tag)