Bus Stop Reminder,busstopreminder,package buse
分享于 点击 778 次 点评:195
Bus Stop Reminder,busstopreminder,package buse
package buser;import java.awt.*;import java.awt.event.*;import java.io.IOException;import javax.swing.*;import javax.accessibility.*;public class Buser extends JFrame implements ActionListener, Accessible { /** * */ private static final long serialVersionUID = 1L; JPanel p1 = new JPanel(); JButton b1 = new JButton("South Road"), b2 = new JButton("West Street"); Box box = Box.createVerticalBox(); public Buser() { super(); p1.add(box); box.add(b1); box.add(new JSeparator()); box.add(b2); add(p1, BorderLayout.CENTER); b1.addActionListener(this); b2.addActionListener(this); validate(); setTitle("Bus Stop Reminder v1.0"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setSize(200, 100); this.setVisible(true); } public void actionPerformed(ActionEvent e) { if (e.getSource() == b1) { System.out.println("This stop: South Road!"); try { Runtime.getRuntime().exec( "cmd.exe /c start C:\\\\Users\\\\Sam\\\\Desktop\\\\SGR.wav"); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } if (e.getSource() == b2) { System.out.println("This stop: West Street!"); try { Runtime.getRuntime().exec( "cmd.exe /c start C:\\\\Users\\\\Sam\\\\Desktop\\\\DT.wav"); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } } public static void main(String[] args) { Buser test = new Buser(); }}//该片段来自于http://byrx.net
用户点评