When I create a new class in BlueJ, it automatically adds an example field, constructor and method. Every time I create a new class, I have to delete these- it's mildly annoying. I cannot find a setting to turn this off. Is it possible?
CodePudding user response:
I found this on the web.
On Mac OS :
- Navigate to your BlueJ.app
- ctrl click on it and choose "Show Package Contents" from the contextual menu.
- Navigate to "Contents/Resources/Java/english/templates/newclass".
- Duplicate the file "stdclass.tmpl" and name it "customclass.tmpl".
- Open this file with a text editor and put in what you want to show up in your new custom class. Note that the variable "$CLASSNAME" will dynamically put in the name of the new class that you type in the dialog box so you may want to keep that in when declaring your class.
- Now, go up two directories to the "english" directory and look for a file called "labels".
- Open this with a text editor and look for the line "pkgmgr.newClass.stdclass=Class".
- Create a new line after this line and type the following "pkgmgr.newClass.customclass=Custom Class".
- Save your files, close them up and restart BlueJ. You will notice that when you go to create a new class you will have the option to check "Custom Class"
On Windows :
- Navigate to where you installed BlueJ (in my case it was C:\BlueJ)
- go into lib\english\templates\newclass
- Duplicate the file "stdclass.tmpl" and name it "customclass.tmpl".
- Open this file with a text editor and put in what you want to show up in your new custom class. Note that the variable "$CLASSNAME" will dynamically put in the name of the new class that you type in the dialog box so you may want to keep that in when declaring your class.
- Now, go up two directories to the "english" directory and look for a file called "labels".
- Open this with a text editor and look for the line "pkgmgr.newClass.stdclass=Class".
- Create a new line after this line and type the following "pkgmgr.newClass.customclass=Custom Class".
- Save your files, close them up and restart BlueJ. You will notice that when you go to create a new class you will have the option to check "Custom Class"
