User Profile

Collapse

Profile Sidebar

Collapse
Narutodono
Narutodono
Last Activity: Dec 9 '09, 12:00 PM
Joined: Nov 6 '09
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Narutodono
    started a topic class calling kinda problem
    in Java

    class calling kinda problem

    Code:
    for (int i=0; i<5; i++)                // for loop for creating a background of tiles
    {
      x=10; 
      
      Graphics g = canvas.getGraphics();           // call Tile to draw a tile
      Tile[] tile = new Tile[10];                  // intialise tile
      tile[i] = new Tile(1,x,y);             // a new tile for every i
      tile[i].Draw(g);                       // draw it
      x=x+50;                           //change
    ...
    See more | Go to post

  • Narutodono
    replied to Calling a class from a different file
    in Java
    makes sense now thankyou :) but i have encountered a error.

    nullpointerexce ption, it points to the graphics g. me and my friend have the same is there a general reason behind this error?
    See more | Go to post

    Leave a comment:


  • Narutodono
    replied to Calling a class from a different file
    in Java
    ive done as you said but instead used the name Tile.java
    tile = new Tile();
    Tile.draw();

    but this produces a error the underlined areas are the two errors i keep trying to get around this i cannt see what is causing this. the error says cannot find symbol and they are both associated with this file so it isnt the Tile.java file i believe.
    See more | Go to post

    Leave a comment:


  • Narutodono
    started a topic Calling a class from a different file
    in Java

    Calling a class from a different file

    Im having to create a java program for a assignment and we have to use 2 files to create the program, basicly i need to create a program that will create a GUI i will create the frame and panel in the main first file, then i need to draw a 5x5 squares vbut this has to be done in the second file and i dont know how i could call it in the first file. any help is appreciated. Thanks
    See more | Go to post

  • I kind of understand now what you mean, but which part of that code will extend beyond the lifetime of the function to which isnt in the two fucntions in that code?.

    sorry if im a slow learner. Thank you for your help aswell
    See more | Go to post

    Leave a comment:


  • Fix the bug by returning a pointer to an array allocated on the free store(heap)??

    Could anyone please help me on this. it would be helpful if someone gave me the answer but more importantly if someone explained how they came to that answer please. here is the code:

    Code:
    #include <iostream>
    #include <string>
    
    using namespace std;
    
    void someFunction()
    {
    
    	/*const int DATASIZE = 50000;
    	int data[DATASIZE];
    	for (int i =0; i < DATASIZE;
    ...
    See more | Go to post
No activity results to display
Show More
Working...