예제 #1
0
        // CONSTRUCTOR - we could use the default ....
        // But it gets long winded to have to set each name and age separately.
        // We can change the constructor appropriately

        public Student(String aName, int anAge)
        {
            this.setName(aName);
            this.setAge(anAge);
            // create a music collection that is 40 long and is named after the student
            myMusic = new MusicCollection(40, aName + "music");
        }
예제 #2
0
        private void createCheckBox(Panel thePanel, MusicCollection tracks)
        {
            Point newLoc = new Point(5, 5); // Set whatever you want for initial location

            masterCB = new TrackCheckBox[tracks.Size()];
            String displayName;

            for (int i = 0; i < masterCB.Length; i++)
            {
                // I add the Track so I can get it back later
                masterCB[i]          = new TrackCheckBox(tracks.GetTrackByPosition(i));
                masterCB[i].Size     = new Size(180, 30);
                masterCB[i].Location = newLoc;
                newLoc.Offset(0, masterCB[i].Height + 2);

                displayName = tracks.GetTrackByPosition(i).GetTitle() +
                              " -- " +
                              tracks.GetTrackByPosition(i).GetArtist();
                masterCB[i].Text = displayName;
                thePanel.Controls.Add(masterCB[i]);
            }
        }