반응형
SMALL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | package univ.embedded.timer; import java.awt.Color; import java.awt.event.*; import javax.swing.*; public class TimerUI extends JFrame implements ActionListener { JLabel timeLabel = null; JButton startButton = null; @Override public void actionPerformed(ActionEvent e) { //TimerLogic lc = new TimerLogic(timeLabel); //lc.start(); startButton.setText("NO TOUCH"); startButton.setEnabled(false); (new TimerLogic(timeLabel, this)).start(); } public void activateButton() { startButton.setText("Start"); startButton.setEnabled(true); } public TimerUI() { setSize(300, 200); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setTitle("10 Sec. Timer"); timeLabel = new JLabel("10"); startButton = new JButton("Start"); startButton.addActionListener(this); setLayout(null); timeLabel.setSize(100, 60); startButton.setSize(100, 60); timeLabel.setLocation(50, 20); startButton.setLocation(50, 100); add(timeLabel); add(startButton); setVisible(true); } } |
반응형
LIST
'Java프로그래밍 > 예제문제' 카테고리의 다른 글
당구프로그램 예제 (0) | 2016.04.15 |
---|---|
Timer : TmerLogic and Test program (0) | 2016.04.08 |
계산기 만들기 숙제 (0) | 2016.03.25 |
예제문제: Package, import, Object, Wrapper class, String, StringBuffer, Interface, Abstract class (0) | 2015.03.31 |
예제문제: 상속 (0) | 2015.03.24 |