home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 39 / IOPROG_39.ISO / SOFT / sdkjava40.exe / data1.cab / fg_Samples / Samples / afc102 / JTreeVue / Src / JTreeMenuBtn.java < prev    next >
Encoding:
Java Source  |  2000-05-04  |  733 b   |  39 lines

  1. //
  2. // (C) Copyright 1995 - 1999 Microsoft Corporation.  All rights reserved.
  3. //
  4. import java.awt.*;
  5. import java.io.*;
  6. import java.util.Enumeration;
  7.  
  8. import com.ms.ui.*;
  9.  
  10. class JTreeMenuBtn extends UIMenuButton
  11. {
  12.     private UIMenuList list;
  13.     private JTreeNode node;
  14.  
  15.     public JTreeMenuBtn(String str, UIMenuList list, JTreeNode node)
  16.     {
  17.         super(str, 0, list);
  18.         this.list = list;
  19.         this.node = node;
  20.     }
  21.  
  22.     public boolean launch()
  23.     {
  24.         boolean ret = super.launch();
  25.         list.setSelectedIndex(0);
  26.         list.getSelectedItem().requestFocus();
  27.         return(ret);
  28.     }
  29.  
  30.     public void ended(Event evt)
  31.     {
  32.         super.ended(evt);
  33.         if ( !node.justchangedfocus )
  34.             node.requestFocus();
  35.         node.justchangedfocus = false;
  36.     }
  37. }
  38.  
  39.