6

Get the image of the relative path

 3 years ago
source link: https://www.codesd.com/item/get-the-image-of-the-relative-path.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Get the image of the relative path

advertisements

In my project I have 2 packages. images - contain images and notification - contain java files

In notification/main.java I get Image object from image using this code

Image image = Toolkit.getDefaultToolkit().getImage("/images/key-16x16.png");

and I can't get image.

How can I fix this bug.


I'm using Netbeans to develop Java desktop application and I have solved my problem.

Image image = new ImageIcon(this.getClass().getResource("/images/bell-icon16.png")).getImage();

"this" is a class extends JFrame

Tags java

Related Articles

How to get the relative path of a visual studio file?

I am trying to get the path of an image file which I added in solution explorer in Visual Studio, but I couldn't get the relative path of that image. H is the file structure of my project: /BulutDepoProject /FolderIcon Folder.ico Main.cs I can get th

Get the relative path of the full path

I have to get the path excluding the relative path from the full path, say The relative path is ,C:\User\Documents\ fullpath ,C:\User\Documents\Test\Folder2\test.pdf I want to get only the path after the relative path i.e \Test\Folder2\test.pdf how c

How to get the relative path of UriInfo

I'm working with JAX-RS in Java. I need to get from the UriInfo the relative path of the URI, i.e. the URI without the scheme and authority parts but with path and query parameters. What is the best way to do it? String sourceUrl = "http://www.exampl

How to get the relative path of the file to a folder using java

Possible Duplicate: How to construct a relative path in Java from two absolute paths (or URLs)? using java, is there method to return the relative path of a file to a given folder?There's no method included with Java to do what you want. Perhaps ther

How to get the relative path as a string of an image file in the same project folder?

please Don't degrade a question champs !! Thanks for watching !! I want to get relative path for the "Tulips.jpg"(src/resource). Do I need to keep these file in webcontent? Please help me to find out. One way -// `private static final String FIL

How do I get the relative path of a project from another project in the same solution?

I have two projects in my solution. I need to get relative path to the image file from first project in second project. How could I do this? Already tried code from this resource : I reference ProjectB from ProjectA and use this (in ProjectA): @"/Pro

Get the relative path of the file?

I have a file called settings.xml located at: c:\solution1\solution1\data\settings.xml Right now, I am doing: XDocument doc = XDocument.Load(@"c:\solution1\solution1\settings.xml"); I can't figure how to do it with a relative path.If you mean re

Get the relative path of RegistryKey

I have a System.Win32.RegistryKey object that points to, for example, "HKCU\Software\Test". The .Name property is populated with the absolute path. Is there a way to get only the current (relative) key name? In the example above, I am looking fo

how to get the relative path of a resource in a j2ee project

I have a Dynamic Web Project having a flat file (or say text file). I have created a servlet in which I need to use this file. My code is as following: protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletExcep

How do I get the relative path of ASP.NET content

Doing a project between multiple people, and a few components (web app, services app and some others). We will be storing some information inside the Content folder of the web app so it can be accessed directly from the web server with an href, howev

how to get an image from a relative path

i am working in asp .net mvc3. i want to get a image which exist in this location in my project G:\projects\CalcoWoms\CalcoWOMS\Content\pictures\calcologo.png CalcoWOMS is my project name. i want to fetch this calcologo.png in following line please c

Get the relative path of the XML file located in another project, but the same solution

I have found many Articles and Questions about finding an XML file but all of them are for Same Project. Suppose I have my Project structure as shown below: ABC <------ Solution |--ABC.Data <------ Project | |--XMLFiles <-------Folder | |--AA.xml

When developing the eclipse plugin, can I get the absolute path of jar files using & ldquo; Add Jars & rdquo;

I'm writing an eclipse plugin. In the plugin, I wrote a function which can make a command string for me. The string contains "-cp jar_path". The jar path is configured from eclipse "add jars" button(In the property config of a project,

Find the relative path of the Java application

I have read all the other questions related to this in StackOverflow and I did not find any clear response. To cut it short, I have an application that will store some files in a directory that I will use than to process them. I have intentions of mo

Android captures the image and get the real path

I want to create an application that takes picture/video and send it to my FTP server. Here is my onActivityResult code; @Override protected void onActivityResult(int requestCode, int resultCode,final Intent data) { super.onActivityResult(requestCode

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK