- y = insets.top + (int)(mn.getTick() / 24) * NOTE_SIZE;
- height = (mn.getDuration() / 24) * NOTE_SIZE;
- while(findComponentAt(x, y) != this || findComponentAt(x, y + height - 1) != this) x += NOTE_SIZE;
- elem.setBounds(x, y, NOTE_SIZE, height);
+ y = insets.top + (int)(mn.getTick() / 24) * NOTE_HEIGHT;
+ height = (mn.getDuration() / 24) * 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;