Urgent!Please help me!
Hey!
i wanna creat a border around year_panel.i have the lines of code(in my programe) for creating the border but they are not working properly.
If somebody could also tell me how to put month names (Jan to Dec)on the month_panel(the third panel in my programe),Even for this one i wrote in the code in my programe but somehow it is not functioning properly.
Please have a look at booth of them
thnks!
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
import java.text.SimpleDateFormat;
//import javax.swing.border.CompoundBorder;
public class Grid extends JFrame /*implements ActionListener*/
{
static final int FPS_INIT = 15; //initial frames per second
static final int FPS_INIT2=2000;
//THIS LINE
//static final double FPS_INIT3=Aug;
int intframeNumber = 0;
int delay;
boolean frozen = false;
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();
year_panel.setBorder(BorderFactory.createCompoundBorder(
BorderFactory.createTitledBorder(title),
BorderFactory.createEmptyBorder(5,5,5,5)));
JSlider framesPerSecond = new JSlider(JSlider.HORIZONTAL,
1, 31, FPS_INIT);
JSlider framesPerSecond2 = new JSlider(JSlider.HORIZONTAL,
1990, 2010, FPS_INIT2);
//THIS LINE
// JSlider framesPerSecond3 = new JSlider(JSlider.HORIZONTAL,
// Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec, FPS_INIT3);
date_panel.setLayout(new BorderLayout());
date_panel.add(new JLabel(time));
day_panel.setLayout(new BorderLayout());
day_panel.add(framesPerSecond);
year_panel.setLayout(new BorderLayout());
year_panel.add(framesPerSecond2);
month_panel.setLayout(new BorderLayout());
// month_panel.add(framesPerSecond3);
// JSlider framesPerSecond = new JSlider(JSlider.HORIZONTAL,
// 0, 31, FPS_INIT);
framesPerSecond.setMajorTickSpacing(5);
framesPerSecond.setMinorTickSpacing(1);
framesPerSecond.setPaintTicks(true);
framesPerSecond.setPaintLabels(true);
framesPerSecond.setBorder(
BorderFactory.createEmptyBorder(0,0,10,0));
framesPerSecond2.setMajorTickSpacing(5);
framesPerSecond2.setMinorTickSpacing(1);
framesPerSecond2.setPaintTicks(true);
framesPerSecond2.setPaintLabels(true);
framesPerSecond2.setBorder(
BorderFactory.createEmptyBorder(0,0,10,0));
/* framesPerSecond3.setMajorTickSpacing(2);
framesPerSecond3.setMinorTickSpacing(1);
framesPerSecond3.setPaintTicks(true);
framesPerSecond3.setPaintLabels(true);
framesPerSecond3.setBorder(
BorderFactory.createEmptyBorder(0,0,10,0));*/
Container contentPane = getContentPane();
contentPane.setLayout(new GridLayout(4,4));
contentPane.add(date_panel);
contentPane.add(year_panel);
contentPane.add(day_panel);
// contentPane.add(month_panel);
}
public static void main(String args[]) {
Grid gw = new Grid();
gw.setTitle("Date Slider");
gw.setSize(400,200);
gw.setVisible(true);
}
}

