On a Mac, there is a button on the screen menu bar that is the name of an application. For example, for terminal, there is a button at the top of the screen labeled Terminal. When you click it, there is a options that says About Terminal. When this is clicked, it shows information about the application. Here is a picture:
How can I add this to my application in Java? When I do this now, this is what shows up:
As you can see, it shows the Java version etc. Is there a way to change this into a more professional format?
If your Window extends JFrame, just use the setIconImage or setIconImages method to set your icon.
From the corresponding JavaDoc:
Sets the image to be displayed as the icon for this window.
The other information is read from the executable metadata. If you run your app using Java directly, you can't change it. For my applications, I generate an executable file using Install4J, where the installer adds the metadata to the generated executable.
Thanks, I've solved the problem. It was a simple mistake, when I packaged it together using a packager it worked fine. Thanks for all your help!
Related
When I click on the downloaded libgdx file I select run with Java then the libgdx window pops up I check android (and tried to check desktop too) and leave the names default and some times I tried to change them and for extensions I leave it as default the only one checked is box 2D.
Its says in the little console below that it's generating an app in my desired path then its just stuck there for hours.
(I checked task manager and its not using almost any resources other than 60 mbs of ram)
This problem could possibly happen if the application cannot write into the destination folder you choose. So avoid making the destination folder inside the system32 folder or such.
Run the jar file from the command prompt to see the exception it generates which should explain the problem:
Hold down the Windows button and tap the 'r' key.
In the dialog type 'cmd' then enter.
Copy this text using ctrl-c, include all quotes. Adjust the file names to point to your Java VM runtime and your downloaded
gdx-setup.jar file: "C:\Program
Files\AdoptOpenJDK\jdk-8.0.222.10-hotspot\bin\java.exe" -jar "C:\Users\keith\Downloads\gdx-setup.jar"
Paste the text into the command prompt by pressing ctrl-insert (the zero key on the numpad). Alternatively, tap the top left icon,
then edit, then paste.
See what the specific exception is in the cmd console when the gdx setup program runs.
How is running a jar file from terminal different from running it directly??
What I want to ask is, I made a GUI application and added a launcher icon to it. When I run it from terminal, it shows the launcher icon and I can as obvious lock that icon to the launcher. But, when I run it directly, it shows the default jvm icon instead of the launcher icon I added. And, if I lock that icon to the launcher, and try to run the app by clicking the icon, it just doesn't do anything??
Is their any way, that it shows the same launcher icon I added to it??
You need to set the dock icon in OSX for this to work.
Possible duplicate of the question : How do you change the Dock Icon of a Java program?
Additionally, refer this documentation : https://developer.apple.com/library/mac/documentation/Java/Conceptual/Java14Development/00-Intro/JavaDevelopment.html
I have searched on the net, but I have not found anything for my case.
I have created an application, that shows only in the SystemTray (icon) when you start. I want to run the jar file or the exe automatically when windows starts.
I would like to do this via code or automatically directly from my app. A menu item (for example) that the user could click on that option, if desired. I searched the internet but have not found anything.
Thank you in advance
Thank you very much
Only code Java or Bat
I think you can register your application as a system service, set the starttype auto start
Follow the below steps for windows 7
1)Click the Start windows button , click All Programs, right-click the Startup folder, and then click Open.
2) Open the location that contains the item you want to create a shortcut to.
3) Right-click the item, and then click Create Shortcut. The new shortcut appears in the same location as the original item.
4) Drag the shortcut into the Startup folder.
The next time you start Windows, the program will run automatically.
I got from this link
I read on another forum that to launch draw9pad from your console, you have to do java -jar draw9patch.jar from the command prompt once youre in sdk. I did that but i still cannot launch the file. Is this tool absolutely necessary for your pictures to scale on different screens? I know that eclipse has these drawable folders that scale your pictures to different dpis or is that not what they do?
Console output: http://imgur.com/YdGLHXr
File skd/tools :http://imgur.com/vOU647L
To answer the first question for a Mac OS or Linux user, simply type sh draw9patch to launch the editor. CommonsWare already answered the second question.
I read on another forum that to launch draw9pad from your console, you have to do java -jar draw9patch.jar from the command prompt once youre in sdk
Please use the draw9patch batch file or shell script found in the tools/ directory of your SDK installation.
I did that but i still cannot launch the file
First, that is because you did not type it in correctly, as you did not include the .jar extension.
Second, that JAR file is not in that directory. You can tell that by looking at the directory contents.
Instructions for running draw9patch can be found in the Android documentation.
Is this tool absolutely necessary for your pictures to scale on different screens?
Quoting the documentation:
A NinePatchDrawable graphic is a stretchable bitmap image, which Android will automatically resize to accommodate the contents of the View in which you have placed it as the background.
Scaling for different screens is not really the role of a nine-patch PNG file. Scaling for different content is. A nine-patch is used as the background for widgets like Button, EditText, and the like.
First I have read all questions about this subject, so this is not a repeated question.
What I want to ask about, how an application written in Java (such as eclipse) uses an icon instead of the default jar icons.
I don't care about compatibility, I always can make 2 different versions of my program to Windows and Linux.
How to make it in Linux and Windows.
Thanks very much.
In the case of programs like eclipse, which are written in java and have a specific icon in Windows (or Linux or Mac for that matter), they actually have an OS specific executable file, e.g. eclipse.exe for windows, that initialises the java program.
It is this executable that contains the application icon, not the Java program. If you want to do the same, you'll need to create the executable 'front door', as it were, and give it an icon.
If it's just for your own personal aesthetics, just create a short cut to the jar file and change the icon of the shortcut.
To set an image for MAC, you can use com.apple.eawt.Application. try this:
Image img = new ImageIcon("abc.png").getImage(); // your desired image
Application app = Application.getApplication();
app.setDockIconImage(img);
However, this will not build on Windows or Linux by default. If you'd like it to, (Maven) add the following dependency to your POM:
<dependency>
<groupId>com.yuvimasory</groupId>
<artifactId>orange-extensions</artifactId>
<version>1.3.0</version>
</dependency>
Or, if you don't use Maven, you can download the JAR from http://central.maven.org/maven2/com/yuvimasory/orange-extensions/1.3.0/orange-extensions-1.3.0.jar
If the application is launched using Java Web Start, an application icon can be specified for use in desktop shortcuts and menu items.
Note that this icon is not attached directly to the Jar, but since the end user never sees or has to deal with a Jar, that should not be a problem.
I use NetBeans, so if you aren't using that, I don't quite know. But, when you select the window, there is an option in the properties window for an icon file. When you build the .jar, that icon should be built in with the program.
If you're talking about the actual application icon in, say, Windows, you can't change it (programmatically). That's determined by the OS. Although you can change it in your OS in Folder Options.
You can, however, set the window (read: JFrame) icon image using setIconImage().