Results 1 to 5 of 5
  1. #1
    hnam31190 is offline Member
    Join Date
    Oct 2008
    Posts
    3
    Rep Power
    0

    Post Help me with create a 2D Maze in Java

    HI.
    I am a newbie with Java. And i am doing a project by create a maze in 2D Maze.
    I am confusing about writing a code for the Save and Retrieve button. (The retrieve button will load a file (type: *.maze) which is included in the zip file.)
    The Retrieve and Save button will load an save the tube maze via binary files.
    Anyone can help me write the code for retrieve button. (In the class: TubeSearcher). And the we can test this button by trying retrieve the sample.maze file in the zip file.

    Thanks a lot
    Best regards

    (sorry when I not write a code here cause it's a lot of class in the zip file)
    Attached Files Attached Files
    Last edited by hnam31190; 10-30-2008 at 05:04 AM.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,516
    Rep Power
    25

    Default

    YOU need to solve your problem one small step at a time. First write the save and load methods separately then write the GUI that calls those methods. What structures are you using to hold the maze in your program?
    Why do you want to save the data as binary vs as text?

  3. #3
    hnam31190 is offline Member
    Join Date
    Oct 2008
    Posts
    3
    Rep Power
    0

    Default

    Well, for the binary vs text file. My project required to load and save content via binary file.
    And also the structures will be using the recursion (for find the part)which I am studying now.
    Thanks Norm

  4. #4
    hnam31190 is offline Member
    Join Date
    Oct 2008
    Posts
    3
    Rep Power
    0

    Default

    Can you tell me what did I do wrong here? for retrieve
    Java Code:
    private void retrieve() {
    		try{
    			JFileChooser fc = new JFileChooser();;
    		
    		int returnVal = fc.showOpenDialog(TubesSearcher.this);
    		File file = fc.getSelectedFile();
    		
    		if (returnVal == JFileChooser.APPROVE_OPTION) {
    
    			FileReader fReader = new FileReader(file);
    			BufferedReader reader = new BufferedReader(fReader);
    			
    			
    		}//end of If
    		}
    		catch(java.io.IOException IOexc){
    			System.out.println("Cannot read from file");
    		}
    
    		catch(java.lang.NullPointerException NPexc){
    			System.out.println("NullPointerException occurs");
    		}
    	}

  5. #5
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,516
    Rep Power
    25

    Default

    Can you tell me what did I do wrong here
    Not without you telling me what the code is supposed to do and what it is doing that you don't like.
    Do you get an error or what?

    Its better to use a printStackTrace() call in caught exceptions. There is often important information included in the message showen.

Similar Threads

  1. can you create a .exe with java?
    By seandingobat in forum New To Java
    Replies: 5
    Last Post: 10-21-2008, 02:35 PM
  2. Create GIF from JPG using Java
    By trivektor in forum New To Java
    Replies: 2
    Last Post: 10-10-2008, 02:50 AM
  3. Java Maze Problem
    By mousey182 in forum New To Java
    Replies: 2
    Last Post: 03-28-2008, 06:29 PM
  4. Maze Help
    By Soda in forum Advanced Java
    Replies: 1
    Last Post: 12-22-2007, 03:26 AM
  5. maze problem (file to a 2d array)
    By rnavarro9 in forum New To Java
    Replies: 4
    Last Post: 11-09-2007, 07:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •