Posted: Sun Jun 04, 2006 12:27 pm Post subject: (No subject)
cool dude wrote:
code:
public class example
Class names should always be capitalized (note: not the same as all-caps). Get into the habit early on and you'll save yourself a lot of grief.
Sponsor Sponsor
the_short1
Posted: Sun Jun 04, 2006 9:25 pm Post subject: (No subject)
well i think you can set up the templates somewhere in options to auto add it .. . but personally i have a file called template.java which has everything needed for a standard gui window and i just edit that each time.
As for the projects... example: i added Main.java and MenuTest.java to a project. I have a method called createMenu (), inside menutest, and im currently coding in main.java.. .this is what i write:
MenuTest.createMenu ();
and if i remember correctly, if you call methods this way, it is static, so method createMenu must be declared static (and all your variable inside createMenu as well).. optionally, you can create a object of the other class.. eg:
MenuTest Menu = new MenuTest ();
then just call Menu.createMenu (); .... but if you use a contructor for your GUI then initializing Menu = new MenuTest (); will open a new window..
wtd
Posted: Sun Jun 04, 2006 11:13 pm Post subject: (No subject)
Hmmm... "createMenu" sounds like something taken from Sun's tutorials.
I strongly urge you to write your own programs from scratch, rather than modifying existing source code. Copy and paste does not contribute to a fundamental understanding of the subject.
the_short1
Posted: Mon Jun 05, 2006 9:26 am Post subject: (No subject)
[quote="wtd"]Hmmm... "createMenu" sounds like something taken from Sun's tutorials.[quote]
LOL! ... more like it sounds like something from my current program... i didnt copy and paste from anywhere... lol
[code="java"]
//snippet ..
setSize (maxx,maxy); // sets size of window
setTitle ("<Pegged> Level: "+pegLevel.substring(0,(pegLevel.length()-4))); // sets title of the window
setLayout (null); // sets no style, we do it ourselves
setBackground (Color.black); // sets background of the window to black
setMenuBar(Menu.createMenu()); // adds the menubar to the window
// Menu is a object of another file in my project...
[/code]
wtd
Posted: Mon Jun 05, 2006 10:11 am Post subject: (No subject)