MCPcopy Index your code
hub / github.com/benfry/processing4 / paintComponent

Method paintComponent

app/src/processing/app/ui/ModeSelector.java:89–123  ·  view source on GitHub ↗
(Graphics g)

Source from the content-addressed store, hash-verified

87 }
88
89 @Override
90 public void paintComponent(Graphics g) {
91 Graphics2D g2 = Toolkit.prepareGraphics(g);
92
93 g.setFont(titleFont);
94 if (titleAscent == 0) {
95 titleAscent = (int) processing.app.ui.Toolkit.getAscent(g); //metrics.getAscent();
96 }
97 FontMetrics metrics = g.getFontMetrics();
98 titleWidth = metrics.stringWidth(title);
99
100 final int width = getWidth();
101 final int height = getHeight();
102 final int inset = Toolkit.zoom(4);
103 final int outline = Toolkit.zoom(1);
104
105 // clear the background
106 g.setColor(backgroundColor);
107 g.fillRect(0, 0, width, height);
108
109 // draw the outline for this feller
110 g.setColor(outlineColor);
111 //Toolkit.dpiStroke(g2);
112 g2.draw(Toolkit.createRoundRect(outline, outline + inset, width - outline, height - outline - inset,
113 RADIUS, RADIUS, RADIUS, RADIUS));
114
115 g.setColor(titleColor);
116 g.drawString(title, MODE_GAP_WIDTH, (height + titleAscent) / 2 + 1);
117
118 int x = MODE_GAP_WIDTH + titleWidth + ARROW_GAP_WIDTH;
119 triangleX[0] = x;
120 triangleX[1] = x + ARROW_WIDTH;
121 triangleX[2] = x + ARROW_WIDTH/2;
122 g.fillPolygon(triangleX, triangleY, 3);
123 }
124
125 @Override
126 public Dimension getPreferredSize() {

Callers

nothing calls this directly

Calls 11

prepareGraphicsMethod · 0.95
zoomMethod · 0.95
createRoundRectMethod · 0.95
getAscentMethod · 0.80
stringWidthMethod · 0.80
getFontMetricsMethod · 0.45
getWidthMethod · 0.45
getHeightMethod · 0.45
setColorMethod · 0.45
drawMethod · 0.45
drawStringMethod · 0.45

Tested by

no test coverage detected