KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > rero > dialogs > help > HelpCommands


1 package rero.dialogs.help;
2
3 import javax.swing.*;
4 import javax.swing.event.*;
5 import javax.swing.tree.*;
6
7 import java.awt.*;
8 import java.awt.event.*;
9
10 import rero.config.*;
11 import rero.dialogs.*;
12 import rero.gui.*;
13
14 import java.net.*;
15
16 import java.util.*;
17
18 public class HelpCommands extends HelperObject implements ListSelectionListener
19 {
20     public void valueChanged(ListSelectionEvent e)
21     {
22         if (e.getValueIsAdjusting())
23        return;
24
25         JList theList = (JList)e.getSource();
26         String JavaDoc key = (String JavaDoc)(theList.getSelectedValue());
27
28     if (theList.isSelectionEmpty() || key.equals(" "))
29     {
30            updateText("");
31     }
32     else
33         {
34            updateText(help.getCommand(key));
35     }
36     }
37
38     public JComponent getNavigationComponent()
39     {
40     JList comOptions = new JList(help.getCommandData().getData());
41         comOptions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
42
43         comOptions.addListSelectionListener(this);
44
45         return comOptions;
46     }
47 }
48
49
50
51
Popular Tags