setNodeIcon("icons/person.png");
or
setIcon("icons/person.png");
In respectively SmartGWT TreeGrid and Tab (in TabSet) should find "person.png" in folder "icons" I guess but where should I put "icons" in the project itself?
In the JavaDoc it's also said that the default value for setNodeIcon is [SKIN]file.gif what does [SKIN] mean ?
Thanks
I don't know where you find the default value (to my sense this use of the Skin folder is for using images already in the smartgwt skin)but any way I usually put my images directly in the war in my project with subfolder related to their size.
To use the icon I simply do for example btnClear.setIcon("16/clear.png");
With war/images/16.clear.png image folders structure.
You can have a look at getSkinImgDirand do a test
Related
I want to add my app Icon to created folder instead of default folder icon.
I know i can create folder with following code.
String extr = Environment.getExternalStorageDirectory().toString();
File mFolder = new File(extr + "/My Application/Downloads");
if (!mFolder.exists()) {
mFolder.mkdirs();
}
By doing this, i'm getting following result.
but what i want is..
I have searched a lot, but no luck. can anyone help me out?
Thank you.
Directories do not have icons, and so whatever app or tool your screenshot is from is adding that. You would have to ask the developers of that app or tool what algorithm they are using to determine the icon to show.
Customization of folder icon is OS dependent.
On Windows you will use Desktop.ini file to assign a custom icon or thumbnail image to a folder. To simplify working with Desktop.ini you can use ini4j. Basically, you will need to create Desktop.ini in the folder, that you want to customize and specify path to the icon there. (Here is similar question)
On Mac OS the process is different. There are ways to access icons (for example, FileView or FileSystemView, also Quaqua). However I haven't found a way to set folder icon programmatically with Java.
Note: I assumed, that you want to add icon to arbitrary folder and not your app laucher.
After creating new directory you have to declare resource directory in your gradle file so that android studio can recognize new resource directory.
More information please refer https://developer.android.com/studio/write/add-resources
In a JavaFX application i'm developing I use several icons to style some buttons and view objects. The first icons I used were displayed and packed to the deployed files (.dmg with .app and .exe) successfully, since I had to tell Ant to include the resources folder with the icons.
When I run the project with Eclipse, all the icons and images are displayed right, but when I deploy the project, only two of them (the last two included in the last improvement) are not shown. Why could be this, since I didn't change any folder or configuration?
When I get the deployed .app, I right click on it and clicking "show package contents" I can see that not only these two icons are not packed there in /Contents/Java/Resources/, but many others that mysteriously are actually shown in the application. For now I solved this copying all the required icons there, but I can't do this with the .exe generated file, which doesn't show these 2 correct icons.
My application is a music organizer/player called Musicott, is on github so you can see all the code there. The two icons are the slider thumb used to visualize and move through a track; and the default cover image for tracks that doesn't have one.
In this image you can see the problem better http://i.stack.imgur.com/8aVcz.png
Code where I set the default cover image at /com/musicott/view/RootLayoutController.java lines 503-506
Code where I set the default cover image in the play queue list at
/com/musicott/view/PlayQueueController.javalines 98-101
Code where I set the slider thumb icon in
/com/musicott/SceneManager.javalines 245-249
Thanks in advance. I will answer any doubt about the code and the project.
Nice looking project! So, as James_D pointed you are currently loading your icons with the following code:
new Image("file:resources/images/default-cover-icon.png")
new Image("file:resources/images/default-cover-icon.png", 45, 45, true, true));
The problem is that when you pack your application the "file" protocol is no longer valid (remember you are sending a URL to the Image constructor). You could send instead an InputStream (you can get one from the current Class), see this sample code:
new Image(RootLayoutController.class.getResourceAsStream("images/default-cover-icon.png"));
Now, if you use the code exactly like that you will need to make sure (after building the jar) that the "images" folder ends up inside the "com/musicott/view/" folder (since the RootLayoutController class is inside that package), so you will have to add the two extra "com" and "musicott" folders inside your current "resources" folders and move the "images" folder there.. you will probably need to add this in your pom.xml file too (to make sure you export the resources since I think maven will only export by default the "resources" folder located at "src/main/resources"):
<resource>
<directory>resources</directory>
</resource>
Note that if you want to keep your current folder structure (without creating the "com/musicott/view" folders inside the "resources" folder) you can change the path in the getResourceAsStream() call to "/images/default-cover-icon.png" (slash at the start of the string) to indicate that the images folder will be at the root.
Keep up the good work!
How to set the images in background of shell using relative path. I have image which resides in folder "res". I am adding screen shot here, just you to have better understanding of 'directory structure' as well as my question(in case if it seemed little ambiguous to you). Any suggestion and help will be appreciated.
The SplashWindow.jpg is placed next to the class notDltNow which you specify as the reference for relative paths, so you can simply write:
shell.setBackgroundImage(SWTResourceManager.getImage(
notDltNow.class, "SplashWindow.jpg"));
It is also a good idea to put resources inside the src folder so when you export your code e.g. into a jar, the resources will also be exported and still available to the code without additional hassle.
In order to read your images from resources folder, you need to :
add res folder to classpath
locate file absolutely, i.e. "/res/SplashWindow.jpg"
Hope this helps
I want to add some Translations to my Theme to call it with #language("key") in my template.vm files.
After googling around I have still no clue where to place the Language.properties files.
Is it even possible to add Translations to a Theme? If so where I have to place these files?
Thx in advance - Florian
Create a hook to override the language files.
Refer Overriding language in below link
It is very simple.. Add your "custom-key" on portal-impl.jar file for the language specific properties files.
You could able to find language properties at portal-impl.jar\content\Language.properties.
On .vm file add #language("custom-key").
Restart the server.
Thanks & Regards,
Thiyagu.L
Please check this image and hope it is helpful for you
In words create a folder docroot/WEB-INF/src folder this three are not different folder if you see in your project in your package explorer then this is the first folder inside your project.
Thanks and regards
asif aftab
In my drawable folders i have my icon image, and when testing i use it as a temp picture. I added 2 other images and a XML file and when ever the app loads the imageviews with the icon set to it has different images..
this is what it is meant to be be..
but this is what it is when i add other images to the drawable folder
And no, the names of the files are not the same.
The icon is called 'icon.png' - thats what it should be
instead it is 'ic_menu_compose.png' - a completely different name.
Also the files i'm adding are called:
'buttonnormal.png'
'buttonclicked.png'
and a XML file - 'buttonselector.xml'
Even if i dont use these images any where within my app the problem still occurs.
Any help would be much appreciated. Thanks! :)
[EDIT]
Are you building your app inbetween tests?
In eclipse: Project > Build Automatically (ticked) (this regenerates your R file)
Are you referencing the image by a raw ID?
setImageResource(324234234); WRONG
setImageResource(R.drawable.blah); Right
Are you using drawable image names that are already in use by the Android system: http://androiddrawableexplorer.appspot.com/
Personally I would rename that images from "ic_menu_compose" to something like "icon_menu_compose_overwritten" just incase it is clashing and screwing up your R file.