Execute this code in java programming. https://findtheinvisiblecow.com/ Rules: T
ID: 3596217 • Letter: E
Question
Execute this code in java programming.
https://findtheinvisiblecow.com/ Rules: The Program will automatically open up your browser and type in the website. The Program will automatically start the game and find the cow. Points will be taken off if your program has a chance of clicking ad before find the cow. Extra Credit: The Program will follow all the rules above and continue by recognizing that the program found the cow already, and automatically start the game again. Thein it will find the cow again, and go in a loopExplanation / Answer
package com.BickDev.Game;
import java.awt.Canvas;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.*;
import java.awt.*;
import com.sun.awt.AWTUtilities;
import static java.awt.GraphicsDevice.WindowTranslucency.*;
import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
public class TransparentWindow extends JFrame {
public TransparentWindow() {
initComponents();
}
@SuppressWarnings("unchecked")
private void initComponents() {
setExtendedState(Frame.MAXIMIZED_BOTH);
setResizable(false);
setUndecorated(true);
setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
setAlwaysOnTop(true);
System.setProperty("sun.java2d.noddraw", "true");
WindowUtils.setWindowTransparent(this, true);
WindowUtils.setWindowAlpha(this, 0.6f);
}
public static void main(String[] args) {
if(Desktop.isDesktopSupported())
{
Desktop.getDesktop().browse(new URI("https://findtheinvisiblecow.com/"));
}
else
System.out.println("sorry...Desktop not supported");
new TransparentWindow().setVisible(true);
}
}
//First we have to import all classes.
//and write logic for open particular website.
//then we have to write invisible cow logic
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.