In need of help - eclipse - import image - eclipse

Hello i've just started today, so i am very new at this.
I'm following this toturial and i ran into a trouble when i was asked to import a picture as the background for this "game".
i've created a new source folder and placed the picture there
package com.scrollshooter.www;
public class Board {
Pig p;
Image img;
public board(){
}
}
Looks like this at the moment, and the person who created this toturial says that i have to import the picture and afterwards he hover the "image" and there he has the picture. i have no idea how to import the picture into the file
Please help!

make a new folder into your project name it "img", put the image in the folder .
import image using the path like : img/test.png

Related

How to change the image of my java app icon

I have searched for an answer to this question in many places, but none of the answers satisfies what I really want. There are variations of the solution, but they all go along the lines of the code I have below:
MainFrame() {
ImageIcon logo = new ImageIcon(getClass().getResource("file_path"));
setIconImage(logo.getImage);
//the rest of my code
}
public static void main(String[] args){
MainFrame mf = new MainFrame();
mf.pack();
mf.setVisible(true);
}
Basically, load an image or an image icon from a file, and then call the setIconImage() method from the JFrame. This sets the icon image in the title bar of the window, and also the icon image in the task bar when the app is active. But it does not set the icon image of the app icon. In order to show you more clearly what I mean, please see the image I attached, where I circled the three icons. The one with the Java coffee cup is the one I haven't been able to change.
the taskbar, my app, and the window of my app
Can somebody help me set the image of the app icon itself (not just the task bar and title bar icons)?
I was not able change the image of the jar file itself as it sits inside a directory, as shown in the image attached to my question. However, I was able was to set the icon image of the .exe file when I packaged it with jpackage.
Basically, once I was ready to package my app I entered in Command Prompt, making sure to include the --icon option:
jpackage --input C:\app_files\MyApp --name MyApp --main-jar myapp.jar --main-class main.MainThread --icon C:\app_files\MyApp\logo.ico --win-shortcut --dest C:\Users\Desktop\Apps --runtime-image C:\app_files\my_jre
Note: Here, at least for Windows 10, the icon image must be an .ico file.

How to create a unity project using a custom piece of code

What I want to do is basically press a button in my application(C# WPF) and create a unity project in a predefined version, import some packages and then launch it.
I have no Idea if that's possible or not. I haven't found anything yet.
Would be awesome if you got a way to do it! Thanks in advance :)
You can use the Unity command line to create a project and import a package in c# like this:
using System.Diagnostics;
...
var arguments = $" -createProject {path} -importPackage {packagePath}";
var process = Process.Start(#"C:\Program Files\Unity\Editor\Unity.exe", arguments);
Check this page https://docs.unity3d.com/Manual/EditorCommandLineArguments.html

How do I upload Icons from material-ui?

I have run npm install using material-ui icons
npm install #material-ui/icons
and imported the search icon in my code but I have not getting any output.
import SearchIcon from "#material-ui/icons/Search";
when I call the search icon
<SearchIcon />
the program outputs a blank screen but without it the code works fine. Does anyone know why the icon is not showing?
This is my code if it helps
The icons are not exported as default on the Material UI library. Therefore you also shouldn't try to import them as default. Try something like this:
import { Search as SearchIcon } from "#mui/icons-material";

ionic navigation not working and giving cannot find module path

This is the error , i have checked everything in my modules and component and there is nothing missing (click to see photo)
your second-page import path is wrong please change it
import { SecondPage } from '../second/second'
i hope its work for you.

ui4j - Possible to screenshot the whole page?

I would like to capture a screenshot of a website including content that you can only see if you scrolled down.
Is that possible?
EDIT:
I already tried https://github.com/ui4j/ui4j/blob/master/ui4j-sample/src/main/java/com/ui4j/sample/ScreenCapture.java, but it did not capture the whole page, just the visible portion(inside my monitor's viewport).
page.show(true);
page.captureScreen(new FileOutputStream(file));
Yes, you could capture screenshot of the whole page with ui4j. Sample code:
package com.ui4j.sample;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import com.ui4j.api.browser.BrowserFactory;
import com.ui4j.api.browser.Page;
public class ScreenCapture {
public static void main(String[] args) throws FileNotFoundException {
Page page = BrowserFactory.getWebKit().navigate("https://www.google.com");
page.show(true);
page.captureScreen(new FileOutputStream(new File("google.png")));
}
}
Alternative solution:
I highly recommend to use cdp4j library for full page screen capture. Its a Java library which help to automate Chrome/Chromium based browser. Here is the sample code.