Adjust time with inner class

I have a inner class AlarmMode built but am not able to get it to change the time, i  stop the thread,  but it still don't work. Can someone help me get it to work?

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.KeyListener;
import javax.swing.AbstractAction;
import javax.swing.JLabel;
import java.lang.String;
import javax.swing.*;
import java.util.Formatter;
import java.util.*;
import java.util.GregorianCalendar;
import java.text.DecimalFormat;

/**
 *
 * @author  HP_Owner
 */
public class ReminderGUI extends javax.swing.JFrame  
{
enum Mode {
CLOCK, ALARM, TIMER, STOPWATCH, DATE, AUDIO, REMINDERS, CUSTOM, SETUP
};

   private java.util.List<Mode> modes;
   private int modeIndex;
   private Mode currentMode;
   boolean alarmStarted = false;
   public String alarmTime;
   private javax.swing.JLabel timeDisplay;
   private ClockDisplay clockDisplay;
   private DateDisplay dateDisplay;
   private StopWatch stopWatchPanel;
   private Thread runner;
   
   
   /**
     * Creates new form ReminderGUI
     */
public ReminderGUI() {
initComponents();
initModes();
}
 private void initModes()
   {
     modes = new java.util.ArrayList<Mode>();
      for (Mode m : Mode.values())
      {
         modes.add(m);
      }
      modeButton.setAction(new AdvanceModeAction("Mode"));
      advanceMode(); // Advance mode to Clock
      clockDisplay = new ClockDisplay();
      dateDisplay = new DateDisplay();
   }
   
    private class AdvanceModeAction extends javax.swing.AbstractAction
   {
      public AdvanceModeAction(String name)
      {
         super(name);
      }

      public void actionPerformed(java.awt.event.ActionEvent e)
      {
         advanceMode();
         

         enableAllButtons();

         if (currentMode == Mode.ALARM)
         {
            recordButton.setEnabled(false);
            playButton.setEnabled(false);
            stopButton.setEnabled(false);
            setButton.setEnabled(false);
            stop();
         }
         else if (currentMode == Mode.AUDIO)
         {
            hourButton.setEnabled(false);
            minutesButton.setEnabled(false);

         }
         else if (currentMode == Mode.CLOCK)
         {
            recordButton.setEnabled(false);
            playButton.setEnabled(false);
            stopButton.setEnabled(false);
         }
         else if (currentMode == Mode.DATE)
         {
            recordButton.setEnabled(false);
            playButton.setEnabled(false);
            stopButton.setEnabled(false);
         }
         else if (currentMode == Mode.TIMER)
         {
            recordButton.setEnabled(false);
            playButton.setEnabled(false);
            stopButton.setEnabled(false);
            //dispProv.setDispListener(timeDisplay);
         }
         else   if (currentMode == Mode.REMINDERS)
         {
            recordButton.setEnabled(false);
            playButton.setEnabled(false);
            stopButton.setEnabled(false);
            hourButton.setEnabled(false);
            minutesButton.setEnabled(false);
            upButton.setEnabled(false);
            downButton.setEnabled(false);
         }
         else   if (currentMode == Mode.CUSTOM)
         {
            setButton.setEnabled(false);
            recordButton.setEnabled(false);
            playButton.setEnabled(false);
            stopButton.setEnabled(false);
            hourButton.setEnabled(false);
            minutesButton.setEnabled(false);
            upButton.setEnabled(false);
            downButton.setEnabled(false);
          }
          else   if (currentMode == Mode.SETUP)
          {
            setButton.setEnabled(false);
            recordButton.setEnabled(false);
            playButton.setEnabled(false);
            stopButton.setEnabled(false);
            hourButton.setEnabled(false);
            minutesButton.setEnabled(false);
            upButton.setEnabled(false);
            downButton.setEnabled(false);
          }
                else   if (currentMode == Mode.STOPWATCH)
          {
            setButton.setEnabled(false);
            recordButton.setEnabled(false);
            playButton.setEnabled(false);
            stopButton.setEnabled(false);
            hourButton.setEnabled(false);
            minutesButton.setEnabled(false);
            upButton.setEnabled(false);
            downButton.setEnabled(false);
            stopWatchPanel = new StopWatch();
          }
     
 }  
   private void enableAllButtons()
   {
      downButton.setEnabled(true);
      setButton.setEnabled(true);
      hourButton.setEnabled(true);
      minutesButton.setEnabled(true);
      modeButton.setEnabled(true);
      okButton.setEnabled(true);
      playButton.setEnabled(true);
      recordButton.setEnabled(true);
      stopButton.setEnabled(true);
      upButton.setEnabled(true);
   
   }
     
}
     private void advanceMode()
   {
      currentMode = modes.get(modeIndex++ % modes.size());
      modeDisplay.setText(currentMode.toString());
   }
   void getModeDisplay()
   {
      currentMode = modes.get(modeIndex++ % modes.size());
   }
   
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                         
    private void initComponents() {
        timeDisplay3 = new javax.swing.JLabel();
        datePanel = new javax.swing.JPanel();
        monthDisplay = new javax.swing.JLabel();
        dateLabel = new javax.swing.JLabel();
        dayDisplay = new javax.swing.JLabel();
        yearDisplay = new javax.swing.JLabel();
        buttonPanel = new javax.swing.JPanel();
        modeButton = new javax.swing.JButton();
        okButton = new javax.swing.JButton();
        hourButton = new javax.swing.JButton();
        minutesButton = new javax.swing.JButton();
        recordButton = new javax.swing.JButton();
        playButton = new javax.swing.JButton();
        upButton = new javax.swing.JButton();
        downButton = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        setButton = new javax.swing.JButton();
        stopButton = new javax.swing.JButton();
        modeDisplay = new javax.swing.JTextField();
        panelNamePanel = new javax.swing.JPanel();
        panelNameLabel = new javax.swing.JLabel();
        timePanel = new javax.swing.JPanel();
        timeLabel = new javax.swing.JLabel();
        hoursDisplay = new javax.swing.JLabel();
        minutesDisplay = new javax.swing.JLabel();
        secondsDisplay = new javax.swing.JLabel();
        amPmDisplay = new javax.swing.JLabel();

        timeDisplay3.setFont(new java.awt.Font("Tahoma", 0, 30));
        timeDisplay3.setForeground(new java.awt.Color(204, 0, 0));
        timeDisplay3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        timeDisplay3.setText("00");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setResizable(false);
        datePanel.setBackground(new java.awt.Color(0, 102, 102));
        monthDisplay.setFont(new java.awt.Font("Tahoma", 0, 30));
        monthDisplay.setForeground(new java.awt.Color(204, 255, 204));
        monthDisplay.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        monthDisplay.setText("00");

        dateLabel.setFont(new java.awt.Font("Tahoma", 1, 14));
        dateLabel.setForeground(new java.awt.Color(255, 255, 255));
        dateLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        dateLabel.setText("Date");

        dayDisplay.setFont(new java.awt.Font("Tahoma", 0, 30));
        dayDisplay.setForeground(new java.awt.Color(204, 255, 204));
        dayDisplay.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        dayDisplay.setText("00");

        yearDisplay.setFont(new java.awt.Font("Tahoma", 0, 30));
        yearDisplay.setForeground(new java.awt.Color(204, 255, 204));
        yearDisplay.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        yearDisplay.setText("0000");

        javax.swing.GroupLayout datePanelLayout = new javax.swing.GroupLayout(datePanel);
        datePanel.setLayout(datePanelLayout);
        datePanelLayout.setHorizontalGroup(
            datePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, datePanelLayout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addComponent(dateLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(monthDisplay)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(dayDisplay)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(yearDisplay)
                .addGap(24, 24, 24))
        );
        datePanelLayout.setVerticalGroup(
            datePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(datePanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(datePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(monthDisplay)
                    .addComponent(dayDisplay)
                    .addComponent(dateLabel)
                    .addComponent(yearDisplay, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        buttonPanel.setBackground(new java.awt.Color(0, 102, 102));
        modeButton.setBackground(new java.awt.Color(0, 0, 0));
        modeButton.setFont(new java.awt.Font("Tahoma", 1, 12));
        modeButton.setForeground(new java.awt.Color(0, 204, 204));
        modeButton.setText("Mode");
        modeButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        modeButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                event(evt);
            }
        });

        okButton.setBackground(new java.awt.Color(0, 0, 0));
        okButton.setFont(new java.awt.Font("Tahoma", 1, 12));
        okButton.setForeground(new java.awt.Color(0, 204, 204));
        okButton.setText("OK");
        okButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        okButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                event(evt);
            }
        });

        hourButton.setBackground(new java.awt.Color(0, 0, 0));
        hourButton.setFont(new java.awt.Font("Tahoma", 1, 12));
        hourButton.setForeground(new java.awt.Color(0, 204, 204));
        hourButton.setText("Hour");
        hourButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        hourButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                event(evt);
            }
        });

        minutesButton.setBackground(new java.awt.Color(0, 0, 0));
        minutesButton.setFont(new java.awt.Font("Tahoma", 1, 12));
        minutesButton.setForeground(new java.awt.Color(0, 204, 204));
        minutesButton.setText("Minutes");
        minutesButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        minutesButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                event(evt);
            }
        });

        recordButton.setBackground(new java.awt.Color(0, 0, 0));
        recordButton.setFont(new java.awt.Font("Tahoma", 1, 12));
        recordButton.setForeground(new java.awt.Color(0, 204, 204));
        recordButton.setText("Record");
        recordButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        recordButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                event(evt);
            }
        });

        playButton.setBackground(new java.awt.Color(0, 0, 0));
        playButton.setFont(new java.awt.Font("Tahoma", 1, 12));
        playButton.setForeground(new java.awt.Color(0, 204, 204));
        playButton.setText("Play");
        playButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        playButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                event(evt);
            }
        });

        upButton.setBackground(new java.awt.Color(0, 0, 0));
        upButton.setFont(new java.awt.Font("Tahoma", 1, 12));
        upButton.setForeground(new java.awt.Color(0, 204, 204));
        upButton.setText("Up");
        upButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        upButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                event(evt);
            }
        });

        downButton.setBackground(new java.awt.Color(0, 0, 0));
        downButton.setFont(new java.awt.Font("Tahoma", 1, 12));
        downButton.setForeground(new java.awt.Color(0, 204, 204));
        downButton.setText("Down");
        downButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        downButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                event(evt);
            }
        });

        jButton1.setBackground(new java.awt.Color(0, 0, 0));
        jButton1.setFont(new java.awt.Font("Tahoma", 1, 11));
        jButton1.setForeground(new java.awt.Color(255, 255, 255));
        jButton1.setText("Loop");

        setButton.setBackground(new java.awt.Color(0, 0, 0));
        setButton.setFont(new java.awt.Font("Tahoma", 1, 12));
        setButton.setForeground(new java.awt.Color(0, 204, 204));
        setButton.setText("Set");
        setButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);

        stopButton.setBackground(new java.awt.Color(0, 0, 0));
        stopButton.setFont(new java.awt.Font("Tahoma", 1, 12));
        stopButton.setForeground(new java.awt.Color(0, 204, 204));
        stopButton.setText("Stop");
        stopButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        stopButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                event(evt);
            }
        });

        javax.swing.GroupLayout buttonPanelLayout = new javax.swing.GroupLayout(buttonPanel);
        buttonPanel.setLayout(buttonPanelLayout);
        buttonPanelLayout.setHorizontalGroup(
            buttonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(buttonPanelLayout.createSequentialGroup()
                .addGap(180, 180, 180)
                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(259, 259, 259))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup()
                .addContainerGap(12, Short.MAX_VALUE)
                .addGroup(buttonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(buttonPanelLayout.createSequentialGroup()
                        .addComponent(modeButton, javax.swing.GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(hourButton, javax.swing.GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE))
                    .addGroup(buttonPanelLayout.createSequentialGroup()
                        .addComponent(okButton, javax.swing.GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(minutesButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addGap(6, 6, 6)
                .addGroup(buttonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(stopButton, javax.swing.GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE)
                    .addComponent(setButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(buttonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(buttonPanelLayout.createSequentialGroup()
                        .addComponent(recordButton, javax.swing.GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(upButton, javax.swing.GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE))
                    .addGroup(buttonPanelLayout.createSequentialGroup()
                        .addComponent(playButton, javax.swing.GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(downButton, javax.swing.GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE)))
                .addContainerGap())
        );

        buttonPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {downButton, hourButton, minutesButton, modeButton, okButton, playButton, recordButton, setButton, stopButton, upButton});

        buttonPanelLayout.setVerticalGroup(
            buttonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(buttonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(hourButton, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE)
                    .addComponent(modeButton, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE)
                    .addComponent(recordButton, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE)
                    .addComponent(upButton, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE)
                    .addComponent(setButton, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE))
                .addGap(17, 17, 17)
                .addGroup(buttonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(minutesButton, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE)
                    .addComponent(stopButton, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE)
                    .addComponent(playButton, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE)
                    .addComponent(downButton, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE)
                    .addComponent(okButton, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton1))
        );

        buttonPanelLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {downButton, hourButton, minutesButton, modeButton, okButton, playButton, recordButton, setButton, stopButton, upButton});

        modeDisplay.setBackground(new java.awt.Color(0, 0, 0));
        modeDisplay.setEditable(false);
        modeDisplay.setFont(new java.awt.Font("Tahoma", 1, 16));
        modeDisplay.setForeground(new java.awt.Color(204, 255, 204));
        modeDisplay.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        modeDisplay.setText("CLOCK");

        panelNamePanel.setBackground(new java.awt.Color(0, 0, 0));
        panelNameLabel.setFont(new java.awt.Font("Tahoma", 0, 30));
        panelNameLabel.setForeground(new java.awt.Color(0, 204, 204));
        panelNameLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        panelNameLabel.setText("Audio Reminder Panel");

        javax.swing.GroupLayout panelNamePanelLayout = new javax.swing.GroupLayout(panelNamePanel);
        panelNamePanel.setLayout(panelNamePanelLayout);
        panelNamePanelLayout.setHorizontalGroup(
            panelNamePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelNamePanelLayout.createSequentialGroup()
                .addContainerGap(100, Short.MAX_VALUE)
                .addComponent(panelNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(61, 61, 61))
        );
        panelNamePanelLayout.setVerticalGroup(
            panelNamePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelNamePanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(panelNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        timePanel.setBackground(new java.awt.Color(0, 102, 102));
        timePanel.setPreferredSize(new java.awt.Dimension(100, 100));
        timeLabel.setBackground(new java.awt.Color(255, 255, 255));
        timeLabel.setFont(new java.awt.Font("Tahoma", 1, 14));
        timeLabel.setForeground(new java.awt.Color(255, 255, 255));
        timeLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        timeLabel.setText("Time");

        hoursDisplay.setFont(new java.awt.Font("Tahoma", 0, 30));
        hoursDisplay.setForeground(new java.awt.Color(204, 255, 204));
        hoursDisplay.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        hoursDisplay.setText("00");

        minutesDisplay.setFont(new java.awt.Font("Tahoma", 0, 30));
        minutesDisplay.setForeground(new java.awt.Color(204, 255, 204));
        minutesDisplay.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        minutesDisplay.setText("00");

        secondsDisplay.setFont(new java.awt.Font("Tahoma", 0, 30));
        secondsDisplay.setForeground(new java.awt.Color(204, 255, 204));
        secondsDisplay.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        secondsDisplay.setText("00");

        amPmDisplay.setFont(new java.awt.Font("Tahoma", 1, 14));
        amPmDisplay.setForeground(new java.awt.Color(204, 255, 204));
        amPmDisplay.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        javax.swing.GroupLayout timePanelLayout = new javax.swing.GroupLayout(timePanel);
        timePanel.setLayout(timePanelLayout);
        timePanelLayout.setHorizontalGroup(
            timePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, timePanelLayout.createSequentialGroup()
                .addContainerGap(41, Short.MAX_VALUE)
                .addComponent(timeLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(hoursDisplay)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(minutesDisplay)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(secondsDisplay)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(amPmDisplay, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        timePanelLayout.setVerticalGroup(
            timePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(timePanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(timePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(secondsDisplay)
                    .addComponent(minutesDisplay)
                    .addComponent(hoursDisplay)
                    .addComponent(timeLabel)
                    .addComponent(amPmDisplay, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(datePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(timePanel, javax.swing.GroupLayout.DEFAULT_SIZE, 233, Short.MAX_VALUE))
                    .addComponent(panelNamePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(modeDisplay, javax.swing.GroupLayout.DEFAULT_SIZE, 461, Short.MAX_VALUE)
                    .addComponent(buttonPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(panelNamePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(timePanel, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(datePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(modeDisplay, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(buttonPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(6, 6, 6))
        );
        pack();
    }// </editor-fold>                        

   
   
   
   
    private class DateDisplay implements Runnable
  {

      Thread t;
      int i;
      private DecimalFormat formatter = new DecimalFormat( "00" ) ;
   
    public DateDisplay() {

     runner = new Thread(this);
      start();
     
    }

     public void run() {
        while(true) {
            clockCalendar = new GregorianCalendar();
            currentMonth = clockCalendar.get(Calendar.MONTH);
            currentDay = clockCalendar.get(Calendar.DATE);
            currentYear = clockCalendar.get(Calendar.YEAR);
           
            monthDisplay.setText(""  + formatter.format( currentMonth ) );
            dayDisplay.setText("" + formatter.format( currentDay ) );
            yearDisplay.setText(""  + formatter.format( currentYear ) );
             
            try {
                Thread.sleep(1000);
            } catch(InterruptedException interruptedexception) { }
        }
 
      }



  }


  private class ClockDisplay implements Runnable
  {
        Thread t;
        int i;
        private DecimalFormat formatter = new DecimalFormat( "00" ) ;
   
     public ClockDisplay() {
       
     
      runner = new Thread(this);
      start();
     }

   

     public void run() {
         while(runner != null) {
            //currentTimeZone = TimeZone.getDefault() ;
            clockCalendar = new GregorianCalendar();
            if(hourFormat == 24)
               currentHour = clockCalendar.get(Calendar.HOUR_OF_DAY);
            else
            currentHour = clockCalendar.get(Calendar.HOUR);
            currentMinute = clockCalendar.get(Calendar.MINUTE);
            currentSecond = clockCalendar.get(Calendar.SECOND);
          currentAmPm = clockCalendar.get(Calendar.AM_PM);
             
              hoursDisplay.setText("" + formatter.format( currentHour) );
            minutesDisplay.setText(""   + formatter.format( currentMinute) );
            secondsDisplay.setText(""   + formatter.format( currentSecond) );
              
              if(Calendar.AM_PM == Calendar.AM) {
                 amPmDisplay.setText("AM");
            }
            else{
               amPmDisplay.setText("PM");
            }

            try {
                t.sleep(1000);
            } catch(InterruptedException interruptedexception) { }
          }
   
      }
   
  }


   
   
    private void event(java.awt.event.ActionEvent evt) {                      
// TODO add your handling code here:
    }                      
   
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new ReminderGUI().setVisible(true);
            }
        });
    }
    private TimeZone currentTimeZone;
    private int currentDay;
    private int currentMonth;
    private int currentYear;
    private int currentHour;
    private int currentMinute;
    private int currentSecond;
    private int currentAmPm;
    private GregorianCalendar clockCalendar;
    private int hourFormat;
    // Variables declaration - do not modify                    
    private javax.swing.JLabel amPmDisplay;
    private javax.swing.JPanel buttonPanel;
    private javax.swing.JLabel dateLabel;
    private javax.swing.JPanel datePanel;
    private javax.swing.JLabel dayDisplay;
    private javax.swing.JButton downButton;
    private javax.swing.JButton hourButton;
    private javax.swing.JLabel hoursDisplay;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton minutesButton;
    private javax.swing.JLabel minutesDisplay;
    private javax.swing.JButton modeButton;
    private javax.swing.JTextField modeDisplay;
    private javax.swing.JLabel monthDisplay;
    private javax.swing.JButton okButton;
    private javax.swing.JLabel panelNameLabel;
    private javax.swing.JPanel panelNamePanel;
    private javax.swing.JButton playButton;
    private javax.swing.JButton recordButton;
    private javax.swing.JLabel secondsDisplay;
    private javax.swing.JButton setButton;
    private javax.swing.JButton stopButton;
    private javax.swing.JLabel timeDisplay3;
    private javax.swing.JLabel timeLabel;
    private javax.swing.JPanel timePanel;
    private javax.swing.JButton upButton;
    private javax.swing.JLabel yearDisplay;
    // End of variables declaration                  
private class AlarmMode extends AbstractAction {

   
    public final int HR = 0;
    public final int MIN = 1;
    private int timerTime;
    int hr =0;
    int min = 0;
    int selected = -1;
    private Mode currentMode;
    DecimalFormat formatter;
    String hourtime;
    String minutestime;
    public AlarmMode(){

   }
 
    public void actionPerformed(ActionEvent event) {
        String cmd = event.getActionCommand();
        formatter = new DecimalFormat("00") ;

        if (currentMode == Mode.ALARM) {
           
              if (cmd.equals(hourButton.getText())) {

                selected = HR;

            } else if (cmd.equals(minutesButton.getText()))
{
                selected = MIN;

            } else if (cmd.equals(upButton.getText())) {
               if (selected == HR) {

                    String hourtime = hoursDisplay.getText();            
                    int hr = Integer.parseInt(hourtime);
                    hourtime = Integer.toString(hr + 1);                          
                    //hoursDisplay.setText("" + formatter.format (hourtime));  //modified time
               
          } else
                if (selected == MIN) {

                    String minutestime = minutesDisplay.getText();
                    int min = Integer.parseInt(minutestime);
                    minutestime = Integer.toString(min + 1);
                    //minutesDisplay.setText(""  + formatter.format(minutestime)); //modified time
                }
            } else
                if (selected == HR) {

                    String hourtime = hoursDisplay.getText();            
                    int hr = Integer.parseInt(hourtime);
                    hourtime = Integer.toString(hr - 1);                          
                    //hoursDisplay.setText(""  + formatter.format(hourtime));  //modified time
            } else
                if (selected == MIN) {

                    String minutestime = minutesDisplay.getText();
                    int min = Integer.parseInt(minutestime);
                    minutestime = Integer.toString(min - 1);
                    //minutesDisplay.setText(""  + formatter.format( minutestime)); //modified time

                }
            } else
                if (cmd.equals(okButton.getText())) {
                     selected = HR;
                    currentMode = Mode.CLOCK;
                    modeDisplay.setText(currentMode.toString());
      //clockDisplay = new ClockDisplay();  
                     hoursDisplay.setText("" + formatter.format (hourtime));  //modified time
                  minutesDisplay.setText(""  + formatter.format( minutestime)); //modified time
                     start();
                }
       
        }
   
       

      public void timerTime(){
                hr = hr * 60 * 60 * 1000;
           min = min * 60 * 1000;
           timerTime = hr + min;
      }

     
}
         public void start() {
            if(runner == null)
            runner = new Thread();
            runner.start();
        }
   
         public void stop() {
            runner = null;
        }

}
Drop_of_RainAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
sciuriwareConnect With a Mentor Commented:
You don't activate that class at all!
It's not working by itself,
every JAVA program starts in 'main()' and EVERYTHING must be activated
from there, directly or indirectly.
Do not expect that a class (or better its methods) start working by themselves.

;JOOP!
0
 
sciuriwareCommented:
I don't see you do anything with that class. Of course, then nothing will happen.

;JOOP!
0
 
Drop_of_RainAuthor Commented:
In the inner class AlarmMode at the bottom.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Drop_of_RainAuthor Commented:
I added that class to: thanks i missed that i though i had did it, i did but to another version,  But it still doesn't work.

private void initModes()
   {
     modes = new java.util.ArrayList<Mode>();
      for (Mode m : Mode.values())
      {
         modes.add(m);
      }
      modeButton.setAction(new AdvanceModeAction("Mode"));
      advanceMode(); // Advance mode to Clock
      clockDisplay = new ClockDisplay();
      dateDisplay = new DateDisplay();
      alarmMode = new AlarmMode();
   }
0
 
sciuriwareCommented:
Your program gets more readable if you delete all those redundant class names:
After you say:
import javax.swing.JLabel;

You can replace all:
   private javax.swing.JLabel timeDisplay;
by:
   private JLabel timeDisplay;

Obviously you don't use a tool like ECLIPSE; it would make many things easier for you.
Then: you do many things you don't have to, like converting a string to a number and back.
If you store some number, do not store it as text, but only convert it to String for display.
Finally: your class AlarmMode does nothing:: the constructor is empty, no ActionListener is set.
;JOOP!
0
 
Drop_of_RainAuthor Commented:
I use NetBeans 5.5. Just to let you know I started with the GUI al over again and copied the classes that were working in the other GUI. The class you are telling me about is a class that someone from here helped create, I followed his examples. I have some other code to do it but no one from here has looked at it to help me put it together, which i like much better.  In you code how do I declare the [k] it asks for that variable.
0
 
sciuriwareCommented:
I answered that question already.
This is the result of the chaos you create with so many parallel questions.

I go.
0
 
Drop_of_RainAuthor Commented:
This is the old GUI and those classes worked, what is the difference?


import java.awt.Color;
import java.awt.Container;
import java.util.Calendar;
import javax.swing.AbstractAction;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.border.Border;
import java.awt.event.ActionEvent;
import javax.swing.JLabel;


public class GuiPanel extends javax.swing.JFrame
{
   enum Mode {
      Alarm, Timer, Clock, Date, Audio
   };

   private java.util.List<Mode> modes;
   private int modeIndex;
   private Mode currentMode;
   boolean alarmStarted = false;
   public String alarmTime;
   //   private/** Creates new form GuiPanel */
   public GuiPanel()
   {
      initComponents();
      initModes();
   }


   private void initModes()
   {
      modes = new java.util.ArrayList<Mode>();
      for (Mode m : Mode.values())
      {
         modes.add(m);
      }
      modeButton.setAction(new AdvanceModeAction("Mode"));
   }

   private class AdvanceModeAction extends javax.swing.AbstractAction
   {
      public AdvanceModeAction(String name)
      {
         super(name);
      }

      public void actionPerformed(java.awt.event.ActionEvent e)
      {
         advanceMode();
         modeDisplay.setText(currentMode.toString());

         enableAllButtons();

         if (currentMode == Mode.Alarm)
         {
            recordButton.setEnabled(false);
            playButton.setEnabled(false);
            stopButton.setEnabled(false);
            fastButton.setEnabled(false);

            alarmTempDisplay = new JLabel(timeDisplay.getText());
            alarmStarted = false;
            dispProv.setDispListener(alarmTempDisplay);
         }
         else if (currentMode == Mode.Audio)
         {
            hourButton.setEnabled(false);
            minutesButton.setEnabled(false);

         }
         else if (currentMode == Mode.Clock)
         {
            recordButton.setEnabled(false);
            playButton.setEnabled(false);
            stopButton.setEnabled(false);
         }
         else if (currentMode == Mode.Date)
         {
            recordButton.setEnabled(false);
            playButton.setEnabled(false);
            stopButton.setEnabled(false);
         }
         else if (currentMode == Mode.Timer)
         {
            recordButton.setEnabled(false);
            playButton.setEnabled(false);
            stopButton.setEnabled(false);
            dispProv.setDispListener(timeDisplay);
         }


      }
   }

private class AlarmButtonSelectAction extends javax.swing.AbstractAction
   {
      public final int HR = 0;
      public final int MIN = 1;

      int selected = -1;

      public void actionPerformed(ActionEvent e)
      {
         String cmd = e.getActionCommand();
         if (currentMode == Mode.Alarm)
         {
            if (cmd.equals(hourButton.getText()))
            {
               selected = HR;
            }
            else if (cmd.equals(minutesButton.getText()))
            {
               selected = MIN;
            }
            else if (cmd.equals(upButton.getText()))
            {
               if (selected == HR)
               {
                  String time = timeDisplay.getText();
                  String[] splitTime = time.split(":");

                  int hr = Integer.parseInt(splitTime[0].trim());
                  time = Integer.toString(hr + 1) + ":" + splitTime[1] + ":" + splitTime[2];

                  timeDisplay.setText(time); //modified time
               }
               else if (selected == MIN)
               {
                  String time = timeDisplay.getText();
                  String[] splitTime = time.split(":");

                  int min = Integer.parseInt(splitTime[1].trim());
                  time = splitTime[0] + ":" + Integer.toString(min + 1) + ":" + splitTime[2];

                  timeDisplay.setText(time); //modified time
               }
            }
            else if (cmd.equals(downButton.getText()))
            {
               if (selected == HR)
               {
                  String time = timeDisplay.getText();
                  String[] splitTime = time.split(":");

                  int hr = Integer.parseInt(splitTime[0].trim());
                  time = Integer.toString(hr - 1) + ":" + splitTime[1] + ":" + splitTime[2];

                  timeDisplay.setText(time); //modified time
               }
               else if (selected == MIN)
               {
                  String time = timeDisplay.getText();
                  String[] splitTime = time.split(":");

                  int min = Integer.parseInt(splitTime[1].trim());
                  time = splitTime[0] + ":" + Integer.toString(min - 1) + ":" + splitTime[2];

                  timeDisplay.setText(time); //modified time
               }
            }
            else if (cmd.equals(okButton.getText()))
            {
               //time should be stored in alarmDisplay
               alarmStarted = true;
               alarmTime = timeDisplay.getText();
               selected = -1;
            }
         }
      }

   }



   private void enableAllButtons()
   {
      downButton.setEnabled(true);
      fastButton.setEnabled(true);
      hourButton.setEnabled(true);
      minutesButton.setEnabled(true);
      modeButton.setEnabled(true);
      okButton.setEnabled(true);
      playButton.setEnabled(true);
      recordButton.setEnabled(true);
      stopButton.setEnabled(true);
      upButton.setEnabled(true);
   }

   private void advanceMode()
   {
      currentMode = modes.get(modeIndex++ % modes.size());
   }


   /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    */
   // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                         
   private void initComponents()
   {
      jPanel1 = new javax.swing.JPanel();
      jLabel1 = new javax.swing.JLabel();
      timeDisplay = new javax.swing.JLabel();
      jPanel2 = new javax.swing.JPanel();
      modeDisplay = new javax.swing.JTextField();
      jPanel3 = new javax.swing.JPanel();
      modeButton = new javax.swing.JButton();
      okButton = new javax.swing.JButton();
      hourButton = new javax.swing.JButton();
      minutesButton = new javax.swing.JButton();
      recordButton = new javax.swing.JButton();
      playButton = new javax.swing.JButton();
      fastButton = new javax.swing.JButton();
      stopButton = new javax.swing.JButton();
      upButton = new javax.swing.JButton();
      downButton = new javax.swing.JButton();

      AlarmButtonSelectAction alarmButtonSelectAction = new AlarmButtonSelectAction();

      setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
      setResizable(false);
      jPanel1.setBackground(new java.awt.Color(255, 255, 255));
      jLabel1.setFont(new java.awt.Font("Tahoma", 2, 18));
      jLabel1.setForeground(new java.awt.Color(51, 51, 255));
      jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
      jLabel1.setText("Audio Reminder Panel");

      timeDisplay.setFont(new java.awt.Font("Tahoma", 0, 36));
      timeDisplay.setForeground(new java.awt.Color(204, 0, 0));
      timeDisplay.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
      timeDisplay.setText("00:00:00");

      javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
      jPanel1.setLayout(jPanel1Layout);
      jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(timeDisplay, javax.swing.GroupLayout.DEFAULT_SIZE, 439, Short.MAX_VALUE).addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 439, Short.MAX_VALUE));
      jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel1Layout.createSequentialGroup().addContainerGap().addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(timeDisplay, javax.swing.GroupLayout.DEFAULT_SIZE, 47, Short.MAX_VALUE).addContainerGap()));

      jPanel2.setBackground(new java.awt.Color(0, 0, 0));
      modeDisplay.setBackground(new java.awt.Color(255, 255, 255));
      modeDisplay.setEditable(false);
      modeDisplay.setFont(new java.awt.Font("Tahoma", 1, 12));
      modeDisplay.setHorizontalAlignment(javax.swing.JTextField.CENTER);

      javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
      jPanel2.setLayout(jPanel2Layout);
      jPanel2Layout.setHorizontalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel2Layout.createSequentialGroup().addGap(152, 152, 152).addComponent(modeDisplay, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE).addContainerGap(158, Short.MAX_VALUE)));
      jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(modeDisplay, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 33, Short.MAX_VALUE));

      jPanel3.setBackground(new java.awt.Color(255, 255, 255));
      modeButton.setBackground(new java.awt.Color(0, 0, 0));
      modeButton.setFont(new java.awt.Font("Tahoma", 1, 11));
      modeButton.setForeground(new java.awt.Color(255, 255, 255));
      modeButton.setText("Mode");
      modeButton.addActionListener(new java.awt.event.ActionListener()
      {
         public void actionPerformed(java.awt.event.ActionEvent evt)
         {
            event(evt);
         }
      });

      okButton.setBackground(new java.awt.Color(0, 0, 0));
      okButton.setFont(new java.awt.Font("Tahoma", 1, 11));
      okButton.setForeground(new java.awt.Color(255, 255, 255));
      okButton.setText("OK");
      okButton.addActionListener(new java.awt.event.ActionListener()
      {
         public void actionPerformed(java.awt.event.ActionEvent evt)
         {
            event(evt);
         }
      });
      okButton.addActionListener(alarmButtonSelectAction);

      hourButton.setBackground(new java.awt.Color(0, 0, 0));
      hourButton.setFont(new java.awt.Font("Tahoma", 1, 11));
      hourButton.setForeground(new java.awt.Color(255, 255, 255));
      hourButton.setText("Hour");
      hourButton.addActionListener(new java.awt.event.ActionListener()
      {
         public void actionPerformed(java.awt.event.ActionEvent evt)
         {
            event(evt);
         }
      });
      hourButton.addActionListener(alarmButtonSelectAction);

      minutesButton.setBackground(new java.awt.Color(0, 0, 0));
      minutesButton.setFont(new java.awt.Font("Tahoma", 1, 11));
      minutesButton.setForeground(new java.awt.Color(255, 255, 255));
      minutesButton.setText("Minutes");
      minutesButton.addActionListener(new java.awt.event.ActionListener()
      {
         public void actionPerformed(java.awt.event.ActionEvent evt)
         {
            event(evt);
         }
      });
      minutesButton.addActionListener(alarmButtonSelectAction);

      recordButton.setBackground(new java.awt.Color(0, 0, 0));
      recordButton.setFont(new java.awt.Font("Tahoma", 1, 11));
      recordButton.setForeground(new java.awt.Color(255, 255, 255));
      recordButton.setText("Record");
      recordButton.addActionListener(new java.awt.event.ActionListener()
      {
         public void actionPerformed(java.awt.event.ActionEvent evt)
         {
            event(evt);
         }
      });

      playButton.setBackground(new java.awt.Color(0, 0, 0));
      playButton.setFont(new java.awt.Font("Tahoma", 1, 11));
      playButton.setForeground(new java.awt.Color(255, 255, 255));
      playButton.setText("Play");
      playButton.addActionListener(new java.awt.event.ActionListener()
      {
         public void actionPerformed(java.awt.event.ActionEvent evt)
         {
            event(evt);
         }
      });

      fastButton.setBackground(new java.awt.Color(0, 0, 0));
      fastButton.setFont(new java.awt.Font("Tahoma", 1, 11));
      fastButton.setForeground(new java.awt.Color(255, 255, 255));
      fastButton.setText("Fast");
      fastButton.addActionListener(new java.awt.event.ActionListener()
      {
         public void actionPerformed(java.awt.event.ActionEvent evt)
         {
            event(evt);
         }
      });

      stopButton.setBackground(new java.awt.Color(0, 0, 0));
      stopButton.setFont(new java.awt.Font("Tahoma", 1, 11));
      stopButton.setForeground(new java.awt.Color(255, 255, 255));
      stopButton.setText("Stop");
      stopButton.addActionListener(new java.awt.event.ActionListener()
      {
         public void actionPerformed(java.awt.event.ActionEvent evt)
         {
            event(evt);
         }
      });

      upButton.setBackground(new java.awt.Color(0, 0, 0));
      upButton.setFont(new java.awt.Font("Tahoma", 1, 11));
      upButton.setForeground(new java.awt.Color(255, 255, 255));
      upButton.setText("Up");
      upButton.addActionListener(new java.awt.event.ActionListener()
      {
         public void actionPerformed(java.awt.event.ActionEvent evt)
         {
            event(evt);
         }
      });
      upButton.addActionListener(alarmButtonSelectAction);

      downButton.setBackground(new java.awt.Color(0, 0, 0));
      downButton.setFont(new java.awt.Font("Tahoma", 1, 11));
      downButton.setForeground(new java.awt.Color(255, 255, 255));
      downButton.setText("Down");
      downButton.addActionListener(new java.awt.event.ActionListener()
      {
         public void actionPerformed(java.awt.event.ActionEvent evt)
         {
            event(evt);
         }
      });
      downButton.addActionListener(alarmButtonSelectAction);

      javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
      jPanel3.setLayout(jPanel3Layout);
      jPanel3Layout.setHorizontalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel3Layout.createSequentialGroup().addContainerGap().addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel3Layout.createSequentialGroup().addComponent(modeButton).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(hourButton).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(recordButton).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(fastButton).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(upButton)).addGroup(jPanel3Layout.createSequentialGroup().addComponent(okButton).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(minutesButton).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(playButton).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(stopButton).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(downButton))).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

      jPanel3Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[]{downButton, fastButton, hourButton, minutesButton, modeButton, okButton, playButton, recordButton, stopButton, upButton});

      jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel3Layout.createSequentialGroup().addContainerGap().addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(modeButton).addComponent(fastButton).addComponent(upButton).addComponent(recordButton).addComponent(hourButton, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE).addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(okButton).addComponent(minutesButton).addComponent(playButton).addComponent(stopButton).addComponent(downButton)).addGap(19, 19, 19)));

      jPanel3Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[]{downButton, fastButton, minutesButton, modeButton, okButton, playButton, recordButton, stopButton, upButton});

      javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
      getContentPane().setLayout(layout);
      layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING).addComponent(jPanel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)).addContainerGap()));
      layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addGap(14, 14, 14).addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
      pack();
   }// </editor-fold>                        


   private void event(java.awt.event.ActionEvent evt)
   {


      // TODO add your handling code here:
   }

   /**
    * @param args the command line arguments
    */
   public static void main(String args[])
   {
      java.awt.EventQueue.invokeLater(new Runnable()
      {
         public void run()
         {
            new GuiPanel().setVisible(true);
         }
      });
   }

   // Variables declaration - do not modify                    
   private javax.swing.JButton downButton;
   private javax.swing.JButton fastButton;
   private javax.swing.JButton hourButton;
   private javax.swing.JLabel jLabel1;
   private javax.swing.JPanel jPanel1;
   private javax.swing.JPanel jPanel2;
   private javax.swing.JPanel jPanel3;
   private javax.swing.JButton minutesButton;
   private javax.swing.JButton modeButton;
   private javax.swing.JTextField modeDisplay;
   private javax.swing.JButton okButton;
   private javax.swing.JButton playButton;
   private javax.swing.JButton recordButton;
   private javax.swing.JButton stopButton;
   private javax.swing.JLabel timeDisplay;
   private javax.swing.JButton upButton;
   private JLabel alarmTempDisplay;
   // End of variables declaration                  
   
   
   public javax.swing.JLabel getTimeDisplay()
   {
      return timeDisplay;
   }

   public void setTimeDisplay(javax.swing.JLabel timeDisplay)
   {
      this.timeDisplay = timeDisplay;
   }


   /**
    * @param prn
    */
   public void setDispProvider(DispTime prn)
   {
      dispProv = prn;
   }

   private DispTime dispProv;

}

import java.awt.Color;
import java.awt.Container;
import java.util.Calendar;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.border.Border;
import java.util.Calendar;
import java.util.Formatter;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;

      public class DispTime extends JFrame implements Runnable
{
   Calendar calendar;
   int i;
   JTextField time;
   Thread t;
 
   DispTime()
   {
      time = new JTextField();
      time.setEditable(false);
      t = new Thread(this);
      t.start();
   }


   public void run()
   {
      String s;
      while (true)
      {
                  Calendar c = Calendar.getInstance();
                  StringBuilder builder = new StringBuilder();
                  Formatter formatter = new Formatter(builder);
                  formatter.format("%02d:%02d:%02d", c.get(Calendar.HOUR), c.get(Calendar.MINUTE), c.get(Calendar.SECOND));
                  formatter.flush();
                  s = builder.toString();
         try
         {
            t.sleep(1000);
         }
         catch (Exception e)
         {
         }
         time.setText(" " + s);
         listenerTF.setText(time.getText());
     }
   }


   public static void main(String[] args)
   {
     
      final DispTime PRN = new DispTime();
      final GuiPanel gp = new GuiPanel();
      PRN.setDispListener(gp.getTimeDisplay());
      gp.setDispProvider(PRN);

      java.awt.EventQueue.invokeLater(new Runnable()
      {
         public void run()
         {
            gp.setVisible(true);
         }
      });

   }


   /**
    * @param timeDisplay
    */
   public void setDispListener(JLabel timeDisplay)
   {
      this.listenerTF = timeDisplay;
   }
   
   private JLabel listenerTF;
}

0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0
All Courses

From novice to tech pro — start learning today.