Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For this assignment you are to create an interactive moving sign in the context

ID: 3556969 • Letter: F

Question

For this assignment you are to create an interactive moving sign in the context of a cityscape street scene. Click the link below to see how a base version of this assignment works. Type a message in the long blank slot at the top left, and then click Start to see the message displayed in a moving format.

The driver and DisplayWindow classes, which you may NOT alter, are provided here:

--------------------------

-------

Note that the application will makes use of the DisplayWindow class that figures prominently in Chapters 12 and 13 of the textbook. For this assignment you need only submit a single file, MovingSignPanel.java (must be so named), which extends JPanel in the standard way, and which carries out the main actions of the assignment.

Other issues

* The cityscape presented above in the running demonstration code is pathetic - there's just one building, no sky to speak of, etc. You are encouraged to vastly improve on the rendering of the cityscape. Ideas: more buildings; the sky can become lighter or darker over time; lights can go on in some of the windows in the buildings; you could add a park, a flagpole, the sun, the moon, cars, flying saucers; you can make the sign move faster or slower, and so forth.

* The SignDriver code includes machinery for including a menu or menus in your application. You DO NOT need to use this machinery. But if you decide to add menus, it's there.

Explanation / Answer

public class PopUPandTabHandlingWithSET { public static void main(String[] args) throws InterruptedException { System.setProperty("webdriver.chrome.driver", "C:\chromedriver.exe"); WebDriver myTestDriver = new ChromeDriver(); myTestDriver.get("http://www.codeproject.com"); // Create the set Set codeprojectWindowID = myTestDriver.getWindowHandles(); System.out.println("Main Window Handle ----------------- " + codeprojectWindowID); Iterator it = codeprojectWindowID.iterator(); while (it.hasNext()) { // Get element Object element = it.next(); System.out.println(element); } myTestDriver.findElement(By.xpath("//*[@id='C']/div[1]/div[3]/a[2]/img")).click(); // Go to second window and click on forgot password link codeprojectWindowID = myTestDriver.getWindowHandles(); it = codeprojectWindowID.iterator(); String MainWindowHandle = it.next(); String NewWindowHandle = it.next(); System.out.println(MainWindowHandle); System.out.println(NewWindowHandle); Thread.sleep(3000L); myTestDriver.switchTo().window(NewWindowHandle); myTestDriver.findElement(By.xpath("//*[@id='link-forgot-passwd']")).click(); // Go to 3rd popup window and click on Submit button codeprojectWindowID = myTestDriver.getWindowHandles(); it = codeprojectWindowID.iterator(); it.next(); it.next(); String NewPopUPWindow = it.next(); myTestDriver.switchTo().window(NewPopUPWindow); myTestDriver.findElement(By.xpath("//input[@class='button g-button g-button-submit']")).click(); // Close all Opened windows myTestDriver.close(); myTestDriver.switchTo().window(NewWindowHandle); myTestDriver.close(); myTestDriver.switchTo().window(MainWindowHandle); myTestDriver.close(); } }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote