1,647
30
Essay, 1 pages (200 words)

Import * class constructor. */ public infopanel()

import javax. swing. JPanel; import javax. swing. JLabel; import java. awt.

FlowLayout; import java. awt. Graphics; import java. awt. Dimension; import java. awt. Color; import java. awt.

Point;/** * Creates a panel for displaying gameplay information.  Extends the JPanel class. */public class InfoPanel extends JPanel{    /** integer representing the number of guesses made*/    int numberOfGuesses = 0;        /** JLabel containing the integer numberOfGuesses*/    JLabel guesses;    /**     * Class Constructor.     */        public InfoPanel()    {                setLayout(new FlowLayout());        setPreferredSize(new Dimension(400, 100));                guesses = new JLabel(“ Guesses: ” + numberOfGuesses);        guesses. setForeground(Color. red);        add(guesses);           }        /**     * Paints the panel with the necessary information     *      * @param   g   the graphics instance to be painted     */        public void paintComponent(Graphics g)    {        super. paintComponent(g);        setBackground(Color. white);        g. setColor(Color. black);        g. drawRect(0, 0, 399, 99);        g. fillRect(5, 15, 10, 10);        g. drawString(“ Miss”, 20, 25);        g. setColor(Color. green);        g. fillRect(5, 30, 10, 10);        g. setColor(Color. black);        g. drawString(“ Minesweeper (2)”, 20, 40);        g. setColor(Color. blue);        g. fillRect(5, 45, 10, 10);        g. setColor(Color. black);        g. drawString(“ Frigate (3)”, 20, 55);        g. setColor(Color. red);        g. fillRect(5, 60, 10, 10);        g. setColor(Color. black);        g. drawString(“ Cruiser (4)”, 20, 70);        g. setColor(Color. yellow);        g. fillRect(5, 75, 10, 10);        g. setColor(Color. black);        g. drawString(“ Battleship (5)”, 20, 85);            }    }

Thank's for Your Vote!
Import * class constructor. */ public infopanel(). Page 1
Import * class constructor. */ public infopanel(). Page 2

This work, titled "Import * class constructor. */ public infopanel()" was written and willingly shared by a fellow student. This sample can be utilized as a research and reference resource to aid in the writing of your own work. Any use of the work that does not include an appropriate citation is banned.

If you are the owner of this work and don’t want it to be published on AssignBuster, request its removal.

Request Removal
Cite this Essay

References

AssignBuster. (2022) 'Import * class constructor. */ public infopanel()'. 27 August.

Reference

AssignBuster. (2022, August 27). Import * class constructor. */ public infopanel(). Retrieved from https://assignbuster.com/import-assignbusterpostfilllog-assignbusterpostfillsh-badpostlog-calculatelinksbypostidsh-calculateweightbypostidsh-checkfillposts-combineddocxpy-config-forlinkssh-gokeywordsfunctionsh-gosingularfunct/

References

AssignBuster. 2022. "Import * class constructor. */ public infopanel()." August 27, 2022. https://assignbuster.com/import-assignbusterpostfilllog-assignbusterpostfillsh-badpostlog-calculatelinksbypostidsh-calculateweightbypostidsh-checkfillposts-combineddocxpy-config-forlinkssh-gokeywordsfunctionsh-gosingularfunct/.

1. AssignBuster. "Import * class constructor. */ public infopanel()." August 27, 2022. https://assignbuster.com/import-assignbusterpostfilllog-assignbusterpostfillsh-badpostlog-calculatelinksbypostidsh-calculateweightbypostidsh-checkfillposts-combineddocxpy-config-forlinkssh-gokeywordsfunctionsh-gosingularfunct/.


Bibliography


AssignBuster. "Import * class constructor. */ public infopanel()." August 27, 2022. https://assignbuster.com/import-assignbusterpostfilllog-assignbusterpostfillsh-badpostlog-calculatelinksbypostidsh-calculateweightbypostidsh-checkfillposts-combineddocxpy-config-forlinkssh-gokeywordsfunctionsh-gosingularfunct/.

Work Cited

"Import * class constructor. */ public infopanel()." AssignBuster, 27 Aug. 2022, assignbuster.com/import-assignbusterpostfilllog-assignbusterpostfillsh-badpostlog-calculatelinksbypostidsh-calculateweightbypostidsh-checkfillposts-combineddocxpy-config-forlinkssh-gokeywordsfunctionsh-gosingularfunct/.

Get in Touch

Please, let us know if you have any ideas on improving Import * class constructor. */ public infopanel(), or our service. We will be happy to hear what you think: [email protected]