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