Cursor button settings

  Abstract: The cursor button settings 

  </ Td> </ tr> <tr> <td width="498" height="35" valign="top" class="ArticleTeitle"> 
  Import java.awt .*; 
  Import javax.swing .*; 
  Import java.awt.event .*; 

  Public class CursorDEmo extends JApplet implements ActionListener ( 

  String cursorName [] = ( 
  "DEFAULT_CURSOR" 
  "CROSSHAIR_CURSOR" 
  "TEXT_CURSOR" 
  "WAIT_CURSOR" 
  "HAND_CURSOR" 
  "MOVE_CURSOR" 
  "N_RESIZE_CURSOR" 
  "S_RESIZE_CURSOR" 
  "E_RESIZE_CURSOR" 
  "W_RESIZE_CURSOR" 
  "NE_RESIZE_CURSOR" 
  "NW_RESIZE_CURSOR" 
  "SE_RESIZE_CURSOR" 
"SW_RESIZE_CURSOR"
  ); 

  Int cursorType [] = ( 
Cursor.DEFAULT_CURSOR,
Cursor.CROSSHAIR_CURSOR,
Cursor.TEXT_CURSOR,
Cursor.WAIT_CURSOR,
Cursor.HAND_CURSOR,
Cursor.MOVE_CURSOR,
Cursor.N_RESIZE_CURSOR,
Cursor.S_RESIZE_CURSOR,
Cursor.E_RESIZE_CURSOR,
Cursor.W_RESIZE_CURSOR,
Cursor.NE_RESIZE_CURSOR,
Cursor.NW_RESIZE_CURSOR,
Cursor.SE_RESIZE_CURSOR,
Cursor.SW_RESIZE_CURSOR
  ); 
  Public void init () ( 
  GetContentPane (). SetLayout (new GridLayout (5,3,5,5)); 

  For (int i = 0; i    JButton b = new JButton (cursorName [i]); 
  B.setActionCommand ( "" + i); 
  B.setCursor (Cursor.getPredefinedCursor (cursorType [i])); 
  B.addActionListener (this); 
  GetContentPane (). Add (b); 
  ) 
  ); 

  Public void actionPerformed (ActionEvent e) ( 
  String id = e.getActionCommand (); 
  System.out.println (id); 
  ) 
  ) 

  </ Td> <td width="186" valign="top" class="ArticleTeitle"> 
  </ Td> </ tr> <tr> <td height="25" colspan="2" valign="top" class="ArticleTeitle"> 

  ↑ Back 

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • DotNetKicks
  • DZone
  • Netvouz
  • Propeller

Recommend Articles

Comments

Leave a Reply