import javax.swing.*;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseMotionAdapter;
+import java.awt.event.MouseMotionListener;
+import java.awt.Dimension;
+import java.awt.*;
+//import java.awt.Graphics;
+//import java.awt.Graphics2D;
+//import java.awt.Rectangle;
/**
*
* @version 1
*/
-public class MooTrackView {
+public class MooTrackView extends JPanel{
+ private MooTrackTitle title;
+ private JScrollPane table;
+
/**
* Creates
*/
public MooTrackView () {
+ this.addMouseMotionListener(doScrollRectToVisible);
+ setLayout(new BorderLayout());
+ this.setBorder(BorderFactory.createLineBorder(Color.black));
+ add(trackTitle(), BorderLayout.NORTH);
+ add(noteView(), BorderLayout.SOUTH);
+ }
+
+ MouseMotionListener doScrollRectToVisible = new MouseMotionAdapter() {
+ public void mouseDragged(MouseEvent e) {
+ Rectangle r = new Rectangle(e.getX(), e.getY(), 1, 1);
+ ((JPanel)e.getSource()).scrollRectToVisible(r);
+ }
+ };
+
+ private JPanel trackTitle () {
+ title = new MooTrackTitle();
+ title.setPreferredSize(new Dimension(PANEL_WIDTH, TITLE_HEIGHT));
+ title.setBorder(BorderFactory.createLineBorder(Color.black));
+ return title;
+ }
+ private JScrollPane noteView() {
+ JScrollPane scrollPane = new JScrollPane(table);
+ table.setPreferredScrollableViewportSize(new Dimension(500, 70));
+ return scrollPane;
+ }
}
+
+
+ private static final int PANEL_WIDTH = 65;
+ private static final int TITLE_HEIGHT = 20;
+ private static final int NOTEVIEW_HEIGHT = 200;
+ private static final int BOX_WIDTH = 20;
+ private static final int BOX_HEIGHT = 20;
}