i has the time but no spinners now i have spinners but no time, can
you hlp?
/**
* @(#)BigFonts4
*
*
* @Kevin
* @version 1.40 2007/4/20
*/
import java.text.*;
import java.text.ParseException;
import java.awt.*;
import java.awt.event.*;
import java.awt.event.ActionListener;
import java.awt.Color;
import java.awt.Font;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.Calendar.*;
import java.util.Date.*;
import javax.swing.*;
import javax.swing.SpinnerDateModel;
import javax.swing.event.*;
import javax.swing.event.ChangeListener;
import javax.swing.event.ChangeEvent;
import javax.swing.JSpinner.*;
import javax.swing.BorderFactory.*;
import javax.swing.border.Border;
abstract class BigFonts extends JComponent
implements MouseMotionListener, ActionListener,
ChangeListener {
public static String doTime(String ts){
String thetime;
Calendar calendar = Calendar.getInstance();
SimpleDateFormat tf = new SimpleDateFormat( "h:mm:ss aa" ) ;
thetime = tf.format(calendar.getTime());
return thetime;
}
public static void addToBox(String thetime){
// make text bigger for visually impaired friend
Font big = new Font("Serif", Font.BOLD, 40);
Border raisedetched ;
raisedetched = BorderFactory.createMatteBorder(5, 5, 1, 1,
Color.blue);
JLabel msg = new JLabel("Time to go.");
JButton thedisplay = new JButton(thetime);
thedisplay.setFont(big);
thedisplay.setSize(200, 400);
thedisplay.setBackground(Color.blue);
thedisplay.setBorder(raisedetched);
thedisplay.setVisible(true);
}
public static void showit(JSpinner hour, JSpinner minute, JSpinner
second){
Border compound = BorderFactory.createCompoundBorder();
JFrame display2 = new JFrame("Set Allarm : ");
JFrame display = new JFrame("Time Is: ");
display.setBounds(1,45,250, 85);
display.setLayout(new FlowLayout());
display.add(thedisplay);
display.setVisible(true);
display.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);;
display.setBackground(Color.blue);
display2.setBounds(1,140,250,70);
display2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);;
display2.setLayout(new FlowLayout());
hour.setFocusable(true);
display2.add(hour);
minute.setFocusable(true);
display2.add(minute);
minute.setFocusable(true);
display2.add(second);
display2.setVisible(true);
display2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
// spinner action
public void stateChanged(ChangeEvent evt){
try{
JSpinner setit = (JSpinner) (evt.getSource());
setit.setValue(setit.getNextValue());
setit.commitEdit();
}catch (ParseException p) {}
}
public void addSpinners(){
Calendar calendar = Calendar.getInstance();
Date initDate = calendar.getTime();
Date earliestDate = calendar.getTime();
Date latestDate = calendar.getTime();
SpinnerDateModel model = new SpinnerDateModel(initDate,
earliestDate,
latestDate,
Calendar.SECOND);
JSpinner hour = new JSpinner(model);
model.addChangeListener(this);
hour.setEditor(new JSpinner.DateEditor(hour, "01"));
hour.setVisible(true);
JSpinner minute = new JSpinner(model);
model.addChangeListener(this);
minute.setEditor(new JSpinner.DateEditor(minute, "02"));
minute.setVisible(true);
JSpinner second = new JSpinner(model);
model.addChangeListener(this);
second.setEditor (new JSpinner.DateEditor(second, "03"));
second.setVisible(true);
}
public static void main(String[] args){
JSpinner hour = new JSpinner();
JSpinner minute = new JSpinner();
JSpinner second = new JSpinner();
boolean set;
set = true;
String st = " Starting ...";
String theTime = " ";
String theAlarm = " ";
Thread t = new Thread();
t.start();
try{
for (;;) {
addToBox(doTime(st));
showit(hour, minute, second);
Thread.sleep(1000);
}
}catch (Exception e){}
//{ who cares }
}
};
--
Sometimes I'm in a good mood.
Sometimes I'm in a bad mood.
When all my moods have cum to pass
i hope they bury me upside down
so the world can kiss me porcelain,
white, Irish bottom.