KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > gjt > jclasslib > browser > detail > constants > ConstantDoubleInfoDetailPane


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
8 package org.gjt.jclasslib.browser.detail.constants;
9
10 import org.gjt.jclasslib.browser.BrowserServices;
11 import org.gjt.jclasslib.structures.InvalidByteCodeException;
12 import org.gjt.jclasslib.structures.constants.ConstantDoubleInfo;
13 import org.gjt.jclasslib.util.ExtendedJLabel;
14
15 import javax.swing.tree.TreePath JavaDoc;
16
17 /**
18     Detail pane showing a <tt>CONSTANT_Double</tt> constant pool entry.
19  
20     @author <a HREF="mailto:jclasslib@ej-technologies.com">Ingo Kegel</a>
21     @version $Revision: 1.5 $ $Date: 2003/08/18 08:16:34 $
22 */

23 public class ConstantDoubleInfoDetailPane extends AbstractConstantInfoDetailPane {
24
25     // Visual components
26

27     private ExtendedJLabel lblHighBytes;
28     private ExtendedJLabel lblLowBytes;
29     private ExtendedJLabel lblDouble;
30     private ExtendedJLabel lblComment;
31     
32     /**
33         Constructor.
34         @param services the associated browser services.
35      */

36     public ConstantDoubleInfoDetailPane(BrowserServices services) {
37         super(services);
38     }
39     
40     protected void setupLabels() {
41         
42         addDetailPaneEntry(normalLabel("High bytes:"),
43                            lblHighBytes = highlightLabel());
44
45         addDetailPaneEntry(normalLabel("Low bytes:"),
46                            lblLowBytes = highlightLabel());
47         
48         addDetailPaneEntry(normalLabel("Double:"),
49                            lblDouble = highlightLabel(),
50                            lblComment = highlightLabel());
51
52     }
53
54     public void show(TreePath JavaDoc treePath) {
55         
56         int constantPoolIndex = constantPoolIndex(treePath);
57
58         try {
59             ConstantDoubleInfo entry = (ConstantDoubleInfo)services.getClassFile().getConstantPoolEntry(constantPoolIndex, ConstantDoubleInfo.class);
60             lblHighBytes.setText(entry.getFormattedHighBytes());
61             lblLowBytes.setText(entry.getFormattedLowBytes());
62             lblDouble.setText(entry.getDouble());
63         } catch (InvalidByteCodeException ex) {
64             lblComment.setText(MESSAGE_INVALID_CONSTANT_POOL_ENTRY);
65         }
66         
67         super.show(treePath);
68     }
69     
70 }
71
72
Popular Tags