+
+ public MooToolbar() {
+ setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
+ // setAlignmentX(LEFT_ALIGNMENT);
+ setFloatable(false);
+ mouseAdapter = new MAdapter();
+
+ // Creates playback buttons
+ rewind = createButton("images/rewind.gif", "Rewind");
+ record = createButton("images/record.gif", "Record");
+ playpause = createButton("images/play.gif", "Play");
+ stop = createButton("images/stop.gif", "Stop");
+ fastforward = createButton("images/forward.gif", "Fast forward");
+ playIcon = new ImageIcon("images/play.gif");
+ pauseIcon = new ImageIcon("images/pause.gif");
+
+ // Adds playback buttons
+ add(rewind);
+ add(record);
+ add(playpause);
+ add(stop);
+ add(fastforward);
+
+ // Creates progress indicator
+ measure = createLabel("Msr", 10);
+ beats = createLabel("Beat", 10);
+ ticks = createLabel("Tick", 10);
+ measuresValue = formatProgInd(createLabel("1", 16));
+ beatsValue = formatProgInd(createLabel("1", 16));
+ ticksValue = formatProgInd(createLabel("1", 16));
+ JPanel spacenorth = new JPanel();
+ spacenorth.setBackground(bgColor);
+ JPanel spacesouth = new JPanel();
+ spacesouth.setBackground(bgColor);
+
+ // Creates progress indicator panel and adds components
+ progIndPanel = new JPanel();
+ progIndPanel.setMaximumSize(new Dimension(120,27));
+ progIndPanel.setLayout(new GridLayout(2,4));
+ progIndPanel.add(spacenorth);
+ progIndPanel.add(measure);
+ progIndPanel.add(beats);
+ progIndPanel.add(ticks);
+ progIndPanel.add(spacesouth);
+ progIndPanel.add(measuresValue);
+ progIndPanel.add(beatsValue);
+ progIndPanel.add(ticksValue);
+ add(progIndPanel);
+ }
+
+ /**
+ * Updates the progress indicator.
+ * @param tickPosition the tick position to visualize
+ */
+ public void updateProgInd(long tickPosition) {
+ System.out.print("Updating to " + tickPosition + " = ");
+ if (tickPosition == 0) {
+ resetProgInd();
+ System.out.println("1:1:1");
+ } else {
+ int[] position = Moosique.getPositionForTicks(tickPosition);
+ System.out.println("" + (position[0] + 1) + ":" + (position[1] + 1) + ":" + (position[2] + 1));
+ measuresValue.setText(Integer.toString(position[0] + 1));
+ beatsValue.setText(Long.toString(position[1] + 1));
+ ticksValue.setText(Long.toString(position[2] + 1));
+ }
+ }