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

Method paintText

app/src/processing/app/laf/PdeButtonUI.java:104–128  ·  view source on GitHub ↗
(Graphics g, JComponent c, Rectangle textRect, String text)

Source from the content-addressed store, hash-verified

102
103
104 protected void paintText(Graphics g, JComponent c, Rectangle textRect, String text) {
105 AbstractButton b = (AbstractButton) c;
106 ButtonModel model = b.getModel();
107 FontMetrics fm = SwingUtilities2.getFontMetrics(c, g);
108// FontMetrics fm = c.getFontMetrics(g.getFont());
109 int mnemonicIndex = b.getDisplayedMnemonicIndex();
110
111 if (model.isPressed()) {
112 g.setColor(pressedFgColor);
113 } else if (model.isEnabled()) {
114 g.setColor(enabledFgColor);
115 } else {
116 g.setColor(disabledFgColor);
117 }
118 SwingUtilities2.drawStringUnderlineCharAt(c, g,text, mnemonicIndex,
119 textRect.x + getTextShiftOffset(),
120 textRect.y + fm.getAscent() + getTextShiftOffset());
121
122// } else {
123// //g.setColor(b.getBackground().brighter());
124// g.setColor(disabledFgColor);
125// SwingUtilities2.drawStringUnderlineCharAt(c, g, text, mnemonicIndex,
126// textRect.x, textRect.y + fm.getAscent());
127// }
128 }
129
130
131 public void updateTheme() {

Callers

nothing calls this directly

Calls 5

getFontMetricsMethod · 0.95
getAscentMethod · 0.80
setColorMethod · 0.45
isEnabledMethod · 0.45

Tested by

no test coverage detected