| 1 | package tmcsim.cadsimulator.videocontrol; |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | import java.awt.event.ActionEvent; |
|---|
| 5 | import java.awt.event.ActionListener; |
|---|
| 6 | import java.awt.event.WindowEvent; |
|---|
| 7 | import java.awt.event.WindowListener; |
|---|
| 8 | import java.io.FileOutputStream; |
|---|
| 9 | import java.io.IOException; |
|---|
| 10 | |
|---|
| 11 | import javax.rmi.CORBA.Tie; |
|---|
| 12 | import javax.swing.Box; |
|---|
| 13 | import javax.swing.BoxLayout; |
|---|
| 14 | import javax.swing.JButton; |
|---|
| 15 | import javax.swing.JFileChooser; |
|---|
| 16 | import javax.swing.JFrame; |
|---|
| 17 | import javax.swing.JTextField; |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | @SuppressWarnings("serial") |
|---|
| 21 | public class PioneerV5000TestController extends JFrame implements ActionListener{ |
|---|
| 22 | |
|---|
| 23 | PioneerV5000 cntrl = null; |
|---|
| 24 | |
|---|
| 25 | public static void main(String[] args) { |
|---|
| 26 | new PioneerV5000TestController(); |
|---|
| 27 | } |
|---|
| 28 | |
|---|
| 29 | public PioneerV5000TestController() { |
|---|
| 30 | super("SUPER AWESOME DVD CONTROLLER"); |
|---|
| 31 | |
|---|
| 32 | try { |
|---|
| 33 | cntrl = new PioneerV5000(); |
|---|
| 34 | cntrl.setConnectionInfo("192.168.251.9", 3002); |
|---|
| 35 | cntrl.connect(); |
|---|
| 36 | } |
|---|
| 37 | catch (IOException ioe) { |
|---|
| 38 | ioe.printStackTrace(); |
|---|
| 39 | } |
|---|
| 40 | |
|---|
| 41 | |
|---|
| 42 | initialize(); |
|---|
| 43 | |
|---|
| 44 | addWindowListener(new WindowListener() { |
|---|
| 45 | public void windowClosed(WindowEvent e) {} |
|---|
| 46 | public void windowOpened(WindowEvent e) {} |
|---|
| 47 | public void windowIconified(WindowEvent e) {} |
|---|
| 48 | public void windowDeiconified(WindowEvent e) {} |
|---|
| 49 | public void windowActivated(WindowEvent e) {} |
|---|
| 50 | public void windowDeactivated(WindowEvent e) {} |
|---|
| 51 | public void windowClosing(WindowEvent e) { |
|---|
| 52 | cntrl.disconnect(); |
|---|
| 53 | System.exit(0); |
|---|
| 54 | } |
|---|
| 55 | |
|---|
| 56 | }); |
|---|
| 57 | } |
|---|
| 58 | |
|---|
| 59 | public void actionPerformed(ActionEvent evt) { |
|---|
| 60 | |
|---|
| 61 | try { |
|---|
| 62 | if(evt.getSource().equals(addDVDButton)) { |
|---|
| 63 | |
|---|
| 64 | } |
|---|
| 65 | else if(evt.getSource().equals(delDVDButton)) { |
|---|
| 66 | |
|---|
| 67 | } |
|---|
| 68 | else if(evt.getSource().equals(openButton)) { |
|---|
| 69 | cntrl.open(); |
|---|
| 70 | } |
|---|
| 71 | else if(evt.getSource().equals(closeButton)) { |
|---|
| 72 | cntrl.close(); |
|---|
| 73 | } |
|---|
| 74 | else if(evt.getSource().equals(rewButton)) { |
|---|
| 75 | cntrl.scanReverse(); |
|---|
| 76 | } |
|---|
| 77 | else if(evt.getSource().equals(ffButton)) { |
|---|
| 78 | cntrl.scanForward(); |
|---|
| 79 | } |
|---|
| 80 | else if(evt.getSource().equals(playButton)) { |
|---|
| 81 | cntrl.play(); |
|---|
| 82 | } |
|---|
| 83 | else if(evt.getSource().equals(pauseButton)) { |
|---|
| 84 | cntrl.pause(); |
|---|
| 85 | } |
|---|
| 86 | else if(evt.getSource().equals(stopButton)) { |
|---|
| 87 | |
|---|
| 88 | } |
|---|
| 89 | else if(evt.getSource().equals(cmdStackButton)) { |
|---|
| 90 | cntrl.repeatTitle(Integer.parseInt(titleTF.getText())); |
|---|
| 91 | } |
|---|
| 92 | else if(evt.getSource().equals(uploadButton)) { |
|---|
| 93 | /* |
|---|
| 94 | //file chooser |
|---|
| 95 | JFileChooser fc = new JFileChooser(); |
|---|
| 96 | |
|---|
| 97 | if(fc.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { |
|---|
| 98 | |
|---|
| 99 | StringBuffer cmdStack = new StringBuffer(); |
|---|
| 100 | |
|---|
| 101 | try { |
|---|
| 102 | FileInputStream fis = new FileInputStream( |
|---|
| 103 | fc.getSelectedFile()); |
|---|
| 104 | |
|---|
| 105 | while(fis.available() > 0) { |
|---|
| 106 | cmdStack.append(fis.read()); |
|---|
| 107 | } |
|---|
| 108 | fis.close(); |
|---|
| 109 | } catch (Exception e) { |
|---|
| 110 | e.printStackTrace(); |
|---|
| 111 | } |
|---|
| 112 | |
|---|
| 113 | cntrl.upload(cmdStack.toString()); |
|---|
| 114 | } |
|---|
| 115 | */ |
|---|
| 116 | cntrl.upload("24680200000000100020003000400050006000700080009000A000B000C000D000E000F0010001100120013001400150016001700180019001A001B001C0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF001D0009FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000001D0A4A0A1A0A0A0A0A0A1A9A9A9A9A9A9A0A4A9AAA3000000000000000000000000FF000000000000000000000000000000A4A0A2A0A0A0A0A0A1A9A9A9A9A9A9A1A4A9AAA3000000000000000000000000FF000000000000000000000000000000A4A0A3A0A0A0A0A0A1A9A9A9A9A9A9A2A4A9AAA3000000000000000000000000FF000000000000000000000000000000A4A0A4A0A0A0A0A0A1A9A9A9A9A9A9A3A4A9AAA3000000000000000000000000FF000000000000000000000000000000A4A0A5A0A0A0A0A0A1A9A9A9A9A9A9A4A4A9AAA3000000000000000000000000FF000000000000000000000000000000A4A0A6A0A0A0A0A0A1A9A9A9A9A9A9A5A4A9AAA3000000000000000000000000FF000000000000000000000000000000A4A0A7A0A0A0A0A0A1A9A9A9A9A9A9A6A4A9AAA3000000000000000000000000FF000000000000000000000000000000A4A0A8A0A0A0A0A0A1A9A9A9A9A9A9A7A4A9AAA3000000000000000000000000FF000000000000000000000000000000A4A0A9A0A0A0A0A0A1A9A9A9A9A9A9A8A4A9AAA3000000000000000000000000FF000000000000000000000000000000A4A1A0A0A0A0A0A0A1A9A9A9A9A9A9A0A4A9AAA30000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000050917"); |
|---|
| 117 | |
|---|
| 118 | } |
|---|
| 119 | else if(evt.getSource().equals(downloadButton)) { |
|---|
| 120 | JFileChooser fc = new JFileChooser(); |
|---|
| 121 | |
|---|
| 122 | if(fc.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { |
|---|
| 123 | |
|---|
| 124 | String cmdStack = cntrl.download(); |
|---|
| 125 | |
|---|
| 126 | System.out.println(cmdStack); |
|---|
| 127 | |
|---|
| 128 | try { |
|---|
| 129 | FileOutputStream fos = new FileOutputStream( |
|---|
| 130 | fc.getSelectedFile()); |
|---|
| 131 | |
|---|
| 132 | fos.write(cmdStack.getBytes()); |
|---|
| 133 | fos.close(); |
|---|
| 134 | |
|---|
| 135 | } catch (Exception e) { |
|---|
| 136 | e.printStackTrace(); |
|---|
| 137 | } |
|---|
| 138 | } |
|---|
| 139 | |
|---|
| 140 | } |
|---|
| 141 | } |
|---|
| 142 | catch (Exception e) { |
|---|
| 143 | e.printStackTrace(); |
|---|
| 144 | } |
|---|
| 145 | } |
|---|
| 146 | |
|---|
| 147 | protected void initialize() { |
|---|
| 148 | |
|---|
| 149 | addDVDButton = new JButton("ADD DVD"); |
|---|
| 150 | addDVDButton.addActionListener(this); |
|---|
| 151 | |
|---|
| 152 | delDVDButton = new JButton("DEL DVD"); |
|---|
| 153 | delDVDButton.addActionListener(this); |
|---|
| 154 | |
|---|
| 155 | playerMgmtBox = new Box(BoxLayout.X_AXIS); |
|---|
| 156 | playerMgmtBox.add(Box.createHorizontalGlue()); |
|---|
| 157 | playerMgmtBox.add(addDVDButton); |
|---|
| 158 | playerMgmtBox.add(Box.createHorizontalGlue()); |
|---|
| 159 | playerMgmtBox.add(delDVDButton); |
|---|
| 160 | playerMgmtBox.add(Box.createHorizontalGlue()); |
|---|
| 161 | |
|---|
| 162 | |
|---|
| 163 | openButton = new JButton("OPEN"); |
|---|
| 164 | openButton.addActionListener(this); |
|---|
| 165 | |
|---|
| 166 | closeButton = new JButton("CLOSE"); |
|---|
| 167 | closeButton.addActionListener(this); |
|---|
| 168 | |
|---|
| 169 | doorCntrlBox = new Box(BoxLayout.X_AXIS); |
|---|
| 170 | doorCntrlBox.add(Box.createHorizontalGlue()); |
|---|
| 171 | doorCntrlBox.add(openButton); |
|---|
| 172 | doorCntrlBox.add(Box.createHorizontalGlue()); |
|---|
| 173 | doorCntrlBox.add(closeButton); |
|---|
| 174 | doorCntrlBox.add(Box.createHorizontalGlue()); |
|---|
| 175 | |
|---|
| 176 | rewButton = new JButton("REW"); |
|---|
| 177 | rewButton.addActionListener(this); |
|---|
| 178 | |
|---|
| 179 | playButton = new JButton("PLAY"); |
|---|
| 180 | playButton.addActionListener(this); |
|---|
| 181 | |
|---|
| 182 | ffButton = new JButton("FF"); |
|---|
| 183 | ffButton.addActionListener(this); |
|---|
| 184 | |
|---|
| 185 | buttonRowBox1 = new Box(BoxLayout.X_AXIS); |
|---|
| 186 | buttonRowBox1.add(Box.createHorizontalGlue()); |
|---|
| 187 | buttonRowBox1.add(rewButton); |
|---|
| 188 | buttonRowBox1.add(Box.createHorizontalGlue()); |
|---|
| 189 | buttonRowBox1.add(playButton); |
|---|
| 190 | buttonRowBox1.add(Box.createHorizontalGlue()); |
|---|
| 191 | buttonRowBox1.add(ffButton); |
|---|
| 192 | buttonRowBox1.add(Box.createHorizontalGlue()); |
|---|
| 193 | |
|---|
| 194 | |
|---|
| 195 | pauseButton = new JButton("PAUSE"); |
|---|
| 196 | pauseButton.addActionListener(this); |
|---|
| 197 | |
|---|
| 198 | stopButton = new JButton("STOP"); |
|---|
| 199 | stopButton.addActionListener(this); |
|---|
| 200 | |
|---|
| 201 | buttonRowBox2 = new Box(BoxLayout.X_AXIS); |
|---|
| 202 | buttonRowBox2.add(Box.createHorizontalGlue()); |
|---|
| 203 | buttonRowBox2.add(pauseButton); |
|---|
| 204 | buttonRowBox2.add(Box.createHorizontalGlue()); |
|---|
| 205 | buttonRowBox2.add(stopButton); |
|---|
| 206 | buttonRowBox2.add(Box.createHorizontalGlue()); |
|---|
| 207 | |
|---|
| 208 | |
|---|
| 209 | titleTF = new JTextField(); |
|---|
| 210 | |
|---|
| 211 | cmdStackButton = new JButton("REPEAT"); |
|---|
| 212 | cmdStackButton.addActionListener(this); |
|---|
| 213 | |
|---|
| 214 | buttonRowBox3 = new Box(BoxLayout.X_AXIS); |
|---|
| 215 | buttonRowBox3.add(Box.createHorizontalGlue()); |
|---|
| 216 | buttonRowBox3.add(titleTF); |
|---|
| 217 | buttonRowBox3.add(Box.createHorizontalGlue()); |
|---|
| 218 | buttonRowBox3.add(cmdStackButton); |
|---|
| 219 | buttonRowBox3.add(Box.createHorizontalGlue()); |
|---|
| 220 | |
|---|
| 221 | uploadButton = new JButton("UPLOAD"); |
|---|
| 222 | uploadButton.addActionListener(this); |
|---|
| 223 | |
|---|
| 224 | downloadButton = new JButton("DOWNLOAD"); |
|---|
| 225 | downloadButton.addActionListener(this); |
|---|
| 226 | |
|---|
| 227 | buttonRowBox4 = new Box(BoxLayout.X_AXIS); |
|---|
| 228 | buttonRowBox4.add(Box.createHorizontalGlue()); |
|---|
| 229 | buttonRowBox4.add(uploadButton); |
|---|
| 230 | buttonRowBox4.add(Box.createHorizontalGlue()); |
|---|
| 231 | buttonRowBox4.add(downloadButton); |
|---|
| 232 | buttonRowBox4.add(Box.createHorizontalGlue()); |
|---|
| 233 | |
|---|
| 234 | |
|---|
| 235 | controllerBox = new Box(BoxLayout.Y_AXIS); |
|---|
| 236 | controllerBox.add(Box.createVerticalStrut(15)); |
|---|
| 237 | controllerBox.add(playerMgmtBox); |
|---|
| 238 | controllerBox.add(Box.createVerticalStrut(15)); |
|---|
| 239 | controllerBox.add(doorCntrlBox); |
|---|
| 240 | controllerBox.add(Box.createVerticalStrut(15)); |
|---|
| 241 | controllerBox.add(buttonRowBox1); |
|---|
| 242 | controllerBox.add(Box.createVerticalStrut(15)); |
|---|
| 243 | controllerBox.add(buttonRowBox2); |
|---|
| 244 | controllerBox.add(Box.createVerticalStrut(15)); |
|---|
| 245 | controllerBox.add(buttonRowBox3); |
|---|
| 246 | controllerBox.add(Box.createVerticalStrut(15)); |
|---|
| 247 | controllerBox.add(buttonRowBox4); |
|---|
| 248 | controllerBox.add(Box.createVerticalStrut(15)); |
|---|
| 249 | |
|---|
| 250 | |
|---|
| 251 | add(controllerBox); |
|---|
| 252 | |
|---|
| 253 | pack(); |
|---|
| 254 | setVisible(true); |
|---|
| 255 | } |
|---|
| 256 | |
|---|
| 257 | protected JButton addDVDButton; |
|---|
| 258 | protected JButton delDVDButton; |
|---|
| 259 | protected JButton openButton; |
|---|
| 260 | protected JButton closeButton; |
|---|
| 261 | protected JButton rewButton; |
|---|
| 262 | protected JButton playButton; |
|---|
| 263 | protected JButton ffButton; |
|---|
| 264 | protected JButton pauseButton; |
|---|
| 265 | protected JButton stopButton; |
|---|
| 266 | protected JButton cmdStackButton; |
|---|
| 267 | protected JButton uploadButton; |
|---|
| 268 | protected JButton downloadButton; |
|---|
| 269 | |
|---|
| 270 | protected JTextField titleTF; |
|---|
| 271 | |
|---|
| 272 | protected Box controllerBox; |
|---|
| 273 | protected Box playerMgmtBox; |
|---|
| 274 | protected Box doorCntrlBox; |
|---|
| 275 | protected Box buttonRowBox1; |
|---|
| 276 | protected Box buttonRowBox2; |
|---|
| 277 | protected Box buttonRowBox3; |
|---|
| 278 | protected Box buttonRowBox4; |
|---|
| 279 | |
|---|
| 280 | } |
|---|