Jump to content

  • Log In with Google      Sign In   
  • Create Account


Need help displaying name of window


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 018thedude   Members   -  Reputation: 127

Like
0Likes
Like

Posted 27 January 2013 - 12:18 PM

package falling;
public class window {
this.setTitle("Falling");
}
if(false)
{
    this.setExtendedState(this.MAXIMIZED_BOTH)

}
else
{
    this.setSize (1024, 768)
this.setLocationRelativeTo(null)
this.setResizable(false)
}

 

Netbeans is saying that this.setTitle("Falling") expects a class,method or enum. However i thought i already specified that is was public class window in package falling. Am i forgetting something?


Edited by 018thedude, 27 January 2013 - 12:50 PM.


Sponsor:

#2 Glass_Knife   Moderators   -  Reputation: 3468

Like
2Likes
Like

Posted 27 January 2013 - 12:59 PM


package falling; <- this is fine

// Note, convention is to use a Capital letter for class names
// Window, not window.  Not an error, just what everyone does 
public class window { <- start window class definition


   this.setTitle("Falling"); <- this code isn't in the right place.  Try a constructor or a method.

} <- end window class definition

// This code below the comment doesn't belong to the window class.  It doesn't belong to any class.
// Fix this :)
if(false)
{
   this.setExtendedState(this.MAXIMIZED_BOTH)  <- somthing missing here
 
}
else
{
   this.setSize (1024, 768) <- somthing missing here
   this.setLocationRelativeTo(null) <- somthing missing here
   this.setResizable(false) <- somthing missing here
}

Edited by Glass_Knife, 27 January 2013 - 03:45 PM.

I think, therefore I am. I think? - "George Carlin"
Indie Game Programming

#3 capn_midnight   Crossbones+   -  Reputation: 1375

Like
0Likes
Like

Posted 28 January 2013 - 06:15 PM

You should also probably not name it Window, because that is a pretty common name for the base Window class in most windowing toolkits. Packages will help avoid name collisions, but it's still a pain in the ass.


[See some of My Projects] - [Find me on twitter tumblr G+ Github]




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS