Jump to content

Calling All .. Java Applet Doubt


Recommended Posts

Posted

Applet lo image display cheyalaaa ..... dhaniki intha pedda thadu aaa ..... :3D_Smiles_153: :3D_Smiles_153:

Posted

inthaku solution vochinaa ledhaaa??????

lekapothy ..... simple gaaa chepali anteeee nee image relative classpath lo undali starting from root folder (eclipse aithy src folder) ..... drop your image in src folder and use getImage() (getImage(getCodeBase(), "[color=#008800][size=2][background=rgb(248, 248, 248)]sample_image.jpeg[/background][/size][/color]") ;) method from applet to load the image.....


if u r placing u r image inside package ..... then use ./yourpackage/sample_image.jpeg in getImage()method

Posted

[quote name='BENDU_APPARAO' timestamp='1361848376' post='1303329595']
Applet lo image display cheyalaaa ..... dhaniki intha pedda thadu aaa ..... :3D_Smiles_153: :3D_Smiles_153:
[/quote]
em chestha .. kotha ga nerchukuntunna applets ... :-|

[quote name='BENDU_APPARAO' timestamp='1361848831' post='1303329626']
inthaku solution vochinaa ledhaaa??????

lekapothy ..... simple gaaa chepali anteeee nee image relative classpath lo undali starting from root folder (eclipse aithy src folder) ..... drop your image in src folder and use getImage() (getImage(getCodeBase(), "[color=#008800][size=2][background=rgb(248, 248, 248)]sample_image.jpeg[/background][/size][/color]") ;) method from applet to load the image.....


if u r placing u r image package ..... then user ./yourpackage/sample_image.jpeg in getImage()method
[/quote]

ya already solved .. !

but eclipse use chesthunte .. class path wil be bin folder(not src folder) .. right ?
thank you anyways .. :)

Posted

[quote name='innovative' timestamp='1361849065' post='1303329634']
em chestha .. kotha ga nerchukuntunna applets ... :-|



ya already solved .. !

but eclipse use chesthunte .. class path wil be bin folder(not src folder) .. right ?
thank you anyways .. :)
[/quote]

NO Bin is not classpath , its class generation folder ...... by default eclipse put this folder in to classpath


below us your working class , this should work now ... put your image inside LearningApplets folder ( under src folder not bin :) )




package LearningApplets;
import java.applet.*;
import java.awt.*;
import java.net.URL;
public class basicapplet extends Applet
{
Image picc;
public void init()
{
URL url = getCodeBase();
picc = getImage(url,"./LearningApplets/sample_image.jpeg");

}
public void paint (Graphics g)
{
if(picc!=null)
{
g.drawImage(picc, 100, 100, this);
}
}
}

  • Upvote 1
×
×
  • Create New...