Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given the following Java code how can I center on screen the graphics drawing made in a myPanel class? I just need a pseudo example

Given the following Java code how can I center on screen the graphics drawing made in a myPanel class? I just need a pseudo example since I cant post the whole code while enrolled in this class. import javax.swing.JFrame; public class Main { public static void main(String[] args) { JFrame myFrame = new JFrame("Minesweeper"); myFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); myFrame.setLocation(400,150); myFrame.setSize(1920, 1080); //Hard coded Resolution myFrame.setExtendedState(JFrame.MAXIMIZED_BOTH); // sets Frame to full screen on launch MyPanel myPanel = new MyPanel(); myFrame.add(myPanel); MyMouseAdapter myMouseAdapter = new MyMouseAdapter(); myFrame.addMouseListener(myMouseAdapter); myFrame.setVisible(true); } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual C# And Databases

Authors: Philip Conrod, Lou Tylee

16th Edition

1951077083, 978-1951077082

More Books

Students also viewed these Databases questions

Question

5. How would you describe your typical day at work?

Answered: 1 week ago

Question

7. What qualities do you see as necessary for your line of work?

Answered: 1 week ago