Results 1 to 6 of 6
- 09-04-2008, 11:53 PM #1
Member
- Join Date
- Sep 2008
- Posts
- 32
- Rep Power
- 0
Already import the resources but images are missing
Hi,
I am very new to java and just joined this group.
In my existing project every thing is running yesterday,but in the morning I messed up something.Still project is running but not displaying any image.
All the images are there actual place.
Please help me to figure it out the problem.
Thanks
- 09-05-2008, 12:18 AM #2
Show your image–loading code.
- 09-05-2008, 04:17 PM #3
Member
- Join Date
- Sep 2008
- Posts
- 32
- Rep Power
- 0
Hi,
ReturnMainCRVM.setName( "ReturnMainCRVM" );
add( ReturnMainCRVM );
ReturnMainCRVM.setVisible( true );
ReturnMainCRVM.setEnabled( true );
ReturnMainCRVM.setRequestFocusEnabled( true );
ReturnMainCRVM.setTabOrder( 2 );
//unsup ReturnMainCRVM.FontUnderline = false;
ReturnMainCRVM.setToolTipText( "Return" );
//unsup ReturnMainCRVM.HelpContextID = 0;
ReturnMainCRVM.setText( "" );
ReturnMainCRVM.setDefaultButton( false );
//unsup ReturnMainCRVM.Cancel = false;
ReturnMainCRVM.setIcon( new ImageIcon("resources/CRVMApp_ReturnMainCRVM_Picture.jpg") );
ReturnMainCRVM.setLocation( 1024, 680 );
ReturnMainCRVM.setSize( 104, 28 );
ReturnMainCRVM.setFont( new Font("SansSerif", Font.PLAIN, 11) );
I guess you are talking about this section of code.If not please ask me again.
Thanks
- 09-05-2008, 05:06 PM #4new ImageIcon("resources/CRVMApp_ReturnMainCRVM_Picture.jpg") );
Have you tested that there is an image being loaded ok by the ImageIcon class?
Now where is the code that displays the image?
What is the ReturnMainCRVM class?
- 09-05-2008, 05:24 PM #5
Member
- Join Date
- Sep 2008
- Posts
- 32
- Rep Power
- 0
Thanks for quick response.
This is the project which is running from the long time.So I guess there is not a problem with code.
I was checking what are the options in build path and clicked on some thing.After that images are goen from the project.
One more thing i need to mention that in eclipse resourse folder changed its position.Does the order matters?
- 09-05-2008, 06:09 PM #6
resourse folder changed its position.Does the order matters
Yes, it most likely does.
Why? Because you have given a specific address for the image to the ImageIcon constructor:
resources/CRVMApp_ReturnMainCRVM_Picture.jpg
This tells Java to look in the "resources" folder for the image file named "CRVMApp_ReturnMainCRVM_Picture.jpg". It expects the "resources" folder will be found in the current folder.
If you change this to the new folder address/path/location java will know where to look for the image.
Another option is to let the ClassLoader look up the image for you:
Java Code:String resource = "resources/CRVMApp_ReturnMainCRVM_Picture.jpg"; URL url = getClass().getResource(resource); // or url = getClassLoader().getResource(resource);
Similar Threads
-
profiling - execution statistics tab missing
By quitequick in forum EclipseReplies: 3Last Post: 07-29-2008, 02:38 PM -
Missing text encoding
By talgreen in forum EclipseReplies: 0Last Post: 03-30-2008, 09:14 PM -
IOExceptions and missing JavaDoc
By tim in forum NetBeansReplies: 0Last Post: 01-29-2008, 01:55 PM -
is it bug? or am i missing a point?
By blowguy in forum Threads and SynchronizationReplies: 1Last Post: 11-20-2007, 07:19 PM
Bookmarks