www.webdeveloper.com
Results 1 to 2 of 2

Thread: images in layout?

  1. #1
    Join Date
    Jul 2006
    Posts
    9

    images in layout?

    hi every1

    is it possible to add images to a layout in java? and then add a link to that image?

    thanks in advance

  2. #2
    Join Date
    May 2007
    Location
    Sweden
    Posts
    123
    Something like this would work:
    Code:
    JLabel myImage = new JLabel(new ImageIcon("someImage.jpg"));
    myImage.addMouseListener(new MouseAdapter(){
         public void mouseClicked(MouseEvent evt){
              try{
                   // run Internet Explorer, or any other program, to open a web adress
                   Process p = Runtime.getRuntime().exec("C:\\Program\\Internet Explorer\\IEXPLORE.EXE"+
                        "http://www.google.com"));
              }catch(IOException e){
                   System.err.println(e);
              }
         }
    });
    Then add your image like this:
    Code:
    myComponent.add(myImage);

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles