would someone care to hlp???
.... i know i should be using a lot more methods
but then they aren't declared? should i declare them in the main
so they are global???
k
/**
*
* @author kevin
*/
/**
* @(#)BigFonts3
*
*
* @Kevin
* @version 1.30 2007/4/20
*/
import java.text.*;
import java.text.ParseException;
import java.awt.*;
import java.awt.event.*;
import java.awt.event.ActionEvent;
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 java.io.IOException;
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.EtchedBorder;
import javax.swing.border.Border;
abstract class BigFonts extends JComponent
implements MouseMotionListener, ActionListener,
ChangeListener
{
int newx = 125, newy = 95;
public void paintComponent(Graphics g){
String st = " Starting ...";
g.drawString(st, newx, newy);
}
//make draggable
public void MouseDragged(MouseEvent e){
newx=e.getX();
newy=e.getY();
repaint();
}
public static String doTime(String ts){
String thetime;
Calendar calendar = Calendar.getInstance();
SimpleDateFormat tf = new SimpleDateFormat( "h:mm:ss a" ) ;
thetime = tf.format(calendar.getTime());
return thetime;
}
public static void addToBox(String thetime){
// make text bigger for visually impaired friend
Border raisedetched ;
String alarmTime;
Font big = new Font("Serif", Font.BOLD, 40);
raisedetched = BorderFactory.createMatteBorder(5, 35, 10, 50,
Color.blue);
JLabel msg = new JLabel("Time to go.");
JButton thedisplay = new JButton(thetime);
thedisplay.setFont(big);
thedisplay.setSize(300, 200);
thedisplay.setBackground(Color.blue);
thedisplay.setBorder(raisedetched);
// prepare alarm
Calendar calendar = Calendar.getInstance();
Date initDate = calendar.getTime();
//calendar.add(Calendar.YEAR, -100);
Date earliestDate = calendar.getTime();
//calendar.add(Calendar.YEAR, 200);
Date latestDate = calendar.getTime();
SpinnerDateModel model = new SpinnerDateModel(initDate,
null,
null,
Calendar.SECOND);
JSpinner alarm = new JSpinner(model);
JSpinner setit = new JSpinner(model);
setit.setSize(1,1);
setit.setFont(big);
alarm.setFont(big);
alarm.setBorder(raisedetched);
alarm.setFocusable(true);
alarm.setEnabled(true);
alarm.setEditor(new JSpinner.DateEditor(setit, "h:mm:ss a"));
alarm.setBackground(Color.blue);
setit.setVisible(true);
JFrame display = new JFrame("Set the Alarm.");
display.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);;
display.setLayout(new FlowLayout());
display.add(thedisplay);
display.pack();
display.add(setit);
display.pack();
display.setSize(300, 200);
display.setVisible(true);
}
// spinner action
public void stateChanged(ChangeEvent evt){
try {
JSpinner alarm = (JSpinner) (evt.getSource());
alarm.setEnabled(true);
alarm.setFocusable(true);
alarm.addChangeListener(this);
alarm.setValue(alarm.getNextValue());
alarm.commitEdit();
}
catch (ParseException pe) {
}
//alarm.setVisible(true);
}
public static void setAlarm(){
}
public static void main(String[] args){
JSpinner alarm = new JSpinner();
boolean set;
set = true;
String st = " Starting ...";
String theTime = " ";
String theAlarm = " ";
Thread t = new Thread();
Calendar calendar = Calendar.getInstance();
//setAlarm();
t.start();
try{
for (;;) { // forever
addToBox(doTime(st));
t.sleep(1000);
} // forever
}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.