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

Method drawItem

src/main/java/ui/controls/form/KeyInput.java:65–96  ·  view source on GitHub ↗
(Graphics g, int ofs, boolean sel)

Source from the content-addressed store, hash-verified

63 }
64
65 public void drawItem(Graphics g, int ofs, boolean sel) {
66 colorItem=ColorTheme.getColor(ColorTheme.CONTROL_ITEM);
67 colorBorder=ColorTheme.getColor(ColorTheme.CURSOR_OUTLINE);
68 colorBGnd=ColorTheme.getColor(ColorTheme.LIST_BGND);
69
70 int width=g.getClipWidth();
71 int height=fontHeight;
72
73 int oldColor=g.getColor();
74
75 int thisOfs=0;
76
77 int y = 0;
78 thisOfs = (getCaptionLength() > width) ? -ofs : 2;
79 g.setFont(captionFont);
80 FontCache.drawString(g,caption, thisOfs, y, Graphics.TOP | Graphics.LEFT);
81 y = captionFontHeight;
82
83 g.setColor(colorBGnd);
84 g.fillRect(0, y, width-1, height-1);
85
86 g.setColor((sel)?colorBorder:colorItem);
87 g.drawRect(0, y, width-1, height-1);
88
89 g.setColor(oldColor);
90
91 if (getTextLength()>0) {
92 thisOfs=(getTextLength()>width)?-ofs+4:4;
93 g.setFont(font);
94 FontCache.drawString(g,toString(), thisOfs, y, Graphics.TOP|Graphics.LEFT);
95 }
96 }
97
98 public int getVHeight() {
99 return captionFontHeight+fontHeight;

Callers

nothing calls this directly

Calls 11

getColorMethod · 0.95
getCaptionLengthMethod · 0.95
drawStringMethod · 0.95
getTextLengthMethod · 0.95
toStringMethod · 0.95
getColorMethod · 0.65
getClipWidthMethod · 0.45
setFontMethod · 0.45
setColorMethod · 0.45
fillRectMethod · 0.45
drawRectMethod · 0.45

Tested by

no test coverage detected