1 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.ConstantFloatInfo; 13 import org.gjt.jclasslib.util.ExtendedJLabel; 14 15 import javax.swing.tree.TreePath ; 16 17 23 public class ConstantFloatInfoDetailPane extends AbstractConstantInfoDetailPane { 24 25 27 private ExtendedJLabel lblBytes; 28 private ExtendedJLabel lblFloat; 29 private ExtendedJLabel lblComment; 30 31 35 public ConstantFloatInfoDetailPane(BrowserServices services) { 36 super(services); 37 } 38 39 protected void setupLabels() { 40 41 addDetailPaneEntry(normalLabel("Bytes:"), 42 lblBytes = highlightLabel()); 43 44 addDetailPaneEntry(normalLabel("Float:"), 45 lblFloat = highlightLabel(), 46 lblComment = highlightLabel()); 47 48 } 49 50 public void show(TreePath treePath) { 51 52 int constantPoolIndex = constantPoolIndex(treePath); 53 54 try { 55 ConstantFloatInfo entry = (ConstantFloatInfo)services.getClassFile().getConstantPoolEntry(constantPoolIndex, ConstantFloatInfo.class); 56 lblBytes.setText(entry.getFormattedBytes()); 57 lblFloat.setText(entry.getFloat()); 58 } catch (InvalidByteCodeException ex) { 59 lblComment.setText(MESSAGE_INVALID_CONSTANT_POOL_ENTRY); 60 } 61 62 super.show(treePath); 63 } 64 65 } 66 67 | Popular Tags |