- y = insets.top + (int)(mn.getTick() / 24) * NOTE_SIZE;
- height = (mn.getDuration() / 24) * NOTE_SIZE;
- //System.out.println(findComponentAt(x, y) != this);
- elem.setBounds(x, y, NOTE_SIZE, 20);
+ y = insets.top + (int)(mn.getTick() / beatsPerSixteenth) * NOTE_HEIGHT;
+ height = (mn.getDuration() / beatsPerSixteenth) * NOTE_HEIGHT;
+ if (height == 0) height = NOTE_HEIGHT;
+ Rectangle r = new Rectangle(x, y, NOTE_WIDTH, height);
+ while(isOccupied(r)) r.translate(NOTE_WIDTH, 0);
+ elem.setBounds(r);
+ rects.add(r);
+ if (viewLength < (y + height)) viewLength = y + height;