private Rectangle box;
private JPopupMenu popup;
private JMenuItem menuItem;
+ protected static int viewLength = 0;
public MooTrackView (Track track) {
while(findComponentAt(x, y) instanceof MooNoteElement ||
findComponentAt(x, y + height - 1) instanceof MooNoteElement) x += NOTE_WIDTH;
elem.setBounds(x, y, NOTE_WIDTH, height);
+ if (viewLength < (y+height)) viewLength = y+height;
}
+ setPreferredSize(new Dimension(200,viewLength));
}
validate();
}
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
- for (int c = 0; c < (trackLength*NOTE_HEIGHT); c += NOTE_HEIGHT) {
+//(trackLength*NOTE_HEIGHT)
+ for (int c = 0; c < viewLength ; c += NOTE_HEIGHT) {
for (int r = 0; r < (10*NOTE_WIDTH); r += NOTE_WIDTH) {
box = new Rectangle(r, c, NOTE_WIDTH, NOTE_HEIGHT);
g2.setColor(Color.gray);