AP Computer Science--Need a bit of help for class

Hey guys,
I'm a senior in high school, and I'm taking the class AP Computer Science. We're learning Java programming and we've been using an outdated version of Sun Studio creator. The class is composed of me and my friend, we're studying independantly. The program is only available on the teacher's computer.
We sanctioned a couple computers currently to do programming on and we downloaded Sun Studio Creator and Enterprise on each. We started the new version of Creator and found that we have a bit of a problem, which is where you guys come in.
We're not working with HTML or web affiliated programs, we're mainly just interested in offline programming. Creator, only offers web app templates, and every new project we open has HTMl in it. How can we get a non-HTML project going? We just want to do simple programming, without the web design stuff.
Thanks for any help you guys can provide.
--Tempest                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Bets option , imho , is to get a copy of netbeans 5
It is in rc2 phase and quite stable.
it has many feature in editor and swing development which you will not find in Studio enterprise.
also developing web service and ejb stuff is too easy using netbeans 5.
you can have both profiler and Collaboration module in Netbeans too.
so :
best option is to go with netbeans 5 rc2 +

Similar Messages

  • Need a bit of help with css and fullscreen

    I am currently doing a javaFX application for my university project, I have it everything nearly finished, but need to finish the css component to make the application "prettier" (I am not very good on graphic design to be honest). So if i could get a bit of help on this little issue I'd be very grateful.
    is there any way to make fullscreen (and if possible resizing window) to instead rearranging everything to actually do a fullscreen (like the games) and everything "grows accordingly (even though in games what it usually does is to change the screen resolution, is that possible to reproduce with javaFX?) also how to remove the message and the effect on click the "esc" key to exit the fullscreen mode?
    i know that removing the focus effect on an element is with the following (if a button)
    .button:focused{
         -fx-background-insets: 0;
    }but,is there any way to remove the effect on anything focused (TextField, Combo Box, ...)? (tried with a .textfield:focused but it did not work)
    also i wanted to produce the focused effect by this way but it didn't work, how should i do it? (in fact even if i try to put this line on the button:focused, the focused effect gets removed from there, because of the insets line)
    #highlight{
         -fx-background-insets: 2;
         -fx-background-color: yellow;
    public class controller extends StackPane implements Initializable{
         public void highlight(){
              this.getStyleClass().add("highlight");
    and last thing (for the moment) the .button seems to work for all the buttons, but trying another thing like .gridpane or .textfield or .scrollpane does not seem to work, is there any way to make it work or i should add "id" to all the elements and use the # instead?

    i wrote all them in the same thread becsause there were a total of 4 (and could had been more) separated by ----
    should i leave it how it is or open now 4 threads for each question?

  • Need to create search help for parameter 2 based on values in parameter1

    hi Specialists,
    I need to create a search help for parameters field 2 ( Country ) based on the values the user inputs in parameters field 1 ( Currency ). The values of field  Currency & Country will come from T001 table.
    The logic is : Based on a unique currency value ( fetched from T001 table ) user needs to get/see all Countries on his selection -screen.
    Can you guys let me know which FM can I use for above & how to pass various values i.e. parameters into that FM. EXplanation with an example/code is highly appreciable.
    Thanks
    Abhinav.

    Hi Abhinav,
    Use this demo code, its working:-
    This code selects sale document item based on the user entry for sales document on the screen field.
    REPORT  ztg_f1f4.
    CALL SCREEN 1010.
    *&      Module  GET_F4_HELP  INPUT
    *       text
    MODULE get_f4_help INPUT.
      TYPES : BEGIN OF it,
                posnr TYPE zvbap-posnr,
              END OF it.
      DATA : itab TYPE STANDARD TABLE OF it WITH HEADER LINE,
             tb_dynpfields LIKE dynpread OCCURS 0 WITH HEADER LINE,
             vbeln TYPE zvbap-vbeln.
      CLEAR:   tb_dynpfields.
      REFRESH: tb_dynpfields.
      MOVE 'ZVBAP-VBELN' TO tb_dynpfields-fieldname. "screen field name
      APPEND tb_dynpfields.
      CALL FUNCTION 'DYNP_VALUES_READ'
        EXPORTING
          dyname                               = 'ZTG_F1F4'
          dynumb                               = '1010'
    *   TRANSLATE_TO_UPPER                   = ' '
    *   REQUEST                              = ' '
    *   PERFORM_CONVERSION_EXITS             = ' '
    *   PERFORM_INPUT_CONVERSION             = ' '
    *   DETERMINE_LOOP_INDEX                 = ' '
    *   START_SEARCH_IN_CURRENT_SCREEN       = ' '
    *   START_SEARCH_IN_MAIN_SCREEN          = ' '
    *   START_SEARCH_IN_STACKED_SCREEN       = ' '
    *   START_SEARCH_ON_SCR_STACKPOS         = ' '
    *   SEARCH_OWN_SUBSCREENS_FIRST          = ' '
    *   SEARCHPATH_OF_SUBSCREEN_AREAS        = ' '
        TABLES
          dynpfields                           = tb_dynpfields
    * EXCEPTIONS
    *   INVALID_ABAPWORKAREA                 = 1
    *   INVALID_DYNPROFIELD                  = 2
    *   INVALID_DYNPRONAME                   = 3
    *   INVALID_DYNPRONUMMER                 = 4
    *   INVALID_REQUEST                      = 5
    *   NO_FIELDDESCRIPTION                  = 6
    *   INVALID_PARAMETER                    = 7
    *   UNDEFIND_ERROR                       = 8
    *   DOUBLE_CONVERSION                    = 9
    *   STEPL_NOT_FOUND                      = 10
    *   OTHERS                               = 11
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      READ TABLE tb_dynpfields INDEX 1.
      IF sy-subrc EQ 0.
        vbeln = tb_dynpfields-fieldvalue.
      ENDIF.
      SELECT posnr FROM zvbap
        INTO TABLE itab
      WHERE
        vbeln = vbeln.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
    *   DDIC_STRUCTURE         = ' '
          retfield               = 'POSNR'
    *   PVALKEY                = ' '
         dynpprog               = 'ZTG_F1F4'
         dynpnr                 = '1010'
         dynprofield            = 'POSNR'
    *   STEPL                  = 0
    *   WINDOW_TITLE           =
    *   VALUE                  = ' '
       value_org              = 'S'
    *   MULTIPLE_CHOICE        = ' '
    *   DISPLAY                = ' '
    *   CALLBACK_PROGRAM       = ' '
    *   CALLBACK_FORM          = ' '
    *   MARK_TAB               =
    * IMPORTING
    *   USER_RESET             =
        TABLES
          value_tab              = itab
    *   FIELD_TAB              =
    *   RETURN_TAB             =
    *   DYNPFLD_MAPPING        =
    * EXCEPTIONS
    *   PARAMETER_ERROR        = 1
    *   NO_VALUES_FOUND        = 2
    *   OTHERS                 = 3
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDMODULE.                 " GET_F4_HELP  INPUT
    Hope this solves your problem.
    Thanks & Regards,
    Tarun Gambhir

  • Touchsmart 600 1410es, videocard replacemen​t, need a bit of help

    Good day,
    I would like to upgrade my video card, Geforce GT210, on a new one - MXM 3.0A ATI Radeon 6770M GDDR5 1Gb, 
    When i change card, when i turn on PC, the screen is black, and nothing is going on, i feel that OS is loading, but screen is blank.
    i tryed to take off Graphic Card, and turn on PC without it, but screen is black as well, but when check my Touchsmart 600 1410 support page, it says that i got integrated one, but if i got integrated one, why the screen is black, and how can i check if everything is ok? 
    And could you please say, if MXM 3.0A ATI Radeon 6770M GDDR5 1Gb compatible with E66 MotherBoard?
    Thank you,
    Kind Regards,
    Nikita.

    Hi Nakita_D_S:
    I understand that you have a blank display after upgrading the  video card.
    Here is a link to a document on "Screen is Blank after Starting the computer."
    http://bit.ly/1apEokG
    Here is a link to the specifications of your desktop.
    http://bit.ly/171K6Js
    I hope this is helpful. If you require further assistance please reply back
    Sparkles1
    I work on behalf of HP
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the bottom right to say “Thanks” for helping!

  • Kinda New, and need alittle bit of help.

    Well, It been a very very long time since i used Linux in any form. And I am trying to install a oldie but goodie game Chromium. Which is not in our repo. So i Dl'ed the src and data tar balls and untared them. In the install instructions. It states that I need to: Set CHROMIUM_DATA environment variable to point to data directory ( i.e. Chromium-0.9/data )??? This is were O am lost. Well I tried to do the make anyways but it died out... From what it looks like I have all the depends needed. Below is a copy of the echo from running the make:
    [devnull@myhost Chromium-0.9]$ make
    cd support/openal/; make
    make[1]: Entering directory `/home/devnull/Desktop/Chromium-0.9/support/openal'
    mkdir -p ./lib
    cd linux; sh autogen.sh; ./configure --enable-sdl; make
    perl: warning: Setting locale failed.
    perl: warning: Please check that your locale settings:
            LANGUAGE = (unset),
            LC_ALL = (unset),
            LC_COLLATE = "C",
            LANG = "en_US.utf8"
        are supported and installed on your system.
    perl: warning: Falling back to the standard locale ("C").
    autoheader: WARNING: Using auxiliary files such as `acconfig.h', `config.h.bot'
    autoheader: WARNING: and `config.h.top', to define templates for `config.h.in'
    autoheader: WARNING: is deprecated and discouraged.
    autoheader:
    autoheader: WARNING: Using the third argument of `AC_DEFINE' and
    autoheader: WARNING: `AC_DEFINE_UNQUOTED' allows one to define a template without
    autoheader: WARNING: `acconfig.h':
    autoheader:
    autoheader: WARNING:   AC_DEFINE([NEED_FUNC_MAIN], 1,
    autoheader:             [Define if a function `main' is needed.])
    autoheader:
    autoheader: WARNING: More sophisticated templates can also be produced, see the
    autoheader: WARNING: documentation.
    perl: warning: Setting locale failed.
    perl: warning: Please check that your locale settings:
            LANGUAGE = (unset),
            LC_ALL = (unset),
            LC_COLLATE = "C",
            LANG = "en_US.utf8"
        are supported and installed on your system.
    perl: warning: Falling back to the standard locale ("C").
    checking build system type... i686-pc-linux-gnu
    checking host system type... i686-pc-linux-gnu
    checking target system type... i686-pc-linux-gnu
    checking for gcc... gcc
    checking for C compiler default output file name... a.out
    checking whether the C compiler works... yes
    checking whether we are cross compiling... no
    checking for suffix of executables...
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ISO C89... none needed
    checking how to run the C preprocessor... gcc -E
    checking for grep that handles long lines and -e... /bin/grep
    checking for egrep... /bin/grep -E
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... yes
    checking whether byte ordering is bigendian... no
    checking for sin in -lm... yes
    checking for dlopen in -ldl... yes
    ./configure: line 4339: syntax error near unexpected token `newline'
    ./configure: line 4339: `  yes:no:'
    make[2]: Entering directory `/home/devnull/Desktop/Chromium-0.9/support/openal/l inux'
    make[2]: *** No targets specified and no makefile found.  Stop.
    make[2]: Leaving directory `/home/devnull/Desktop/Chromium-0.9/support/openal/li nux'
    make[1]: *** [linux] Error 2
    make[1]: Leaving directory `/home/devnull/Desktop/Chromium-0.9/support/openal'
    make: *** [support/openal/] Error 2
    [devnull@myhost Chromium-0.9]$   
    So I was hoping could someone explain were do I again -> Set CHROMIUM_DATA environment variable to point to data directory ( i.e. Chromium-0.9/data ) to get this up and going.
    BTW I love the distro... Since I been back using Linux Arch and Slack have been the only to distro that KISS! Thanks in advance for all the help.

    Well, OK Thanks for the link.... Still being new It took me a bit.. But I was able to find the info on AUR and added the FTP Server to my pacman.conf file under community.  pacman was able to find it and installed it... Thanks for the help...

  • Need a bit of help with a code

    Hello adobe community!
    i have been fiddling around with FLASH MX and have been making a game VERY slowly.
    i've picked up alot since starting and have restarted making said game MANY MANY times =D...
    But i have now got a copy that is neat and clean and works really well BUT i've come into a bit of a problem.
    i have  _global.goldenticket = 0;   on my first frame along with other variables and i have made a single location where one can aquire a "goldenticket".
    now things are starting to confuse me... ive added a button inside a movie clip which if clicked "should" check if i have a golden ticket and then allow me to jump to the frame specified...
    on(release){
    if(goldenticket=="1"){
    money -= 50;
    energy -=50;
    _root.gotoAndPlay("enter");
    }else{
    this.enabled=false;
    however the button doesnt seem to see my ticket (even tho ive added a dynamic textbox to keep track of how many i have, which is 1)
    ive tried many different ways to go around this but i cannot seem to get it to work...
    please someone help me... in relativly simple answers please =\ im only a few days into flash learning and codeing. but im enjoying what im doing so im learning quickly.
    will have my face to the screen in waiting =D
    Thank you to everyone who took a look at my thread!

    THANK YOU!!!
    REALLY quick response WITH lang i could easily understand...
    mate thank you haha been wrapping my brain for hours on end with other things didnt even occure to me to slap _global infront.

  • Need a bit of help with Jumping in a game

    I making an action game (at least for the sake of this question) and when the user presses the spacebar the character jumps. The problem is, if the character is moving right or left, and jumps while he is moving, he will stop moving in mid-air (if the spacebar is released) and just drop straight down. Example:
    press right arrow key
    player moves right
    press space while pressing arrow key
    player jumps
    let go of spacebar
    player drops straight down (does not continue to move right) //Problem
    It's pretty simple code, actually:
    /* Move player left or right */
    if (pressedRight)
            player.x_pos += player.x_speed;
    else if (pressedLeft)
            player.x_pos -= player.x_speed;
    /* If spacebar is pressed */
    if (pressedSpace && !player.moveUp)
            player.moveUp = true;
            player.y_speed = player.INITIALSPEED;
    /* if you are in "jump mode" */                         
    if (player.moveUp)
            player.y_pos += player.y_speed;
            player.y_speed += .25;
            if (player.y_pos >= TheGround)
                      player.moveUp = false;
                      player.y_speed = 0;
    public boolean keyDown(Event e, int key)
            if(key==Event.LEFT)
                      pressedLeft = true;
            if(key==Event.RIGHT)
                      pressedRight=true;
            if(key==Event.UP)
                      pressedUp=true;
            if(key==Event.DOWN)
                      pressedDown=true;
            if (key ==  ' ')
                      pressedSpace = true;
            repaint();
            return true;
    public boolean keyUp(Event e, int key)
            pressedLeft=false;
            pressedRight = false;
            pressedSpace = false;
            repaint();
            return true;
    }

    Run this code and you'll see what I'm talking about:
    import java.awt.*;
    import java.applet.*;
    public class Testing extends Applet implements Runnable
        Thread runner;
        private Image Buffer;
        private Graphics gBuffer;
        final int theGround = 205;
         boolean pressedLeft, pressedRight, pressedSpace;
         final int width = 10, height = 10;
         final int INITIALSPEED = -5;
         double x_pos = 100;
         double y_pos = 190;
         boolean moveUp = false;
         double y_speed = 3;
         double x_speed = 3;
        //Init is called first, do any initialisation here
        public void init()
            //create graphics buffer, the size of the applet
            Buffer=createImage(size().width,size().height);
            gBuffer=Buffer.getGraphics();
        public void start()
            if (runner == null)
                runner = new Thread (this);
                runner.start();
        public void stop()
            if (runner != null)
                runner.stop();
                runner = null;
        public void run()
            while(true)
                 /* MAIN CODE*/
                //Thread sleeps for 15 milliseconds here
                try {runner.sleep(15);}
                catch (Exception e) { }
                //paint background blue
                gBuffer.setColor(Color.blue);
                gBuffer.fillRect(0,0,size().width,size().height);
                   if (pressedRight)
                        x_pos += 1;
                   else if (pressedLeft)
                        x_pos -= 1;
                   if (pressedSpace && !moveUp)
                        moveUp = true;
                        y_speed = INITIALSPEED;
                   if (moveUp)
                        y_pos += y_speed;
                        y_speed += .15;
                        if (y_pos + height + y_speed >= theGround)
                             moveUp = false;
                             y_speed = 0;
                Draw();
                repaint();
        //is needed to avoid erasing the background by Java
        public void update(Graphics g)
            paint(g);
        public void paint(Graphics g)
            g.drawImage (Buffer,0,0, this);
        public boolean keyDown(Event e, int key)
            if(key==Event.LEFT)
                pressedLeft = true;
            if(key==Event.RIGHT)
            pressedRight=true;
            if (key ==  ' ')
                 pressedSpace = true;
            repaint();
            return true;
        public boolean keyUp(Event e, int key)
            pressedLeft=false;
            pressedRight = false;
            pressedSpace = false;
            repaint();
            return true;
        public void Draw()
              gBuffer.setColor(Color.green);
              gBuffer.fillOval((int)x_pos,(int)y_pos,width,height);
              gBuffer.setColor(Color.yellow);
              gBuffer.drawLine(0, 200, 500, 200);
              gBuffer.drawString(("Move right/left, press space, and it will stop and fall straight down! Why?"), 10, 20);
              gBuffer.drawString(("Hold the spacebar down and it will work like it should."), 10, 30);
              gBuffer.drawString(("ALSO, move left or right then *QUICKLY* release and move in the opposite direction."), 10, 50);
                   gBuffer.drawString(("-- You should see it pause for a second. Why is that?"), 10, 60);
    }Sorry for some reason the tabs get messed up when I cut and pate it from JCreator. :P
    PLEASE HELP!
    Thanks in advance.

  • Need a bit of help with some theory...

    I'm just looking over some past paers for my exam and I'm having trouble understanding exactly what this question is asking for:
    What is an Enterprise computer system? Give an example of an Enterprise system. Critically discuss two alternative development environments that could be used to develop such a system. Suggest which development environment you would choose to develop the example enterprise system you have suggested and why.
    I'm just sure exactly what it means by development enviroments, does it mean a program like JDeveloper? A couple of examples would be really handy
    Thanks

    Think of an Enterprise computer system as nothing more than a resouce pool. A pool of database connections, persistant database objects, mail sessions, messaging sessions. Basically any resouce a developer would need to develop any type of application.
    As for environments... the two I think of are Microsoft .NET and Sun's Java System Application Server Platform. Thay are basically the same in concept, microsoft just repackaged everything good about Java and called it .NET. .NET is (of course) dependant on the Microsoft OS platform, Sun/Java is not.

  • Different Result for SQL and PL/SQL query..need a bit of help

    If i just run:
    SELECT COUNT(*) from DB where (CLOSE_TIME-OPEN_TIME<5) and (CLOSE_TIME-OPEN_TIME>=1) and OPEN_TIME>'1/1/2011';
    It works great.
    If I run
    BEGIN
    SELECT COUNT(*) from DB where (CLOSE_TIME-OPEN_TIME<5) and (CLOSE_TIME-OPEN_TIME>=1) and OPEN_TIME>'1/1/2011';
    END
    I get the following error.
    ORA-04052: error occurred when looking up remote object [email protected]
    ORA-00604: error occurred at recursive SQL level 3
    ORA-06552: PL/SQL: Compilation unit analysis terminated
    ORA-06553: PLS-488: invalid variable declaration: object 'NUMBER' must be a type or subtype
    ORA-02063: preceding 2 lines from SMGLINK

    Hi,
    Whenever you have a problem, post a complete test script that people can run to re-create the problem and test their ideas. Include CREATE TABLE and INSERT statements for any or your own tables needed.
    Post the results you want from that sample data.
    Always say which version of Oracle you're using.
    bostonmacosx wrote:
    If i just run:
    SELECT COUNT(*) from DB where (CLOSE_TIME-OPEN_TIME<5) and (CLOSE_TIME-OPEN_TIME>=1) and OPEN_TIME>'1/1/2011';If OPEN_TIME is a DATE, then don't try to compare it to a string, such as '1/1/2011'. (This is not related to the present problem, only a future one.)
    It works great.
    If I run
    BEGIN
    SELECT COUNT(*) from DB where (CLOSE_TIME-OPEN_TIME<5) and (CLOSE_TIME-OPEN_TIME>=1) and OPEN_TIME>'1/1/2011';
    END
    I get the following error.
    ORA-04052: error occurred when looking up remote object [email protected]
    ORA-00604: error occurred at recursive SQL level 3
    ORA-06552: PL/SQL: Compilation unit analysis terminated
    ORA-06553: PLS-488: invalid variable declaration: object 'NUMBER' must be a type or subtype
    ORA-02063: preceding 2 lines from SMGLINKI would expect a different error "PLS_00428: an INTO clause is expected".

  • Need a bit of help

    Hi...I Feel like I've been reading for weeks about this wireless stiff and I now know less that when I started. Right when I think I understand..Bam I'm all cornfused all over again....
    Here's what I'm working on-
    Win XP home
    ISP=Comcast Cable
    Modem=Motorola SB5120
    Linksys Wireless B Broadband Router BEFW11S4 Ver.?(not sure)
    firmware=1.45.3, Jul 1 2003
    AND-
    Linksys Wireless-G Adapter WUSB54G
    this is needs to be set up to the above machine/router
    a few things that are confusing me are this, are the 2 computers that I want to be together on the wireless suppose to have the same MAC address'? Or is all that suppose to be the same?
    It seems like I will be following along with one of the many instructions that I find...then they want me to go into a place that I can't find/don't have.
    Another thing, is the wireless network the samething as setting up the small home/office network?
    It all seems like it's so easy...but then it also seems to always go horribly wrong, for me anyways..: (
    Obiviously Either I'm ok with the way the router is set up, or an angel has decided I've been tortured enough and decided I deserved to get online for badly needed assistance.
    I'd like it to be a secured line. When I first began I tried to use the wizard to set up a wireless network. When I was done it gave me an WEP number or key? and I also provided a name. What do I do with this info?
    I'm pretty twisted and turned around on this , is there anyone that could give me some consistant easy to follow instructions?
    I also talked to the linksys folks, what they recommended didn't work out at all...so...
    HelpppppppppPPPPPPPPPPPPPPPPpppppppppppp Pleeze!
    Thanks all!
    FleetMessage Edited by Fleet on 09-04-2006 10:51 PM

    Strange it says Xp when you have W7?
    Here is the latest  64bit driver for W7 from Intel
    http://downloadcenter.intel.com/Detail_Desc.aspx?agr=Y&DwnldID=19593&ProdId=3231&lang=eng
    32bit here
    http://downloadcenter.intel.com/Detail_Desc.aspx?agr=Y&DwnldID=19591&ProdId=3231&lang=eng

  • I need a bit of help with my 7600GT

    Alright.
    My motherboard doesn't have a VGA slot, and neither does this Video Card.  I understand that it is remedied with the adapters that are provided, but one must install the drivers for the DVI slots before one can do anything.  I can't get any output on my monitor with the adapters because I can't see what's going on to install the drivers.  I managed to install Windows by taking out my hard drive and putting it into another computer (SATA drive, btw) and I would have done the same with my video card if it weren't for the fact that no other computers in my house have PCI-E slots. 
    Is there any way to get the drivers onto this hard drive without having to search around town for a computer with both a SATA and a PCI-E slot?
    Thanks!

    iamquitethen00b,
    Moan Guide
    Richard

  • I need a "bit" of help with an 8 Puzzle

    My current situation is that I need to create a working 8 puzzle with Java using a GUI. What I've currently done is at http://nale.f2g.net/EightPuzzle.java . My main problem is that when running it I get a NullPointerException at the line containing tile[blankPos].setText(tile[ndx].getText()); in the swap method.

    I get a NPE when ever I use the scramble() method.
    The source is the line move(rand.nextInt(4)); .Your Random rand is not instantiated nowhere. Thus it is naturally null.
    Make rand in the constructor.
    Here's a simpler one. You could use random swap() calls for moving/shuffling/scrambling.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import java.util.Random;
    public class ObjectOrientedEightPuzzle extends JFrame implements MouseListener{
      private Piece[] tile;
      private Border etched = BorderFactory.createEtchedBorder();
      private Color tileColor = Color.GRAY;
      private Color blankColor = Color.GREEN;
      private String[] label = {"1", "2", "3", "4", "", "5", "6", "7", "8"};
      private JPanel pane;
      public ObjectOrientedEightPuzzle(){
        setTitle("ObjectOrientedEightPuzzle");
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        pane = (JPanel)getContentPane();
        pane.setLayout(new GridLayout(3,3));
        setResizable(false);
        setSize(400, 400);
        tile = new Piece[label.length];
        for(int ndx = 0; ndx < label.length; ndx++){
          tile[ndx] = new Piece(label[ndx], new Position(ndx));
          tile[ndx].addMouseListener(this);
          pane.add(tile[ndx]);
      public void mouseClicked(MouseEvent e){
        Piece p = (Piece)e.getSource();
        Piece blank = blankPos();
        swap(p, blank);
      public void mousePressed(MouseEvent e){
      public void mouseReleased(MouseEvent e){
      public void mouseEntered(MouseEvent e){
      public void mouseExited(MouseEvent e){
      private void swap(Piece clickp, Piece blankp){
        int i = -1;
        int[] pa;
        int b = blankp.getPosition().getPos();
        pa = clickp.getPosition().getNeighbor();
        for (int p = 0; p < pa.length; ++p){
          if (pa[p] == b){
            i = p;
            break;
        if (i != -1){
          blankp.setText(clickp.getText());
          clickp.setText("");
      private Piece blankPos(){
        int ndx;
        for(ndx = 0; ndx < label.length; ndx++){
          if(tile[ndx].getText().equals("")){
            break;
        return tile[ndx];
      public static void main(String[] args){
        ObjectOrientedEightPuzzle puzzle = new ObjectOrientedEightPuzzle();
        puzzle.setVisible(true);
      // represent the position in the array/grid
      class Position{ // 0 ... 8
        int pos;
        int[] neighbor;
        public Position(int p){
          setPos(p);
        public int getPos(){
          return pos;
        public void setPos(int p){
          pos = p;
          setNeighbor(pos);
        public int[] getNeighbor(){
          return neighbor;
        private void setNeighbor(int p){
          switch (p){
            case 0:
              neighbor = new int[2];
              neighbor[0] = 1;
              neighbor[1] = 3;
              break;
            case 1:
              neighbor = new int[3];
              neighbor[0] = 0;
              neighbor[1] = 2;
              neighbor[2] = 4;
              break;
            case 2:
              neighbor = new int[2];
              neighbor[0] = 1;
              neighbor[1] = 5;
              break;
            case 3:
              neighbor = new int[3];
              neighbor[0] = 0;
              neighbor[1] = 4;
              neighbor[2] = 6;
              break;
            case 4:
              neighbor = new int[4];
              neighbor[0] = 1;
              neighbor[1] = 3;
              neighbor[2] = 5;
              neighbor[3] = 7;
              break;
            case 5:
              neighbor = new int[3];
              neighbor[0] = 2;
              neighbor[1] = 4;
              neighbor[2] = 8;
              break;
            case 6:
              neighbor = new int[2];
              neighbor[0] = 3;
              neighbor[1] = 7;
              break;
            case 7:
              neighbor = new int[3];
              neighbor[0] = 4;
              neighbor[1] = 6;
              neighbor[2] = 8;
              break;
            case 8:
              neighbor = new int[2];
              neighbor[0] = 5;
              neighbor[1] = 7;
              break;
            default:
              throw new IllegalArgumentException(String.valueOf(p));
      // represent the piece of the game == a JLabel disguised
      class Piece extends JLabel{
        private int value;
        private Position pos;
        private String ptext;
        public Piece(String s, Position p){
          super(s);
          setBorder(etched);
          setVerticalAlignment(CENTER);
          setHorizontalAlignment(CENTER);
          setFont(new Font("Courier", Font.BOLD, 30));
          setOpaque(true);
          ptext = s;
          pos = p;
          if (s.equals("")){
            setBackground(blankColor);
          else{
            setBackground(tileColor);
          try{
            value = Integer.parseInt(s);
          catch (NumberFormatException e){
            value = -1;
        public int getValue(){
          return value;
        public Position getPosition(){
          return pos;
        public String getText(){
          return ptext;
        public void setText(String t){
          ptext = t;
          if (t.equals("")){
            setBackground(blankColor);
          else{
            setBackground(tileColor);
          super.setText(t);
        public void setValue(int val){
          value = val;
          ptext = String.valueOf(val);
          if (val < 0){
            ptext = "";
          setText(ptext);
          if (value > 0){
            setBackground(tileColor);
          else{
            setBackground(blankColor);
    }

  • I need a bit of help with my iPhone 4...

    I just backed up my phone and I'm trying to update it to iOS 7.0.4. but when I updated my ipod, everything got deleted off of it. I don't want that to happen to my phone even though I know it probably will. If I restore my iPhone and then restore backup AFTER I update my phone, will I get everything back?
    Also, will everything actually be deleted or could I find them somewhere on my laptop?

    iamquitethen00b,
    Moan Guide
    Richard

  • Need step-by-step help for Azureus and AirPort Express

    Absolutely clueless on NAT Error and setup with Azureus, AirPort Express and System Preferences Sharing. Done a search here and Google it. Don't understand a single one of them. Download is a miserable 1 - 3 Kb/s and upload is IMPOSSIBLE. Even I tried turning off firewall in System Preferences, the results are the same. Help.
    Thanks in advance.

    You need to enable Port Mapping on the Express for the port you're using for BitTorrents. You can determine the port number in the Azureus preferences. To set up Port Mapping, open up the Express's configuration in Airport Admin Utility, click on the Port Mapping tab, and add an entry with your computer's IP address and the BitTorrent port number in both the public and private port number fields.

  • Need little Windows XP help for Satellite A215-S5849

    Hi,
    I have a notebook Toshiba Satellite A215-S5849 which came with Windows Vista home premium.
    Some time ago, I installed Windows XP SP3 and I also installed some drivers which i found here:
    [Page from where I downloaded drivers, click|http://eu.computers.toshiba-europe.com/cgi-bin/ToshibaCSG/download_drivers_bios.jsp]
    I had to select model A210 coz there is no Satellite A215 available (but its probably simmilar, coz on my included Vista CD with drivers it also says its for A210/A215)
    Main problem is... is there any simple way to get all XP drivers for A215... [Thats an other page, where I searched drivers for exactly my notebook and WIN XP, its many for vista. Select to filter for XP... not a lot of drivers for me id say, click |http://www.csd.toshiba.com/cgi-bin/tais/su/su_sc_modItemList.jsp?moid=1998646&rpn=PSAFGU&ct=D L&BV_SessionID=@@@@1886836112.1220191695@@@@&BV_En gineID=cccfadefdejeidmcgfkceghdgngdgnn.0 ]
    I have this little problems id like to solve:
    1) Fn F5 doesnt work... I have 2 monitors and I cant use Fn F5 hotkey... I downloaded the driver... and other Fn keys work... but not F5... I've searched the forum and web and found something that I should have a "display devices change utility" installed, but this is only available for older notebooks (Ive searched, but i found only old driver for this). How do I make Fn F5 work in Win XP on A215?
    2) Also in my Device manager I have three "Base System Device" undentified as "Other devices". Is this ok... or do i need some drivers or something?
    3) And I have a question about this utility: [ link here, click|http://www.csd.toshiba.com/cgi-bin/tais/su/su_sc_dtlViewDL.jsp?soid=1903653&moid=1998646&rpn= PSAFGU&BV_SessionID=@@@@0768822790.1220188011@@@@& BV_EngineID=cccfadefdejeidmcgfkceghdgngdgnn.0&ct=D L&all_docs=false]
    Would this install all the available drivers for the notebook? If not, what does it do, maybe update?
    4) And also... the multimedia keys... is it possible to select play/pause, stop, next, prev buttons for other program than windows media player. Id like to run those keys on winamp, ive downloaded a plugin for winamp, and it did worked on Vista, but not on XP... in Toshiba controls utility I can only sellect programs to start with Internet button and CD/DVD button. Ive read its not possible, but it worked when I installed the plugin on Vista.
    Thank you for reading this and help.
    Just in case I added drivers that I installed below. Dont really need to read this I think, but i add...
    Drives that i installed:
    Hotkey Utility, Toshiba
    Common Module, Toshiba
    Controls, Toshiba
    Display Driver, ATI
    Power Saver, Toshiba
    Sound Driver, Realtek Semiconductor Corporation
    SD Utilities
    Wireless Lan Client Manager, Atheros
    Touch Pad Driver, Synaptics
    Processor driver, AMD
    atheros wlan driver
    Camera Software, Chicony
    The drivers available were pretty straightforward , coz there is only one available for LAN, audio, Hotkeys etc. So I had not much choice. I also checked for which hardware they were made and from wihich manifacturer they are (I found the right ones... for example, realtek drivers for my realtek audio device...)

    > I had to select model A210 coz there is no Satellite A215 available (but its probably similar, coz on my included Vista CD with drivers it also says its for A210/A215)
    The A215 is a US notebook series and you usually you should use the Toshiba US driver page in order to get all compatible XP drivers.
    There is no guarantee that the Toshiba XP drivers from the Toshiba European driver page would work correctly on the Toshiba US notebook.
    Regarding the point;
    1) You are right. The display device change utility controls the FN+F5 key combination and also the Hotkey Utility make the FN+F5 combination working.
    This tool is available for some A210 series like the PSAFGE series. But it does not work on all A210/A215 series.
    2) This could be a card reader. Check if its already installed. But note; after the XP installation you will still have yellow exclamation marks in device manager because some hardware will be only supported by Windows Vista. Therefore there is no Windows XP driver.
    3) In my opinion the Toshiba Software Upgrades for Windows Vista/XP reminds about some new available software updates which were released on the Toshiba page US page.
    4) I have the same issue and I think there is no way to change this in XP.
    The Toshiba controls Utility for XP is simply different as the version for Vista and in my eyes there is nothing to do.
    Regards

Maybe you are looking for