找回密码
 马上注册

QQ登录

只需一步,快速开始

查看: 7297|回复: 5

分享一下解魔方机器人蓝牙控制软件:MindCuber Console Pro

[复制链接]
发表于 2013-6-12 16:32:41 | 显示全部楼层 |阅读模式
本帖最后由 MKAIR 于 2013-7-6 23:03 编辑

整个程序由Java编出,nxtCUBE全面升级至MindCuber Console Pro!
另外,source code available!!
注:Cube那一栏写魔方颜色,顺序有点复杂,URFDLB,参照twophase.jar (Javadoc)。按Connection Debug里的“Solve that Cube!”按钮解魔方,走过一段字符串长度识别和格式转换后,解魔方。具体方法参见twophase.jar。过程要手动在Actions栏里按按钮,以后的版本里会逐渐改为自动
  1. import java.awt.BorderLayout;
  2. import java.awt.GridLayout;
  3. import java.awt.event.ActionEvent;
  4. import java.awt.event.ActionListener;
  5. import java.io.DataInputStream;
  6. import java.io.DataOutputStream;
  7. import java.io.IOException;

  8. import javax.swing.JButton;
  9. import javax.swing.JLabel;
  10. import javax.swing.JPanel;
  11. import javax.swing.JSeparator;
  12. import javax.swing.JTabbedPane;
  13. import javax.swing.JTextArea;
  14. import javax.swing.SwingUtilities;
  15. import javax.swing.WindowConstants;

  16. import lejos.pc.comm.NXTConnector;

  17. import org.kociemba.twophase.Search;



  18. /**
  19. * This code was edited or generated using CloudGarden's Jigloo
  20. * SWT/Swing GUI Builder, which is free for non-commercial
  21. * use. If Jigloo is being used commercially (ie, by a corporation,
  22. * company or business for any purpose whatever) then you
  23. * should purchase a license for each developer using Jigloo.
  24. * Please visit www.cloudgarden.com for details.
  25. * Use of Jigloo implies acceptance of these licensing terms.
  26. * A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
  27. * THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
  28. * LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
  29. */
  30. public class NewJFrame extends javax.swing.JFrame implements ActionListener{

  31.     {
  32.         //Set Look & Feel
  33.         try {
  34.             javax.swing.UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
  35.         } catch(Exception e) {
  36.             e.printStackTrace();
  37.         }
  38.     }

  39.     /**
  40.      * Simple JavaDoc
  41.      * @author Michael Peng
  42.      * Set the Version of the main program
  43.      */
  44.     private static final long serialVersionUID = 6338002822670303714L;
  45.     // console string
  46.     private static final String con = null;
  47.     private JLabel copyright;
  48.     private JButton dT;
  49.     private JButton dU;
  50.     private JButton dD;
  51.     private JButton uT;
  52.     private JButton uU;
  53.     private JButton uD;
  54.     private JButton rT;
  55.     private JButton rU;
  56.     private JButton rD;
  57.     private JButton fT;
  58.     private JButton fU;
  59.     private JButton fD;
  60.     private JButton lT;
  61.     private JButton lU;
  62.     private JButton lD;
  63.     private JButton bT;
  64.     private JButton bU;
  65.     private JButton bD;
  66.     private JPanel dmov;
  67.     private JPanel umov;
  68.     private JPanel rmov;
  69.     private JPanel fmov;
  70.     private JPanel lmov;
  71.     private JPanel bmov;
  72.     private JTabbedPane actionspane;
  73.     private JPanel Actions;
  74.     private JSeparator jSeparator1;
  75.     private JLabel Note;
  76.     private JTextArea Cube;
  77.     private JPanel CubePanel;
  78.     private JButton solve;
  79.     private JPanel jPanel1;
  80.     private JLabel debug;
  81.     private JButton test;
  82.     private JButton disconnect;
  83.     private JPanel ConnectionDebug;
  84.     private JPanel mainPanel;
  85.     private JButton connect;
  86.     private JTabbedPane ActionPane;
  87.     private JTextArea Console;
  88.     private static NXTConnector conn = new NXTConnector();
  89.     private DataOutputStream dos;
  90.     private DataInputStream dis;
  91.     /**
  92.     * Auto-generated main method to display this JFrame
  93.     */
  94.     public static void main(String[] args) {
  95.         SwingUtilities.invokeLater(new Runnable() {
  96.             public void run() {
  97.                 NewJFrame inst = new NewJFrame();
  98.                 inst.setLocationRelativeTo(null);
  99.                 inst.setVisible(true);
  100.             }
  101.         });
  102.     }
  103.    
  104.     public NewJFrame() {
  105.         super();
  106.         initGUI();
  107.     }
  108.    
  109.     private void initGUI() {
  110.         try {
  111.             setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
  112.             this.setTitle("MindCuber Console Pro v1.01");
  113.             {
  114.                 mainPanel = new JPanel();
  115.                 getContentPane().add(mainPanel, BorderLayout.CENTER);
  116.                 mainPanel.setPreferredSize(new java.awt.Dimension(416, 330));
  117.                 {
  118.                     connect = new JButton();
  119.                     mainPanel.add(connect);
  120.                     connect.setText("Connect!");
  121.                     connect.setPreferredSize(new java.awt.Dimension(224, 37));
  122.                     connect.addActionListener(this);
  123.                 }
  124.                 {
  125.                     ActionPane = new JTabbedPane();
  126.                     mainPanel.add(ActionPane);
  127.                     mainPanel.add(getCopyright());
  128.                     ActionPane.setPreferredSize(new java.awt.Dimension(329, 255));
  129.                     {
  130.                         Console = new JTextArea(con);
  131.                         ActionPane.addTab("Console", null, Console, null);
  132.                         Console.setPreferredSize(new java.awt.Dimension(429, 226));
  133.                         ActionPane.addTab("Connection Debug", null, getConnectionDebug(), null);
  134.                         ActionPane.addTab("Cube", null, getJPanel1(), null);
  135.                         ActionPane.addTab("Actions", null, getActions(), null);
  136.                     }
  137.                 }
  138.             }
  139.             pack();
  140.             this.setSize(432, 368);
  141.         } catch (Exception e) {
  142.             //add your error handling code here
  143.             e.printStackTrace();
  144.         }
  145.     }
  146.     private JPanel getConnectionDebug() {
  147.         if(ConnectionDebug == null) {
  148.             ConnectionDebug = new JPanel();
  149.             ConnectionDebug.add(getDisconnect());
  150.             ConnectionDebug.add(getTest());
  151.             ConnectionDebug.add(getDebug());
  152.             ConnectionDebug.add(getSolve());
  153.             ConnectionDebug.add(getJSeparator1());
  154.         }
  155.         return ConnectionDebug;
  156.     }
  157.    
  158.     private JButton getDisconnect() {
  159.         if(disconnect == null) {
  160.             disconnect = new JButton();
  161.             disconnect.setText("Disconnect!");
  162.             disconnect.setPreferredSize(new java.awt.Dimension(132, 71));
  163.             disconnect.addActionListener(this);
  164.         }
  165.         return disconnect;
  166.     }
  167.    
  168.     private JButton getTest() {
  169.         if(test == null) {
  170.             test = new JButton();
  171.             test.setPreferredSize(new java.awt.Dimension(129, 71));
  172.             test.setText("Test Connection!");
  173.             test.addActionListener(this);
  174.         }
  175.         return test;
  176.     }
  177.    
  178.     private JLabel getDebug() {
  179.         if(debug == null) {
  180.             debug = new JLabel();
  181.             debug.setText("waiting...");
  182.             debug.setPreferredSize(new java.awt.Dimension(234, 15));
  183.         }
  184.         return debug;
  185.     }

  186.     public void actionPerformed(ActionEvent e){
  187.         Console.setLineWrap(true);
  188.         if (e.getSource() == connect)
  189.         {
  190.             try {
  191.                    conn.connectTo();
  192.                    dos = new DataOutputStream(conn.getOutputStream());
  193.                    dis = new DataInputStream(conn.getInputStream());
  194.             } catch (Exception e1) {
  195.                 e1.printStackTrace();
  196.             }
  197.             Console.setText("connected");
  198.         }
  199.         else if (e.getSource() == disconnect)
  200.         {
  201.             try {
  202.                 conn.close();
  203.             } catch (IOException e1) {
  204.                 e1.printStackTrace();
  205.             }
  206.             Console.setText("Disconnected");
  207.         }
  208.         else if (e.getSource() == solve)
  209.         {
  210.             CubeStr(Cube.getText());
  211.         }
  212.         else if (e.getSource() == test)
  213.         {
  214.             try {
  215.                 sendInt(100);
  216.                 receInt();
  217.             } catch (IOException e1) {
  218.                 Console.setText("Error while Sending/Receiving Int");
  219.                 System.err.println("Problems occured while testing connection. Please try again.");
  220.                 System.exit(0);
  221.             }
  222.         }
  223.     }
  224.    
  225.     private JPanel getJPanel1() {
  226.         if(jPanel1 == null) {
  227.             jPanel1 = new JPanel();
  228.             GridLayout jPanel1Layout = new GridLayout(1, 1);
  229.             jPanel1Layout.setHgap(5);
  230.             jPanel1Layout.setVgap(5);
  231.             jPanel1Layout.setColumns(1);
  232.             jPanel1.setLayout(jPanel1Layout);
  233.             jPanel1.add(getCubePanel());
  234.         }
  235.         return jPanel1;
  236.     }

  237.     private JButton getSolve() {
  238.         if(solve == null) {
  239.             solve = new JButton();
  240.             solve.setText("Solve that Cube!");
  241.             solve.setPreferredSize(new java.awt.Dimension(183, 56));
  242.             solve.addActionListener(this);
  243.         }
  244.         return solve;
  245.         
  246.     }
  247.    

  248.     private JPanel getCubePanel() {
  249.         if(CubePanel == null) {
  250.             CubePanel = new JPanel();
  251.             CubePanel.add(getCube());
  252.             CubePanel.add(getNote());
  253.         }
  254.         return CubePanel;
  255.     }
  256.    
  257.     private JTextArea getCube() {
  258.         if(Cube == null) {
  259.             Cube = new JTextArea();
  260.             Cube.setPreferredSize(new java.awt.Dimension(305, 180));
  261.         }
  262.         return Cube;
  263.     }
  264.    
  265.     private JLabel getNote() {
  266.         if(Note == null) {
  267.             Note = new JLabel();
  268.             Note.setText("Remember, the cube must be white face and blue up!");
  269.         }
  270.         return Note;
  271.     }


  272.    
  273.     private JSeparator getJSeparator1() {
  274.         if(jSeparator1 == null) {
  275.             jSeparator1 = new JSeparator();
  276.             jSeparator1.setPreferredSize(new java.awt.Dimension(212, 2));
  277.         }
  278.         return jSeparator1;
  279.     }
  280.    
  281.     // I/O Methods
  282.    
  283.     private void sendInt(int i) throws IOException
  284.     {
  285.         dos.writeInt(i);
  286.         dos.flush();
  287.         Console.setText("Send:" + i);
  288.         //Optional
  289.         System.out.println("Send:"+i);
  290.     }
  291.    
  292.     private void receInt() throws IOException
  293.     {
  294.         int i = dis.readInt();
  295.         Console.setText("Receive:"+i);
  296.         //Optional
  297.         System.out.println("Receive:"+i);
  298.     }

  299.     //Cube Type Converter
  300.    
  301.     private void CubeStr(String input)
  302.     {
  303.         String[] cc = new String[54];
  304.         String[] cd = new String[54];
  305.         String Result = new String();
  306.         for(int i=0;i<54;i++)
  307.         {
  308.             cc[i] = input.substring(i,i+1);
  309.             System.out.print(cc[i] + ";");
  310.         }
  311.         /*
  312.          * W F
  313.          * Y B
  314.          * G D
  315.          * R R
  316.          * O L
  317.          * B U
  318.          */
  319.         for(int i=0;i<54;i++)
  320.         {
  321.             if (cc[i].equals("W"))
  322.             {
  323.                 cd[i] = "F";
  324.             }
  325.             else if (cc[i].equals("Y"))
  326.             {
  327.                 cd[i] = "B";
  328.             }
  329.             else if (cc[i].equals("G"))
  330.             {
  331.                 cd[i] = "D";
  332.             }
  333.             else if (cc[i].equals("R"))
  334.             {
  335.                 cd[i] = "R";
  336.             }
  337.             else if (cc[i].equals("O"))
  338.             {
  339.                 cd[i] = "L";
  340.             }
  341.             else if (cc[i].equals("B"))
  342.             {
  343.                 cd[i] = "U";
  344.             }
  345.             else
  346.             {
  347.                 System.out.println("Unknown character(s) found:"+cc[i]);
  348.             }
  349.         }
  350.         for(int i=0;i<54;i++)
  351.         {
  352.             Result += cd[i];
  353.         }
  354.         String sol = Search.solution(Result,20,20,false);
  355.         System.out.println(Result);
  356.         System.out.println(sol);
  357.     }
  358.     // Cube Actions
  359.    
  360.     private JPanel getActions() {
  361.         if(Actions == null) {
  362.             Actions = new JPanel();
  363.             Actions.add(getActionspane());
  364.         }
  365.         return Actions;
  366.     }
  367.    
  368.     private JTabbedPane getActionspane() {
  369.         if(actionspane == null) {
  370.             actionspane = new JTabbedPane();
  371.             actionspane.setPreferredSize(new java.awt.Dimension(239, 206));
  372.             actionspane.addTab("B", null, getBmov(), null);
  373.             actionspane.addTab("L", null, getLmov(), null);
  374.             actionspane.addTab("F", null, getFmov(), null);
  375.             actionspane.addTab("R", null, getRmov(), null);
  376.             actionspane.addTab("U", null, getUmov(), null);
  377.             actionspane.addTab("D", null, getDmov(), null);
  378.         }
  379.         return actionspane;
  380.     }
  381.    
  382.     private JPanel getBmov() {
  383.         if(bmov == null) {
  384.             bmov = new JPanel();
  385.             bmov.setPreferredSize(new java.awt.Dimension(239, 110));
  386.             bmov.add(getBD());
  387.             bmov.add(getBU());
  388.             bmov.add(getBT());
  389.         }
  390.         return bmov;
  391.     }
  392.    
  393.     private JPanel getLmov() {
  394.         if(lmov == null) {
  395.             lmov = new JPanel();
  396.             lmov.add(getLD());
  397.             lmov.add(getLU());
  398.             lmov.add(getLT());
  399.         }
  400.         return lmov;
  401.     }
  402.    
  403.     private JPanel getFmov() {
  404.         if(fmov == null) {
  405.             fmov = new JPanel();
  406.             fmov.add(getFD());
  407.             fmov.add(getFU());
  408.             fmov.add(getFT());
  409.         }
  410.         return fmov;
  411.     }
  412.    
  413.     private JPanel getRmov() {
  414.         if(rmov == null) {
  415.             rmov = new JPanel();
  416.             rmov.add(getRD());
  417.             rmov.add(getRU());
  418.             rmov.add(getRT());
  419.         }
  420.         return rmov;
  421.     }
  422.    
  423.     private JPanel getUmov() {
  424.         if(umov == null) {
  425.             umov = new JPanel();
  426.             umov.add(getUD());
  427.             umov.add(getUU());
  428.             umov.add(getUT());
  429.         }
  430.         return umov;
  431.     }
  432.    
  433.     private JPanel getDmov() {
  434.         if(dmov == null) {
  435.             dmov = new JPanel();
  436.             dmov.add(getDD());
  437.             dmov.add(getDU());
  438.             dmov.add(getDT());
  439.         }
  440.         return dmov;
  441.     }
  442.    
  443.     private JButton getBD() {
  444.         if(bD == null) {
  445.             bD = new JButton();
  446.             bD.setText("B");
  447.             bD.setPreferredSize(new java.awt.Dimension(40, 30));
  448.         }
  449.         bD.addActionListener(new ActionListener() {
  450.             public void actionPerformed(ActionEvent e)
  451.             {
  452.                 try {
  453.                     sendInt(1);
  454.                     receInt();
  455.                 } catch (IOException e1) {
  456.                     e1.printStackTrace();
  457.                 }
  458.             }
  459.         });
  460.         return bD;
  461.     }
  462.    
  463.     private JButton getBU() {
  464.         if(bU == null) {
  465.             bU = new JButton();
  466.             bU.setText("B'");
  467.         }
  468.         bU.addActionListener(new ActionListener() {
  469.             public void actionPerformed(ActionEvent e)
  470.             {
  471.                 try {
  472.                     sendInt(2);
  473.                     receInt();
  474.                 } catch (IOException e1) {
  475.                     e1.printStackTrace();
  476.                 }
  477.             }
  478.         });
  479.         return bU;
  480.     }
  481.    
  482.     private JButton getBT() {
  483.         if(bT == null) {
  484.             bT = new JButton();
  485.             bT.setText("B2");
  486.         }
  487.         bT.addActionListener(new ActionListener() {
  488.             public void actionPerformed(ActionEvent e)
  489.             {
  490.                 try {
  491.                     sendInt(1);
  492.                     receInt();
  493.                     sendInt(1);
  494.                     receInt();
  495.                 } catch (IOException e1) {
  496.                     e1.printStackTrace();
  497.                 }
  498.             }
  499.         });
  500.         return bT;
  501.     }
  502.    
  503.     private JButton getLD() {
  504.         if(lD == null) {
  505.             lD = new JButton();
  506.             lD.setText("L");
  507.         }
  508.         lD.addActionListener(new ActionListener() {
  509.             public void actionPerformed(ActionEvent e)
  510.             {// Change THIS!!
  511.                 try {
  512.                     sendInt(1);
  513.                 } catch (IOException e1) {
  514.                     e1.printStackTrace();
  515.                 }
  516.             }
  517.         });
  518.         return lD;
  519.     }
  520.    
  521.     private JButton getLU() {
  522.         if(lU == null) {
  523.             lU = new JButton();
  524.             lU.setText("L'");
  525.         }
  526.         lU.addActionListener(new ActionListener() {
  527.             public void actionPerformed(ActionEvent e)
  528.             {// Change THIS!!!
  529.                 try {
  530.                     sendInt(1);
  531.                 } catch (IOException e1) {
  532.                     e1.printStackTrace();
  533.                 }
  534.             }
  535.         });
  536.         return lU;
  537.     }
  538.    
  539.     private JButton getLT() {
  540.         if(lT == null) {
  541.             lT = new JButton();
  542.             lT.setText("L2");
  543.         }
  544.         lT.addActionListener(new ActionListener() {
  545.             public void actionPerformed(ActionEvent e)
  546.             { //Change tHIS!!!
  547.                 try {
  548.                     sendInt(1);
  549.                 } catch (IOException e1) {
  550.                     e1.printStackTrace();
  551.                 }
  552.             }
  553.         });
  554.         return lT;
  555.     }
  556.    
  557.     private JButton getFD() {
  558.         if(fD == null) {
  559.             fD = new JButton();
  560.             fD.setText("F");
  561.         }
  562.         fD.addActionListener(new ActionListener() {
  563.             public void actionPerformed(ActionEvent e)
  564.             {
  565.                 try {
  566.                     sendInt(3);
  567.                     receInt();
  568.                 } catch (IOException e1) {
  569.                     e1.printStackTrace();
  570.                 }
  571.             }
  572.         });
  573.         return fD;
  574.     }
  575.    
  576.     private JButton getFU() {
  577.         if(fU == null) {
  578.             fU = new JButton();
  579.             fU.setText("F'");
  580.         }
  581.         fU.addActionListener(new ActionListener() {
  582.             public void actionPerformed(ActionEvent e)
  583.             {
  584.                 try {
  585.                     sendInt(4);
  586.                     receInt();
  587.                 } catch (IOException e1) {
  588.                     e1.printStackTrace();
  589.                 }
  590.             }
  591.         });
  592.         return fU;
  593.     }
  594.    
  595.     private JButton getFT() {
  596.         if(fT == null) {
  597.             fT = new JButton();
  598.             fT.setText("F2");
  599.         }
  600.         fT.addActionListener(new ActionListener() {
  601.             public void actionPerformed(ActionEvent e)
  602.             {
  603.                 try {
  604.                     sendInt(3);
  605.                     receInt();
  606.                     sendInt(3);
  607.                     receInt();
  608.                 } catch (IOException e1) {
  609.                     e1.printStackTrace();
  610.                 }
  611.             }
  612.         });
  613.         return fT;
  614.     }
  615.    
  616.     private JButton getRD() {
  617.         if(rD == null) {
  618.             rD = new JButton();
  619.             rD.setText("R");
  620.         }
  621.         rD.addActionListener(new ActionListener() {
  622.             public void actionPerformed(ActionEvent e)
  623.             { //Change THIS!!
  624.                 try {
  625.                     sendInt(1);
  626.                 } catch (IOException e1) {
  627.                     e1.printStackTrace();
  628.                 }
  629.             }
  630.         });
  631.         return rD;
  632.     }
  633.    
  634.     private JButton getRU() {
  635.         if(rU == null) {
  636.             rU = new JButton();
  637.             rU.setText("R'");
  638.         }
  639.         rU.addActionListener(new ActionListener() {
  640.             public void actionPerformed(ActionEvent e)
  641.             { //Change THIS!!
  642.                 try {
  643.                     sendInt(1);
  644.                 } catch (IOException e1) {
  645.                     e1.printStackTrace();
  646.                 }
  647.             }
  648.         });
  649.         return rU;
  650.     }
  651.    
  652.     private JButton getRT() {
  653.         if(rT == null) {
  654.             rT = new JButton();
  655.             rT.setText("R2");
  656.         }
  657.         rT.addActionListener(new ActionListener() {
  658.             public void actionPerformed(ActionEvent e)
  659.             { //Change THIS!!
  660.                 try {
  661.                     sendInt(1);
  662.                 } catch (IOException e1) {
  663.                     e1.printStackTrace();
  664.                 }
  665.             }
  666.         });
  667.         return rT;
  668.     }
  669.    
  670.     private JButton getUD() {
  671.         if(uD == null) {
  672.             uD = new JButton();
  673.             uD.setText("U");
  674.         }
  675.         uD.addActionListener(new ActionListener() {
  676.             public void actionPerformed(ActionEvent e)
  677.             {
  678.                 try {
  679.                     sendInt(5);
  680.                     receInt();
  681.                 } catch (IOException e1) {
  682.                     e1.printStackTrace();
  683.                 }
  684.             }
  685.         });
  686.         return uD;
  687.     }
  688.    
  689.     private JButton getUU() {
  690.         if(uU == null) {
  691.             uU = new JButton();
  692.             uU.setText("U'");
  693.         }
  694.         uU.addActionListener(new ActionListener() {
  695.             public void actionPerformed(ActionEvent e)
  696.             {
  697.                 try {
  698.                     sendInt(6);
  699.                     receInt();
  700.                 } catch (IOException e1) {
  701.                     e1.printStackTrace();
  702.                 }
  703.             }
  704.         });
  705.         return uU;
  706.     }
  707.    
  708.     private JButton getUT() {
  709.         if(uT == null) {
  710.             uT = new JButton();
  711.             uT.setText("U2");
  712.         }
  713.         uT.addActionListener(new ActionListener() {
  714.             public void actionPerformed(ActionEvent e)
  715.             {
  716.                 try {
  717.                     sendInt(5);
  718.                     receInt();
  719.                     sendInt(5);
  720.                     receInt();
  721.                 } catch (IOException e1) {
  722.                     e1.printStackTrace();
  723.                 }
  724.             }
  725.         });
  726.         return uT;
  727.     }
  728.    
  729.     private JButton getDD() {
  730.         if(dD == null) {
  731.             dD = new JButton();
  732.             dD.setText("D");
  733.         }
  734.         dD.addActionListener(new ActionListener() {
  735.             public void actionPerformed(ActionEvent e)
  736.             {
  737.                 try {
  738.                     sendInt(7);
  739.                     receInt();
  740.                 } catch (IOException e1) {
  741.                     e1.printStackTrace();
  742.                 }
  743.             }
  744.         });
  745.         return dD;
  746.     }
  747.    
  748.     private JButton getDU() {
  749.         if(dU == null) {
  750.             dU = new JButton();
  751.             dU.setText("D'");
  752.         }
  753.         dU.addActionListener(new ActionListener() {
  754.             public void actionPerformed(ActionEvent e)
  755.             {
  756.                 try {
  757.                     sendInt(8);
  758.                     receInt();
  759.                 } catch (IOException e1) {
  760.                     e1.printStackTrace();
  761.                 }
  762.             }
  763.         });
  764.         return dU;
  765.     }
  766.    
  767.     private JButton getDT() {
  768.         if(dT == null) {
  769.             dT = new JButton();
  770.             dT.setText("D2");
  771.         }
  772.         dT.addActionListener(new ActionListener() {
  773.             public void actionPerformed(ActionEvent e)
  774.             {
  775.                 try {
  776.                     sendInt(7);
  777.                     receInt();
  778.                     sendInt(7);
  779.                     receInt();
  780.                 } catch (IOException e1) {
  781.                     e1.printStackTrace();
  782.                 }
  783.             }
  784.         });
  785.         return dT;
  786.     }
  787.    
  788.     private JLabel getCopyright() {
  789.         if(copyright == null) {
  790.             copyright = new JLabel();
  791.             copyright.setText("Powered by Michael Peng");
  792.         }
  793.         return copyright;
  794.     }

  795. }



复制代码
actions.jpg
ced.jpg
unc.jpg

BT Server.rar

501.63 KB, 下载次数: 200

如果您觉得我的帖子对您有用,请不吝给我一个“赞”!
发表于 2013-6-12 21:24:13 | 显示全部楼层
有Exe的吗?
如果您觉得我的帖子对您有用,请不吝给我一个“赞”!
回复

使用道具 举报

发表于 2013-6-12 22:17:32 | 显示全部楼层
资料 不够详尽哦
如果您觉得我的帖子对您有用,请不吝给我一个“赞”!
回复

使用道具 举报

发表于 2013-6-13 00:34:19 | 显示全部楼层
建议楼主增加一个文本框,可以进行比如“RUR'U'”之类的连贯动作
如果您觉得我的帖子对您有用,请不吝给我一个“赞”!
回复

使用道具 举报

发表于 2014-9-28 19:16:11 | 显示全部楼层
我数数(努力数数中……)共有814个步骤!!!
如果您觉得我的帖子对您有用,请不吝给我一个“赞”!
回复

使用道具 举报

发表于 2014-9-28 19:19:12 | 显示全部楼层
ntwuhui 发表于 2013-6-13 00:34
建议楼主增加一个文本框,可以进行比如“RUR'U'”之类的连贯动作

“Rur'u"是什么???
如果您觉得我的帖子对您有用,请不吝给我一个“赞”!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 马上注册

本版积分规则

QQ|手机版|中文乐高 ( 桂ICP备13001575号-7 )

GMT+8, 2024-4-26 18:56 , Processed in 0.087187 second(s), 26 queries .

Powered by Discuz! X3.5

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表