Latest Oop Code
Latest Oop Code
Latest Oop Code
import java.awt.Color;
import java.awt.Font;
import java.awt.event.*;
import javax.swing.*;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
import java.util.Calendar;
import java.text.SimpleDateFormat;
FrameOne(){
FrameSwing();
AlarmSetSwing();
HrUpSwing();
MnUpSwing();
SUpSwing();
HrDownSwing();
MnDownSwing();
SDownSwing();
ButtonSwing();
LabelSwing();
}
public void HrDownSwing() {
HrDownbut.setSize(275,40);
HrDownbut.setText("-");
HrDownbut.setLocation(100,500);
HrDownbut.setBackground(Color.WHITE);
HrDownbut.setForeground(Color.BLACK);
HrDownbut.setFont(new Font("Arial", 1, 50));
HrDownbut.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Hr--;
if (Hr < 0) {
Hr = 24;
}
AlarmSetHR.setText(TimeForm());
}
});
}
label.setSize(300,250);
label.setLocation(380,10);
label.setBackground(Color.WHITE);
label.setForeground(Color.BLUE);
label.setFont(newFont);
label.setVerticalAlignment(JLabel.TOP);
label.setVerticalTextPosition(JLabel.TOP);
label.setHorizontalAlignment(0);
updateTime();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
@Override
public void windowOpened(WindowEvent e) {
System.out.println("Opened");
}
}
public class ButtonEvent implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
int a = JOptionPane.showConfirmDialog(null, "Are you
sure","Alarm", JOptionPane.YES_NO_OPTION);
if (a == JOptionPane.YES_OPTION) {
JOptionPane.showMessageDialog(null, "Confirmed");
} else {
JOptionPane.showMessageDialog(null, "Cancelled");
}
}
}