|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
||||
|
||||
|
loading image in a class?
can you create/load image in a class and how?
for example class Myclass{ Image image; public Myclass(){ URL codeBase=getCodeBase(); image=getImage(codeBase,"image.jpg"); } } why wont this work? Thanks for any help. |
|
#2
|
|||
|
|||
|
the code wont work b'cos "getCodeBase()" function belongs to the applet class...the code for loadin the image is
URL codeBase= new URL("file://c:/filepath/filename"); image=getImage(codeBase,"image.jpg"); try this it will work.... |
|
#3
|
|||
|
|||
|
In an application you may use the following to load an image into a class:
Image image = Toolkit.getDefaultToolkit ().getImage ("your_picture.gif"); |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Java Help > loading image in a class? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|