package jetbrains.mps.editor.contextActionsTool.pluginSolution.plugin; /*Generated by MPS */ import javax.swing.Icon; import java.awt.Component; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.GeneralPath; import java.awt.Color; public class ExpandCollapseIcon implements Icon { private boolean collapsed; public ExpandCollapseIcon(boolean collapsed1) { collapsed = collapsed1; } @Override public int getIconHeight() { return 8; } @Override public int getIconWidth() { return getIconHeight(); } @Override public void paintIcon(Component component, Graphics g_, int x, int y) { Graphics2D g = ((Graphics2D) g_); GeneralPath shape = new GeneralPath(); shape.moveTo(x, y); int w = getIconWidth(); int h = getIconHeight(); if (collapsed) { w--; shape.lineTo(x + w, y + 0.5 * h); shape.lineTo(x, y + h); } else { h--; shape.lineTo(x + w, y); shape.lineTo(x + 0.5 * w, y + h); } shape.closePath(); g.setColor(Color.GRAY); g.fill(shape); } }