PIbd-21_Eliseev_E.E._Airbus.../Project/src/DrawingTriangleAirplaneWindow.java

64 lines
2.0 KiB
Java
Raw Normal View History

import javax.swing.*;
import java.awt.*;
public class DrawingTriangleAirplaneWindow extends JComponent implements IAdditionalDrawingObject
{
private Additional_Enum _airplaneWindowEnum;
@Override
public void SetAddEnum(int airplaneWindow)
{
for(Additional_Enum item : _airplaneWindowEnum.values())
{
if(item.GetAddEnum() == airplaneWindow)
{
_airplaneWindowEnum = item;
return;
}
}
}
public void DrawAirplaneWindow(Color colorWindow, Graphics g, float _startPosX, float _startPosY)
{
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
if(_airplaneWindowEnum.GetAddEnum() >= 1)
{
int[] x_point = {(int)_startPosX + 12, (int)_startPosX + 16, (int)_startPosX + 9};
int[] y_point = {(int)_startPosY + 11, (int)_startPosY + 15, (int)_startPosY + 15};
g2d.setPaint(colorWindow);
g2d.fillPolygon(x_point, y_point, 3);
g2d.setPaint(Color.BLACK);
g2d.drawPolygon(x_point, y_point, 3);
}
if(_airplaneWindowEnum.GetAddEnum() >= 2)
{
int[] x_point = {(int)_startPosX + 21, (int)_startPosX + 25, (int)_startPosX + 18};
int[] y_point = {(int)_startPosY + 11, (int)_startPosY + 15, (int)_startPosY + 15};
g2d.setPaint(colorWindow);
g2d.fillPolygon(x_point, y_point, 3);
g2d.setPaint(Color.BLACK);
g2d.drawPolygon(x_point, y_point, 3);
}
if(_airplaneWindowEnum.GetAddEnum() >= 3)
{
int[] x_point = {(int)_startPosX + 30, (int)_startPosX + 34, (int)_startPosX + 27};
int[] y_point = {(int)_startPosY + 11, (int)_startPosY + 15, (int)_startPosY + 15};
g2d.setPaint(colorWindow);
g2d.fillPolygon(x_point, y_point, 3);
g2d.setPaint(Color.BLACK);
g2d.drawPolygon(x_point, y_point, 3);
}
}
}