Inserting Image and clicking to a link

1)Create a project “myApps”

2)Within the project create the “JFrame form”.Name it as “insertpic”.

3)Go to “design view “.Drag the “login”  palatte into your frame.(pic 1)

pic1

4)Right click on the label and select “properties” at the  last.New window will be open.(pic2)

pic2

5)Select properties.”GO to icons”.Select the  “external image”.Select a picture from your system Click ok.And adjust the picture on the        frame.(pic3)

pic3

6)Drag one more “label” and right click on it and “Edit text”.Click here.(pic4)

pic4

7)Same way change variable name as “pic”.

8)Right click on the “label” and select “event” then “mouse” (Select mouseClicked) .As directed in the picture.(pic5)

pic5

9)The present view is called “Source” for the frame.

10)Write the following code in the “picMouseClicked()” for including the respective header files.


URI url = null;
try {
url = new URI("https://javanotebook.wordpress.com/");</code>

} catch (URISyntaxException ex) {
Logger.getLogger(insertPicture.class.getName()).log(Level.SEVERE, null, ex);
}
Desktop desktop = Desktop.getDesktop();
try {
desktop.browse(url);
} catch (IOException ex) {
Logger.getLogger(insertPicture.class.getName()).log(Level.SEVERE, null, ex);
}

11)now your Application is ready to work .Right click on the File .select run file.(pic 6)

pic6

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s