KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > gjt > jclasslib > browser > detail > ElementValuePairDetailPane


1 /*
2     This library is free software; you can redistribute it and/or
3     modify it under the terms of the GNU General Public
4     License as published by the Free Software Foundation; either
5     version 2 of the license, or (at your option) any later version.
6 */

7 package org.gjt.jclasslib.browser.detail;
8
9 import org.gjt.jclasslib.browser.BrowserServices;
10 import org.gjt.jclasslib.browser.BrowserTreeNode;
11 import org.gjt.jclasslib.structures.elementvalues.ElementValue;
12 import org.gjt.jclasslib.structures.elementvalues.ElementValuePair;
13 import org.gjt.jclasslib.util.ExtendedJLabel;
14
15 import javax.swing.tree.TreePath JavaDoc;
16
17 /**
18  * Class for showing an element value pair node.
19  *
20  * @author <a HREF="mailto:vitor.carreira@gmail.com">Vitor Carreira</a>
21  * @version $Revision: 1.1 $ $Date: 2004/12/28 13:04:31 $
22  */

23 public class ElementValuePairDetailPane extends FixedListDetailPane {
24
25     private ExtendedJLabel lblElementName;
26     private ExtendedJLabel lblElementNameVerbose;
27
28     private ExtendedJLabel lblValueTag;
29     private ExtendedJLabel lblValueTagVerbose;
30
31     public ElementValuePairDetailPane(BrowserServices services) {
32         super(services);
33     }
34
35     protected void setupLabels() {
36         addDetailPaneEntry(normalLabel("Element name:"),
37                 lblElementName = linkLabel(),
38                 lblElementNameVerbose = highlightLabel());
39         addDetailPaneEntry(normalLabel("Value tag:"),
40                 lblValueTag = highlightLabel(),
41                 lblValueTagVerbose = highlightLabel());
42
43     }
44
45     public void show(TreePath JavaDoc treePath) {
46         ElementValuePair evp = (ElementValuePair)
47                 ((BrowserTreeNode)treePath.getLastPathComponent()).getElement();
48
49
50         constantPoolHyperlink(lblElementName,
51                 lblElementNameVerbose,
52                 evp.getElementNameIndex());
53
54         lblValueTag.setText(String.valueOf((char)evp.getElementValue().getTag()));
55         lblValueTagVerbose.setText("<" + ElementValue.getTagDescription(evp.getElementValue().getTag()) + ">");
56
57         super.show(treePath);
58     }
59
60 }
61
Popular Tags