package graphtest; import javax.swing.*; import java.awt.*; import java.awt.geom.AffineTransform; public class Panel extends JPanel { @Override // переозначення методу малювання public void paintComponent (Graphics g) { super.paintComponent(g); g.setColor(Color.yellow); Graphics2D g2 = (Graphics2D) g; var at = AffineTransform.getRotateInstance (-Math.PI/2., 60.0, 60.0); at.concatenate(AffineTransform.getTranslateInstance (50.0, 0.0)); at.concatenate(AffineTransform.getScaleInstance (0.5, 0.5)); g2.setTransform (at); int [] ax = {10, 110, 110, 60, 60, 10}; int [] ay = {10, 10, 60, 60, 160, 160}; Polygon poly = new Polygon (ax, ay, 6); g2.fillPolygon(poly); } }