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.ConstantIntegerInfo; 13 import org.gjt.jclasslib.util.ExtendedJLabel; 14 15 import javax.swing.tree.TreePath ; 16 17 23 public class ConstantIntegerInfoDetailPane extends AbstractConstantInfoDetailPane { 24 25 27 private ExtendedJLabel lblBytes; 28 private ExtendedJLabel lblInt; 29 private ExtendedJLabel lblComment; 30 31 35 public ConstantIntegerInfoDetailPane(BrowserServices services) { 36 super(services); 37 } 38 39 protected void setupLabels() { 40 41 addDetailPaneEntry(normalLabel("Bytes:"), 42 lblBytes = highlightLabel()); 43 44 addDetailPaneEntry(normalLabel("Integer:"), 45 lblInt = highlightLabel(), 46 lblComment = highlightLabel()); 47 48 } 49 50 public void show(TreePath treePath) { 51 52 int constantPoolIndex = constantPoolIndex(treePath); 53 54 try { 55 ConstantIntegerInfo entry = (ConstantIntegerInfo)services.getClassFile().getConstantPoolEntry(constantPoolIndex, ConstantIntegerInfo.class); 56 lblBytes.setText(entry.getFormattedBytes()); 57 lblInt.setText(entry.getInt()); 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 |