* @author Andersson , Andreen, Lanneskog, Pehrson
* @version 1
*/
-
+
public class MooTrackView extends JPanel implements ActionListener {
private Track track;
private Rectangle box;
private JPopupMenu popup;
private JMenuItem menuItem;
-
+
public MooTrackView (Track track) {
this.track = track;
setPreferredSize(new Dimension(200, 200));
notes.setBorder(BorderFactory.createLineBorder(Color.black));
popup = new JPopupMenu();
- menuItem = new JMenuItem("Add...");
- menuItem.addActionListener(this);
- popup.add(menuItem);
- menuItem = new JMenuItem("Preferences...");
- menuItem.addActionListener(this);
- popup.add(menuItem);
+ menuItem = new JMenuItem("Add...");
+ menuItem.addActionListener(this);
+ popup.add(menuItem);
+ menuItem = new JMenuItem("Preferences...");
+ menuItem.addActionListener(this);
+ popup.add(menuItem);
- notes.addMouseListener(new PopupListener());
+ notes.addMouseListener(new PopupListener());
add(notes, BorderLayout.CENTER);
}
-
+
public void actionPerformed(ActionEvent e) {}
-
+
public Track getTrack() {
return track;
}
public void RectanglePanel() {
setPreferredSize(new Dimension(20, 20));
}
-
+
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
}
}
}
-
+
class PopupListener extends MouseAdapter {
- public void mousePressed(MouseEvent e) {
+ public void mousePressed(MouseEvent e) {
maybeShowPopup(e);
- }
-
- public void mouseReleased(MouseEvent e) {
+ }
+
+ public void mouseReleased(MouseEvent e) {
maybeShowPopup(e);
- }
-
- private void maybeShowPopup(MouseEvent e) {
+ }
+
+ private void maybeShowPopup(MouseEvent e) {
if (e.isPopupTrigger()) {
popup.show(e.getComponent(), e.getX(), e.getY());
}
}
}
-}
\ No newline at end of file
+}