MCPcopy Create free account
hub / github.com/BombusMod/BombusMod / draw

Method draw

src/main/java/ui/controls/ScrollBar.java:154–186  ·  view source on GitHub ↗
(Graphics g)

Source from the content-addressed store, hash-verified

152 }
153
154 public void draw(Graphics g) {
155
156 if (size == 0) return;
157
158 yTranslate=g.getTranslateY();
159
160 drawHeight=g.getClipHeight();
161 int drawWidth=g.getClipWidth();
162
163 scrollerX=drawWidth-scrollWidth;
164
165 g.translate(scrollerX, 0);
166
167 g.setColor(colorTop);
168 g.fillRect(1, 0, scrollWidth-2, drawHeight-1);
169
170 g.setColor(colorBorder);
171 g.drawLine(0, 0, 0, drawHeight-1);
172 g.drawLine(scrollWidth-1, 0, scrollWidth-1, drawHeight-1);
173
174 drawHeight-=minimumHeight;
175
176
177 scrollerSize = (drawHeight*windowSize)/size+minimumHeight;
178
179 scrollerPos = (drawHeight*position)/size;
180 scrollerX-=scrollWidth;
181 g.setColor(colorBar);
182 g.fillRect(1, scrollerPos, scrollWidth-2, scrollerSize);
183 g.setColor(colorBorder);
184 g.drawLine(0, scrollerPos, scrollWidth-1, scrollerPos);
185 g.drawLine(0, scrollerPos+scrollerSize, scrollWidth-1, scrollerPos+scrollerSize);
186 }
187}

Callers

nothing calls this directly

Calls 7

getTranslateYMethod · 0.80
getClipHeightMethod · 0.45
getClipWidthMethod · 0.45
translateMethod · 0.45
setColorMethod · 0.45
fillRectMethod · 0.45
drawLineMethod · 0.45

Tested by

no test coverage detected