⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 textmenututtle.java

📁 its a kind of tutorial.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
         newMenuState = TextMenuTuttleInterface.TURN_MENU; 
         break;

      case '5':               
         theTuttle.doCommand("tl 5");
         break;
            
      case '1':
         theTuttle.doCommand("tl 10"); 
         break;
            
      case '3':
         theTuttle.doCommand("tl 30");  
         break;   
         
      case '4':
         theTuttle.doCommand("tl 45");  
         break;                       
      } // End switch.            
      return newMenuState;
   } // end turnLeftMenu.   


   private int turnRightMenu( char pressed) { 
   
   int newMenuState = TextMenuTuttleInterface.TURN_RIGHT_MENU;

      switch( pressed) { 
      case KeyEvent.VK_ESCAPE:
         newMenuState = TextMenuTuttleInterface.TURN_MENU; 
         break;

      case '5':               
         theTuttle.doCommand("tr 5");
         break;
            
      case '1':
         theTuttle.doCommand("tr 10"); 
         break;
            
      case '3':
         theTuttle.doCommand("tr 30");  
         break;   
         
      case '4':
         theTuttle.doCommand("tr 45");  
         break;                       
      } // End switch.            
      return newMenuState;
   } // end turnRightMenu.   


   private int colorMenu( char pressed) { 
   
   int newMenuState = theInterface.COLOR_MENU;

      switch( pressed) { 
      case KeyEvent.VK_ESCAPE:
         newMenuState = theInterface.TOP_LEVEL_MENU; 
         break;

      case 'F':
      case 'f': 
         newMenuState = theInterface.FOREGROUND_COLOR_MENU; 
         break;      
      
      case 'B':
      case 'b': 
         newMenuState = theInterface.BACKGROUND_COLOR_MENU; 
         break;
      } // End switch.   
      return newMenuState;
   } // end colorMenu.


   private int foregroundMenu( char pressed) { 
   
   int newMenuState = theInterface.FOREGROUND_COLOR_MENU;

      switch( pressed) { 
      case KeyEvent.VK_ESCAPE:
         newMenuState = theInterface.COLOR_MENU;
         break;

      case 'B':
      case 'b': 
         theTuttle.doCommand( "fg black"); 
         break;      
      
      case 'W':
      case 'w': 
         theTuttle.doCommand( "fg white"); 
         break;
         
      case 'L':
      case 'l': 
         theTuttle.doCommand( "fg blue");  
         break; 
                 
      case 'R':
      case 'r': 
         theTuttle.doCommand( "fg red");  
         break;
                  
      case 'G':
      case 'g': 
         theTuttle.doCommand( "fg green");  
         break;                
         
      case 'Y':
      case 'y': 
         theTuttle.doCommand( "fg yellow");  
         break;                
      } // End switch.
                
      return newMenuState;
   } // end foregroundMenu.


   private int backgroundMenu( char pressed) { 
   
   int newMenuState = theInterface.BACKGROUND_COLOR_MENU;

      switch( pressed) { 
      case KeyEvent.VK_ESCAPE:
         newMenuState = theInterface.COLOR_MENU;
         break;

      case 'B':
      case 'b': 
         theTuttle.doCommand( "bg black"); 
         break;      
      
      case 'W':
      case 'w': 
         theTuttle.doCommand( "bg white"); 
         break;
         
      case 'L':
      case 'l': 
         theTuttle.doCommand( "bg blue");  
         break; 
                 
      case 'R':
      case 'r': 
         theTuttle.doCommand( "bg red");  
         break;
                  
      case 'G':
      case 'g': 
         theTuttle.doCommand( "bg green");  
         break;                
         
      case 'Y':
      case 'y': 
         theTuttle.doCommand( "bg yellow");  
         break;                
      } // End switch.
      
      return newMenuState;
   } // end foregroundMenu.


   private int penMenu( char pressed) { 
   
   int newMenuState = theInterface.PEN_MENU;
   
      switch( pressed) { 
      case KeyEvent.VK_ESCAPE:
         newMenuState = theInterface.TOP_LEVEL_MENU;
         break;

      case 'U':
      case 'u':
         theTuttle.doCommand( "pu");  
         newMenuState = theInterface.TOP_LEVEL_MENU;
         break;                 
      
      case 'D':
      case 'd':
         theTuttle.doCommand( "pd");  
         newMenuState = theInterface.TOP_LEVEL_MENU;
         break;                 
      } // End switch.  
       
      return newMenuState;
   } // End penMenu.


   private int screenMenu( char pressed) { 
   
   int newMenuState = theInterface.SCREEN_MENU;
   
      switch( pressed) { 
      case KeyEvent.VK_ESCAPE:
         newMenuState = theInterface.TOP_LEVEL_MENU;
         break;

      case 'C':
      case 'c':
         theTuttle.doCommand( "cl");  
         newMenuState = theInterface.TOP_LEVEL_MENU;
         break;                 
      
      case 'R':
      case 'r':
         theTuttle.doCommand( "rs");  
         newMenuState = theInterface.TOP_LEVEL_MENU;
         break; 
         
      case 'B':
      case 'b':
         theTuttle.doCommand( "cr");  
         newMenuState = theInterface.TOP_LEVEL_MENU;
         break;          
      } // End switch. 
      
      return newMenuState;
   } // End screenMenu.


           private int undoMenu( char pressed) { 
           
           int newMenuState = TextMenuTuttleInterface.UNDO_MENU;

              switch( pressed) { 
              case KeyEvent.VK_ESCAPE:
              case 'N':
              case 'n':
                 newMenuState = TextMenuTuttleInterface.TOP_LEVEL_MENU; 
                 break;

              case 'Y':
              case 'y': 
                 if ( theTuttle.isUndoAvailable()) { 
                    theTuttle.doCommand( "undo");
                 } 
                 newMenuState = TextMenuTuttleInterface.TOP_LEVEL_MENU; 
                 break;      
      
              } // End switch.   
              return newMenuState;
           } // End undoMenu.



   private int helpMenu( char pressed) { 
   
   int newMenuState = theInterface.HELP_MENU;
   
      switch( pressed) { 
      case KeyEvent.VK_ESCAPE:
         newMenuState = theInterface.TOP_LEVEL_MENU; 
         break;
      } // End switch.
      return newMenuState;
   } // End helpMenu.


   private int exitMenu( char pressed) { 
   
   int newMenuState = theInterface.HELP_MENU;
   
      switch( pressed) { 
      case KeyEvent.VK_ESCAPE:
         newMenuState = theInterface.TOP_LEVEL_MENU;
         break;

      case 'Y':
      case 'y':         
         System.exit( 0);
         break;                 
      
      case 'N':
      case 'n':
         newMenuState = theInterface.TOP_LEVEL_MENU;
         break;          
      } // End switch. 
          
      return newMenuState;
   } // End exitMenu.


   private void feedback(){    
      feedbackLabel.setText(  theTuttle.getDetails());
      feedbackPanel.doLayout();
   } // End feedback.
                                                          
} // End class TextMenuTuttle.



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -