Navigation:  Tutorials > Beginners Guide to Smalltalk > Programming in Smalltalk > Packaging the Animal game >

Creating a new package

Previous pageReturn to chapter overviewNext page

Open the Package Browser which will display the existing packages in your system.

You can create a new empty package by choosing Package/New and then entering an appropriate package name. In this particular case I have chosen the name "Animals". You can now choose to add the two classes (Animal and Question) that comprise the game in one of two ways.

1.Go to the Class Browser and select each class in turn and, for each, right click to bring up a context menu. Then choose the Package menu command and complete the dialog that appears.
2.Alternatively, you can drag each class from the Class Browser using the mouse and drop it over the appropriate package in the Package Browser. As you do so you should see the class appear in the Classes pane of the latter.

Tip: In fact, a package can include objects other than just classes. For instance you can include individual methods in a package by dragging the methods from the Class Browser and dropping them over the correct package in the Package Browser.