Showing posts with label eclipse. Show all posts
Showing posts with label eclipse. Show all posts

Tuesday, March 11, 2014

How to set Image to JPanel in java

How to set image in JPanel or Panel in java Applet using Eclipse



For carrying out the most simplest way to add image in a JPanel in java applet follow the below steps :

1.Save the Image in bin folder, where your Project is stored in Workspace.

2.Confirm and check the exact type of Image file for Example it can be .jpg or .jpeg or so on...

3.Open your notepad or if you're using java eclipse or any other java working environment.

4.You need to include basic two packages i.e."  java.awt.*;  " and " javax.swing.*; ".

5.extend the JApplet class to get the GUI.

6.You need to declare, initialize and add JLabel. Here JLabel will contain image and this JLabel will be added to a JPanel. Now here JPanel is initialized and added to a container , which is on JApplet.



Sunday, December 22, 2013

How to Create a Basic Java Applet in Eclipse

Creating an Applet in eclipse does not need any HTML code in extra. Eclipse serves for this type of services to create and play a applet in eclipse.
To create an Applet we basically need two packages i.e.
java.applet.*; 
java.awt.*;
This above packages are imported into the Program.