Cross-posted:http://www.java-forums.org/new-java/...tml#post310040
Good day.
My first post, yay!
I'm working on a project for school, the requirements are that we must have at least 10 classes and implement the usual stuff like inheritence, overriding, ...
I wanted to do something special, so I'm working on a visual drag'n drop program for sounds. So you can specify the frequency and duration of a tone, and add the specific block to a channel. A channel is something I created so blocks don't have to overlap. A channel is actually just an additional of blocks beneath the other one. The amount of channels is unlimited, so is the length of a Channel. Channels will be played simultaneously. Now comes the problem..
I have a class named 'SynthBlock', which contains the starting time, duration and frequency of this tone. It is a part of my Channel class. (= arraylist)
I wanted to represent a synthblock visually, so I made another class: ToneBox. This must be a child-class from JComponent and override the paintComponent method.
I wanted to ask... is it wise to inherit from the JComponent class? And how would I best calculate the coordinates needed for my drawRectangle?
Project is included if needed. I am certainly not trying to give my schoolwork away to someone else, I just want to find out the best way.
I uploaded it here: https://rapidshare.com/files/1086823385/project.zip
Greetings,
Nindustries