mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Large gradient rects are dare. Fill them using tile technique
This commit is contained in:
@@ -184,9 +184,7 @@ public class MacStatusBarUI extends StatusBarUI implements Activatable {
|
||||
final Color top = active ? ACTIVE_TOP_COLOR : INACTIVE_TOP_COLOR;
|
||||
final Color bottom = active ? ACTIVE_BOTTOM_COLOR : INACTIVE_BOTTOM_COLOR;
|
||||
|
||||
final GradientPaint paint = new GradientPaint(0, 0, top, 0, height, bottom);
|
||||
g2d.setPaint(paint);
|
||||
g2d.fillRect(0, 0, width, height);
|
||||
UIUtil.fillVerticalGradient(c, g, x, y, width, height, top, bottom);
|
||||
|
||||
if (active) {
|
||||
g2d.setColor(ACTIVE_BORDER_TOP_COLOR);
|
||||
|
||||
@@ -158,6 +158,24 @@ public class UIUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static void fillVerticalGradient(final Component c,
|
||||
final Graphics g,
|
||||
final int x,
|
||||
final int y,
|
||||
final int width,
|
||||
final int height,
|
||||
final Color top,
|
||||
final Color bottom) {
|
||||
BufferedImage img = new BufferedImage(10, height, BufferedImage.TYPE_INT_RGB);
|
||||
Graphics2D imageGraphics = (Graphics2D)img.getGraphics();
|
||||
imageGraphics.setPaint(new GradientPaint(0, 0, top, 0, height, bottom));
|
||||
imageGraphics.fillRect(0, 0, 10, height);
|
||||
|
||||
for (int i = x; i < x + width; i += 10) {
|
||||
g.drawImage(img, i, y, Math.min(10, width - i), height, null);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isReallyTypedEvent(KeyEvent e) {
|
||||
char c = e.getKeyChar();
|
||||
if (!(c >= 0x20 && c != 0x7F)) return false;
|
||||
|
||||
Reference in New Issue
Block a user