2. Programmas kods
package Pakete;
import java.util.Random;
import java.awt.Graphics;
import java.awt.Color;
class P {
public static int[] x = new int[6];
public static int[] y = new int[6];
}
private void Zimet() {
Graphics g = jPanel1.getGraphics();
int w = jPanel1.getWidth();
int h = jPanel1.getHeight();
int xC = w/2;
int yC = h/2;
g.setColor(Color.white);
g.fillRect(0, 0, w, h);
g.setColor(Color.black);
g.drawLine(0, yC, w, yC);
g.drawLine(xC, 0, xC, h);
for (int i=0; i<6; i++) {
g.setColor(Color.red);
g.drawOval(P.x[i] - 2 + xC, yC - P.y[i]-2, 4, 4);
g.setColor(Color.blue);
g.drawString(String.valueOf(i+1), P.x[i]+xC-6, yC-P.y[i]-6);
if (i<5) {
g.drawLine(P.x[i]+xC, yC-P.y[i], P.x[i+1]+xC, yC-P.y[i+1]);
}else{
g.drawLine(P.x[i]+xC, yC-P.y[i], P.x[0]+xC, yC-P.y[0]); // [0] - galapunkts
…