Solved

Open browser frame on double click

Posted on 2007-12-01
10
153 Views
Last Modified: 2010-03-30
Hi,

I'm displaying images loaded from  a local folder in an applet. Is there any way in java to open a new broswer window to display the image using html? I guess the steps would look something like:

1) Handle double clikc in applet (no problem)
2) Create a new browser frame (don't know how to do this)
3) Give the browser a string of source html to render, something like:

     String str = "<html><img src = test.jpb></html>
     BrowserWindow win = new BrowserWindow;
     win.SetHtml(str);
     win.Show();

Yeah hopefully there is something like that!

Thanks
0
Comment
Question by:DJ_AM_Juicebox
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
10 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 20388585
You could try

Runtime.exec("cmd.exe start /c " + absolutePathToImage);

for a Windows-only solution
0
 

Author Comment

by:DJ_AM_Juicebox
ID: 20388675
Ah I don't think that will work for me - the applet is being run on a webpage on a server dislaying images local on the server.
0
 

Author Comment

by:DJ_AM_Juicebox
ID: 20388823
This works:

try
            {
                java.applet.AppletContext a = getAppletContext();
                java.net.URL url = new java.net.URL("http://www.cnn.com");
                a.showDocument(url, "_blank");
            }
            catch (java.net.MalformedURLException ex)
            {
                System.out.println(ex.getMessage());
            }

but is there a way to instead of moving the user to a predefined URL, just created the html code yourself? I need to just display an image in a frame so the user can download it, like:

new URL_Code("<html><imgsrc = "hello.jpg"></html>

Thanks
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 20389427
You would achieve that using javascript to write the required html to the page.
0
 

Author Comment

by:DJ_AM_Juicebox
ID: 20389592
But doesn't that require some java applet to javascript plugin? Where do I start?

Thanks
0
 
LVL 92

Expert Comment

by:objects
ID: 20389642
0
 

Author Comment

by:DJ_AM_Juicebox
ID: 20389714
Arghh I guess I could do it but then I need an external dependency in the html page...
0
 
LVL 92

Expert Comment

by:objects
ID: 20389745
theres no other way really
0
 
LVL 92

Expert Comment

by:objects
ID: 20389780
perhaps you could have a html page that allowed you to pass the image path to display as a parameter (again using javascript) and load that.
or you'd need to dynamically generate the html on the server using jsp or similiar
0
 

Author Comment

by:DJ_AM_Juicebox
ID: 20392603
blast, I was hoping java would be better suited for web development stuff.

I'm starting to think I should just do this in javascript!

Thanks
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
difference between sorce folder and folder in eclipise 3 64
servlet and mdb, jms error 1 81
hashmap order 17 62
listing all the respondents to a twitter feed - Java 5 47
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question