On Macs, there's a default menu at the top for basic application handling functions:
I've made an application using Java for my Grade 10 final project, (and I'm quite convinced that it's better than Microsoft Paint) and I decided to package it. Using Eclipse, I exported it as a Mac OS X Application Bundle. However, I want to change the "About Editor" on the default menu. Currently, it shows this:
How can I change the contents of the About Window (My app is definitely not Version 1.0.1)? I'm hoping not to go into Xcode or anything, but is there something that I can change with something like System.setProperty(key, value)?
If your application is an .app bundle then it should have an info.plist. Inside the info.plist will normally contain version information that should display the version number:
<key>CFBundleShortVersionString</key>
<string>2.0.0</string>
Typically the version information here is populated in places that call for it (eg. About). To change the name that would display on the menu and within the about dialog box:
<key>CFBundleName</key>
<string>My Application</string>
Copyright Info:
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2015 Your Company</string>
Bundle Icon File:
<key>CFBundleIconFile</key>
<string>icon.icns</string>
Related
I use the following maven plugin configuration on my mac to generate the native installers.
<plugin>
<groupId>com.zenjava</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>8.5.0</version>
<configuration>
<appName>${project.name}</appName>
<title>${project.name}</title>
<description>${project.description}</description>
<vendor>example</vendor>
<certCountry>com</certCountry>
<mainClass>${mainClass}</mainClass>
<needMenu>true</needMenu>
<additionalAppResources>src/main/deploy/package/all</additionalAppResources>
<bundleArguments>
<icon.ico>src/main/resources/icons/Icon.ico</icon.ico>
<icon.png>src/main/resources/icons/Icon_32.png</icon.png>
<icon.icns>src/main/resources/icons/Icon.icns</icon.icns>
</bundleArguments>
<jfxMainAppJarName>${project.build.finalName}.jar</jfxMainAppJarName>
</configuration>
</plugin>
The Example.app folder and the Example.dmg installer both show the correct app icon, but the Example.pkg installer shows the plain java jar image (1).
How can change that image (1)?
Is it possible to change the small icon in the title bar (2) as well?
The folder structure of my project:
src
main
java
*.java
resources
icons
Icon.ico
Icon.icns
Icon_*.png
deploy
package
all
LICENSE
pom.xml
I tried with Oracle Java JDK 8 Update 40 and Update 101 (64bit)
See also: javafx-maven-plugin#224
To make it dedundant, I'm pasting the answer here too:
Hi there,
this is no bug, it is "just" undocumented (seems there are a lot of people who know this, or very few people who use this feature).
Please see the getConfig_BackgroundImage-method:
https://github.com/teamfx/openjfx-8u-dev-rt/blob/fd634925571310284b02d89ff512552e795ba5e8/modules/fxpackager/src/main/java/com/oracle/tools/packager/mac/MacPkgBundler.java#L192
private File getConfig_BackgroundImage(Map<String, ? super Object> params) {
return new File(CONFIG_ROOT.fetchFrom(params), APP_NAME.fetchFrom(params) + "-background.png");
}
Please create some image and place it below src/main/deploy/package/macosx, it has to be PNG-fileformat. This file should be named ${project.name}-background.png to get fetched by the bundler.
This should have been printed out to you while having <verbose> set to true.
General advice: turn VERBOSE-switch on ;) the packager itself behaves different (like not removing the temporary created working-folder, making it possible to further adjust your stuff) and prints out more important debugging-stuff.
The verbose-hint is even mentioned in the official documentation:
https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.html#BCGHHDGC
Late reply, but if you still wonder how to change the small icon in the title bar (2) you can do that simply by right-clicking the pkg-file and choose Get Info in the menu, then you simply drag-and-drop your .icns-file on top of the current one next to the pkg name. This will change the pkg-icon and what is shown in the title bar during installation. This does not appear to break the product signature either which is good, see picture below...
To verify signature still holds after icon change:
spctl -a -v --type install MyAppName-1.0.pkg
MyAppName-1.0.pkg: accepted
source=Developer ID
I want to use my icon in native packaging for java Swing application. There is no option for setting Application icon in properties. There is by default available for JavaFX applications. I need it for Swing having custom exe icon.
Inno setup is used for native packaging in netbeans 8.0.2.
Application icon is in Java Coffee cup icon. I can able to set the frame icon, but I need to set it for generating exe.
My swing application icon
My actual configuration is Netbeans 8.01 with JDK 8 on windows 10
If you look inside your project, there is a subfolder nbproject that contains build directives. A close look at the file build-native.xml give you that:
if(isTrue(nativeEnabled) && defined(nativeType) && nativeType != "none") {
var icon = new String(project.getProperty("deploy.icon.native"));
if(defined(icon)) {
if(isTrue(fx_ant_api_1_2) && !isTrue(have_jdk_pre7u14)) {
var dicon = derelativizePath(icon);
// create temporary icon copy renamed to application name (required by native packager)
so you have to add a line in YourProjectFolder/project.properties and it must be like:
deploy.icon.native=C:\\Path\\of\\the\\icon\\yourIcon.ico
(path double slashed)
After that you will be able to see the generated file with yourIcon provided.
In your main Frame (In Navigation Window generally in the lower left) Click the JFrame to get the JFrame Options.
In the properties window (generally in the lower right) Go to Other Properties group->IconImage (Click the button (...) )
Choose custom code and there put something like:
new ImageIcon(getClass().getResource("/resources/images/Image.png")).getImage()
Note that this image is in the classpath and is the path of the image in your JAR file.
So if you have the project package like org.myPackage in your directory /home/user/Projects/myProj/org/myPackage
You must have other directory /home/user/Projects/myProj/resources/images/ with this image.
How would one go about adding a submenu item to the windows explorer context menu (like for example 7-Zip does) for a Java application?
I am aware of two ways to do it. The fancy way is to write a windows shell extension, which is how powerarchiver, winzip etc do it I believe (this involves running code to determine what the context menu items will be dependent on the file chosen).
The simple way, for simple functionality, is you can add an entry in the registry :
HKEY_CLASSES_ROOT\<file type>\shell\<display text>\command
Where <file type> is the files that this context menu should apply to i.e. *, .mdb, .doc
and
<display text> what you want to show in the context menu.
Then add the default string as a path to the application you want to launch from the context menu, and you can use %1 to refer to the currently selected file i.e. for MS Access I use :
HKEY_CLASSES_ROOT\*\shell\MS Access 2000\command
"C:\Program Files\Microsoft Office\Office\MSACCESS.EXE" "%1"
This then adds a context menu item for any file I select (hence the *), which allows me to launch it in MS Access 2000.
Of course, always back up your registry before hacking it.
Your program could do this during install, or on first run.
You could also package the java program in an installer like NSIS and you could use NSIS script to generate explorer context menu
To manually show the memory usage widget on Netbeans Platform, I have to right click on the toolbar and then select Memory.
Is there a way to get the memory usage widget to be shown on start up as default? Such that it will be displayed on startup without user input.
It appears that this setting is saved in the User's directory, where their Netbeans preferences are saved. This wouldn't be a "deployable" solution but the following shows you where the setting is stored http://wiki.netbeans.org/FaqWhatIsUserdir
I verified this with Windows 7 and Netbeans 7.0.1. The file you're looking for is .netbeans/7.0/config/Toolbars/Standard.xml. Inside this you should see a line like <Toolbar name="Memory" visible="false" draggable="true" align="left"/>, make sure "visible" is set to "true", save the file, then start Netbeans.
After some reading I found that there is a property that can be set in the Core UI module.
In the package explorer:
- Important Files | XML Layer | | Toolbars | Standard
Set:<Toolbar name="Memory" visible="true">
I have just started writing my first ever Java/Android application, so forgive the total n00b question.
How do you access the the standard operating system icons such as search icon/menu icon etc? They are not in the res/drawable folder where I would expect to find them. Are they available as part of the SDK or must you download them seperately?
EDIT
Maybe you can help me further - I am getting the following error (repeated on):
[2011-09-08 19:59:47 - TweetTab] C:\Users\Dan\workspace\TweetTab\res\menu\options_menu.xml:4: error: Error: No resource found that matches the given name (at 'icon' with value '#drawable/ic_menu_search').
However, the icon is not empty, the xml looks like this:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="#+id/search"
android:icon="#drawable/ic_menu_search"
android:title="#string/search"/>
</menu>
Am I missing something?
SOLVED
I changed android:icon="#drawable/ic_menu_search" to android:icon="#android:drawable/ic_menu_search" and it could then find the icon.
You can acces them via android.R.drawable.* or in xml by #android:drawable/something.
I installed the Android SDK for Eclipse on Windows.
Now I can find all ressources under "C:\Program Files\Android\android-sdk-windows\platforms\android-9\data\res..."
try this instead:
android:src="#android:drawable/ic_menu_camera"
it is now possible to use vector assets to generate standard (or customised) icons for android.
Add 'com.android.tools.build:gradle:1.4.0-beta3' to your build.gradle file. (The stable version will be out in the coming weeks).
Add a vector asset by right-clicking res/drawable/ > New > Vector Asset. Android Studio provides a built-in viewer for you to pick your drawable.
Reference your icon like you usually do. Eg: android:icon="#drawable/ic_help_24dp"
A lot of them can be found in android.R.drawable but not all are publicly accessible
You can find the android.R.drawable images in your local SDK folder. (Tested using Android Studio 3.0)
First have a look at the docs for the names of the drawables here: https://developer.android.com/reference/android/R.drawable.html
Second either search your drive for one of those image names.png or type in the name of any of them into your Android Studio activity and right click (goto declaration) on it to view the image. Then you can also right click that image to copy the path. Then open that folder and look at all the PNG's there.
Example on windows 10: android.R.drawable.star_big_on is located in user/AppData/Local/Android/Sdk/platforms/android-25/data/res/drawable-hdpi/star_big_on.png
(Note also on windows AppData is a hidden folder so you may need to set your windows explorer to show hidden if you are clicking to open each folder)
Also if you need to see material design icons / descriptions this is a good place to look: https://material.io/icons
Someone may see this page useful for getting those icons... http://developer.android.com/design/style/iconography.html
For those of you in the Visual Studio/Xamarin Android camp, you can view and add the standard Material icons pretty easily using the following plugin:
https://marketplace.visualstudio.com/items?itemName=nikainteristi.Materialiconsgenerator
I've used it a few times in my projects.