HOW TO CREAT SLIDERS?(PLEASE HELP)

Hey1

i have to craet three sliders (in three differet panels)so that when i get the current date the three sliders are set in a way that Year slider matches the current year,the monthe slider matchs the current month and the date slider matches the current date.

If some body could give me a start by telling me how to make a slider and how to devide it (like for months i have to devide it in to 12 devisions),i am sure i will be able to do the rest of it............(unfortunately i don't have a book either so please help me ,,,,)

THANKS A LOT!

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.util.*;

import java.text.SimpleDateFormat;

public class Grid extends JFrame /*implements ActionListener*/

{

private JPanel date_panel,year_panel, month_panel,day_panel;

private String time=new String("");

private Date date=new Date();

public Grid() {

time=time + new Date().toString();

SimpleDateFormat formatter = new SimpleDateFormat("E, MMMM d, yyyy") ;

time = formatter.format(date) ;

date_panel=new JPanel();

year_panel=new JPanel();

month_panel=new JPanel();

day_panel=new JPanel();

date_panel.setLayout(new FlowLayout());

date_panel.add(new JLabel(time));

year_panel.setLayout(new FlowLayout());

month_panel.setLayout(new FlowLayout());

day_panel.setLayout(new FlowLayout());

Container contentPane = getContentPane();

contentPane.setLayout(new GridLayout(1,4));

contentPane.add(date_panel);

//contentPane.add(year_panel);

//contentPane.add(month_panel);

//contentPane.add(day_panel);

}

public static void main(String args[]) {

Grid gw = new Grid();

gw.setTitle("Date Slider");

gw.setSize(400,200);

gw.setVisible(true);

}

}

[1938 byte] By [shahzad5] at [2007-9-26 1:13:23]
# 1
This link should help: http://java.sun.com/docs/books/tutorial/uiswing/components/slider.html
Greg_B at 2007-6-29 0:09:27 > top of Java-index,Archived Forums,Java Programming...
# 2
Thanks for your help!
shahzad5 at 2007-6-29 0:09:27 > top of Java-index,Archived Forums,Java Programming...

Archived Forums Hot Topic