Program in JAVA

computer science

Description

import javax.swing.*; import java.awt.Graphics; import java.awt.Color; public class drawFlag extends JFrame { public drawFlag() { add(new NewPanel()); } public static void main(String[] args) { drawFlag frame = new drawFlag(); frame.setTitle("Flag"); frame.setSize(200, 200); frame.setLocationRelativeTo(null); // Center the frame frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); frame.paint(null); JPanel panel = new JPanel(); panel.setLayout(new FlowLayout()); JLabel label = new JLabel("Flag"); panel.add(label); frame.add(panel); } public void paint(Graphics g) { g.setColor(Color.BLUE); g.fillOval(68, 28, 4, 4); g.drawRect(70, 30, 50, 30); g.drawLine(70, 30, 70, 120); g.setColor(Color.BLUE); } }

Instruction Files

Related Questions in computer science category


Disclaimer
The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.