MCPcopy Index your code
hub / github.com/BombusMod/BombusMod / drawItem

Method drawItem

src/main/java/ui/IconTextElement.java:66–86  ·  view source on GitHub ↗
(Graphics g, int ofs, boolean sel)

Source from the content-addressed store, hash-verified

64 }
65
66 public void drawItem(Graphics g, int ofs, boolean sel) {
67 g.setFont(getFont());
68
69 String str = toString();
70 int offset = 4;
71
72 if (il != null) {
73 if (getImageIndex() != -1) {
74 offset += ilImageSize;
75 il.drawImage(g, getImageIndex(), 2, imageYOfs);
76 }
77 if (!il.isLoaded) {
78 str = getImgAlt() + toString();
79 }
80 }
81 g.clipRect(offset, 0, g.getClipWidth(), itemHeight);
82
83 if (str != null) {
84 FontCache.drawString(g, str, offset - ofs, fontYOfs, Graphics.TOP | Graphics.LEFT);
85 }
86 }
87
88 public int getVWidth(){
89 return getFont().stringWidth(toString())+ilImageSize+4;

Callers

nothing calls this directly

Calls 9

getFontMethod · 0.95
getImageIndexMethod · 0.95
getImgAltMethod · 0.95
drawStringMethod · 0.95
setFontMethod · 0.45
toStringMethod · 0.45
drawImageMethod · 0.45
clipRectMethod · 0.45
getClipWidthMethod · 0.45

Tested by

no test coverage detected