Project Requirements Part I Design ( 30 pts ) : Displaying numbers in a triangul
ID: 3648665 • Letter: P
Question
Project RequirementsPart I Design ( 30 pts ) : Displaying numbers in a triangular pattern:
Write a class (DrawPyramid.java) that displays numbers in a triangular pattern. The class should have have a main method. That is it should be a non executable file.
Then use the following executable program (with the main method), which creates a DrawPyramid object and displays the pyramid.
import java.awt.*;
import javax.swing.*;
public class Pyramid extends JFrame {
public Pyramid() {
DrawPyramid numberPyramid = new DrawPyramid();
add(numberPyramid);
}
public static void main(String[] args) {
Pyramid frame = new Pyramid();
frame.setSize(400, 400);
frame.setTitle("Pyramid");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocationRelativeTo(null); // Center the frame
frame.setVisible(true);
}
}
The number of lines in the display should change to fit the window as the window resizes as follows.
Part II Design ( 30 pts ) : Displaying an image using a titled border,
Write another class(non executable file) ImagePanel.java , which displays an image such as the USA flag as follows(you are free to choose the image ):
Please note that along with the flag, you must use a titled border to define the image such as writing