package com.ogane.xi.test; import java.awt.*; import java.awt.event.*; import com.ogane.xi.LED; import com.ogane.xi.PseudoSignal; public class LEDTest extends Frame { LED green, red, yellow; LED digit[] = new LED[8]; // ‹[Ž—M† PseudoSignal gauss = new PseudoSignal(PseudoSignal.GAUSSIAN, 2., 5., 0.); public LEDTest() { enableEvents(AWTEvent.WINDOW_EVENT_MASK); setTitle("LEDTest"); setLayout(new GridLayout(4, 0, 0, 0)); setBackground(new Color(220, 211, 200)); setResizable(false); //---------- —Ξ‚ΜLED ---------- add(green = new LED(LED.GREEN, "Green")); green.setThreshould(2.0); //----------- ‰©F‚ΜLED -------- add(yellow = new LED(LED.YELLOW, "Yellow")); yellow.setLabelPosition(LED.LEFT); yellow.setThreshould(4.0); //----------- Τ‚ΜLED ----------- add(red = new LED(LED.RED, "Red")); red.setThreshould(6.0); red.setState(LED.ON); //----------- LEDƒAƒŒƒC ----------- Panel bar = new Panel(); bar.setLayout(new GridLayout(0, 8, 0, 0)); for(int i = 0;i < 8;i++) { String num = new Integer(i).toString(); if(i < 4) bar.add(digit[i] = new LED(LED.GREEN, num)); else if(i<6) bar.add(digit[i] = new LED(LED.YELLOW, num)); else bar.add(digit[i] = new LED(LED.RED, num)); digit[i].setLabelPosition(LED.TOP); digit[i].setThreshould(i); gauss.connect(digit[i]); } add(bar); // ‹[Ž—M†”­Ά gauss.start(); setSize(250, 250); setVisible(true); } protected void processWindowEvent(WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { System.exit(0); } } public static void main(String[] args) { new LEDTest(); } }