please i need some help with this, i want to display the curent date n time at the bottom of this page.
when i run it .
THANKS.

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
import java.util.Calendar;
/*
<applet code=" The.class" height=20 width=20>
</applet>
*/
public class The extends JApplet implements  ActionListener
{
/*D V*/
JPanel panel;
JLabel lo;
JLabel bo;
JLabel wo;
JLabel yo;
JLabel b1; 
JLabel l1;
JLabel l2;
JLabel display;
ImageIcon LO;
ImageIcon LO1;
ImageIcon LO2;
ImageIcon LO3;
JButton classic;
JButton western;
JButton pop;
JButton jazz;
JButton add;
JCheckBox tilo; 
JCheckBox tila;
JCheckBox tilu;
JCheckBox tile;
JCheckBox tili;
JComboBox cbta;
JTextField bu;
Font f;
GridBagLayout g;
GridBagConstraints gbc;
public void init()
{
/*I L V*/
g=new GridBagLayout(); 
gbc=new GridBagConstraints();
panel=(JPanel)getContentPane();
panel.setLayout(g);
Icon LogoImage=new ImageIcon("c:/project/music on.gif");
//you will mention the path of your jpg file
         l1=new JLabel(); 
         gbc.anchor=GridBagConstraints.EAST;
         gbc.ipady=2;
         gbc.ipadx=4;
         gbc.gridx=4;
         gbc.gridy=4;
         g.setConstraints(l1,gbc);
         panel.add(l1);
panel.setBackground(Color.blue);
/*A C P*/
classic=new JButton("Classic");
gbc.fill=GridBagConstraints.BOTH;
classic.setForeground(Color.red);
classic.setBackground(Color.blue);
    gbc.ipady=2 ;
    gbc.ipadx=2;
    gbc.gridx=1;
    gbc.gridy=3;
g.setConstraints(classic, gbc);
panel.add(classic);
tilo=new JCheckBox("Gwen Stefani");
tilo.setForeground(Color.red);
tilo.setBackground (Color.blue);
    gbc.ipady=2;
    gbc.ipadx=2;
    gbc.gridx=2;
    gbc.gridy=3;
g.setConstraints(tilo, gbc);
panel.add(tilo);
setSize(6000,9000);
/*A C P*/
western=new JButton("Western"); 
western.setForeground(Color.red);
western.setBackground(Color.blue);
    gbc.ipady=2;
    gbc.ipadx=2;
    gbc.gridx=1;
    gbc.gridy=4;
g.setConstraints(western, gbc);
panel.add(western);
tila=new JCheckBox("topee");
tila.setForeground(Color.red);
tila.setBackground(Color.blue);
    gbc.ipady=2;
    gbc.ipadx=2;
    gbc.gridx=2;
    gbc.gridy=4;
g.setConstraints(tila, gbc); 
panel.add(tila);
/*A C P*/
pop=new JButton("Pop");
pop.setForeground(Color.red);
pop.setBackground(Color.blue);
    gbc.ipady=2;
    gbc.ipadx=2;
    gbc.gridx=1;
    gbc.gridy=5; 
g.setConstraints(pop, gbc);
panel.add(pop);

tilu=new JCheckBox("Fergie");
tilu.setForeground(Color.red);
tilu.setBackground(Color.blue);
    gbc.ipady=2;
    gbc.ipadx=2;
    gbc.gridx=2 ;
    gbc.gridy=5;
g.setConstraints(tilu, gbc);
panel.add(tilu);

/*A C P*/
jazz=new JButton("Jazz");
jazz.setForeground(Color.red);
jazz.setBackground(Color.blue);
    gbc.ipady=2;
    gbc.ipadx=2;
    gbc.gridx=1;
    gbc.gridy=6;
g.setConstraints(jazz, gbc);
panel.add(jazz);
tile=new JCheckBox("10/12/07 10:25");
tile.setForeground(Color.red);
tile.setBackground(Color.blue );
    gbc.ipady=1;
    gbc.ipadx=1;
    gbc.gridx=1;
    gbc.gridy=7;
g.setConstraints(tile, gbc);
panel.add(tile);
/*A C P*/
add=new JButton("Add to cart");
add.setForeground(Color.blue );
add.setBackground(Color.green);
    gbc.ipady=2;
    gbc.ipadx=2;
    gbc.gridx=4;
    gbc.gridy=7;
g.setConstraints(add, gbc);
panel.add(add);

/*A C P*/
lo=new JLabel("select the category"); 
lo.setForeground(Color.red);
    gbc.ipady=2;
    gbc.ipadx=2;
    gbc.gridx=1;
    gbc.gridy=2;
g.setConstraints(lo, gbc);
lo.setFont(new Font("Helvetical",Font.BOLD,15));
panel.add (lo);
bo=new JLabel("List of all");
bo.setForeground(Color.red);
    gbc.ipady=2;
    gbc.ipadx=2;
    gbc.gridx=2;
    gbc.gridy=2;
g.setConstraints(bo, gbc);
panel.add(bo);
tili=new JCheckBox("Funke"); 
tili.setForeground(Color.red);
tili.setBackground(Color.blue);
    gbc.ipady=2;
    gbc.ipadx=2;
    gbc.gridx=2;
    gbc.gridy=6;
g.setConstraints(tili, gbc);
panel.add(tili);
/*I M*/
LO=new ImageIcon("c:/project/Rihanna.gif"); 
LO2=new ImageIcon("c:/project/Gwen Stefani.gif");
LO3=new ImageIcon("c:/project/Christina Milian.gif");
LO1=new ImageIcon("c:/project/Fergie.gif");
display = new JLabel();
    gbc.anchor = GridBagConstraints.LINE_END;
   gbc.gridx = 4;
   gbc.gridy = 4;
   gbc.ipadx = 3;
   gbc.ipady = 4;
   g.setConstraints(display, gbc);
   panel.add(display);
Icon logoImage=new ImageIcon("c:/project/music on.gif");
 b1=new JLabel(logoImage);
 gbc.anchor=GridBagConstraints.NORTHEAST;
         gbc.ipady=2;
         gbc.ipadx=2;
         gbc.gridx=4;
         gbc.gridy=1;
         g.setConstraints (b1,gbc);
         panel.add(b1);
classic.addActionListener(this);
western.addActionListener(this);
pop.addActionListener(this);
jazz.addActionListener(this);
tilo.addActionListener(this);
add.addActionListener (this);
}
public void actionPerformed(ActionEvent ae)
{
Object o=ae.getSource();
if(o==classic)
{
display.setIcon(LO);
tilo.setText("Fergie");
tila.setText("Christina Milian"); 
tilu.setText("Rihanna");
tili.setText("Lagbaja");
}
if(o==western)
{
display.setIcon(LO1);
tilo.setText("Funke");
tila.setText("Keinde");
tilu.setText("T-pain"); 
tili.setText("Topee");
}
if(o==pop)
{
display.setIcon(LO2);
tilo.setText("Pink");
tila.setText("Britney Spears");
tilu.setText("Limbizkit");
tili.setText ("Kelly Clarkson");
}
if(o==jazz)
{
display.setIcon(LO3);
tilo.setText("Kenny G");
tila.setText("Yenny");
tilu.setText("JazzMan");
tili.setText("Lenny"); 
}
if(add==o)
{
Add myadd = new Add();

       /*start changes*/
       myadd.init();
       myadd.start();

     int compCount = panel.getComponentCount();
     java.util.Vector componentList = new java.util.Vector();
     for(int i = 0; i < compCount; i++)
        {
        Component c = panel.getComponent(i);
        componentList.addElement(c);
       }

     for(int i = 0; i < componentList.size (); i++)
       {
        Component c = (Component)componentList.elementAt(i);
        panel.remove(c);
       }

    panel.add(myadd);

     //use this method for thread safety
     java.awt.EventQueue.invokeLater (new Runnable()
       {
        public void run() {
           javax.swing.SwingUtilities.updateComponentTreeUI(The.this);
               }
     });
     /*end changes*/

}

}
}

Set the text for a JLabel at the bottom of the GUI to be the following String:

java.util.Date currentDate = new java.util.Date();
String date = currentDate.toString();

Date is actually deprecated and should be replaced with Calendar

java.util.Calendar now = java.util.Calendar.getInstance();
String currentTime= java.text.SimpleDateFormat.getInstance().format(now.getTime());
This question has already been answered. Start a new discussion instead.