A very basic applet / swing requirement
As I'm not much into client side programming, I request for help.
Use case: A html file has as an applet/swing component which has a single line edit box which takes url to a file and a submit button. If button is clicked, program must read file specified as input and display as html file in a new browser window.
Requirement: Using Java 1.5, how to display that input file in html format (.ht开发者_JAVA百科ml) in a new browser window?
Please help. Thanks much in advance!
I think you can just upload that file to a server and after a submit - redirect to that file.
Swing components can actually render simple HTML:
How to Use HTML in Swing Components
I am not going to give you all of the code to read in the files and pass it to swing components. But it should not be hard to read the file, create a JFrame and add a JPanel with the HTML you want to render to it. The examples above get you most of the way there other than reading the file.
精彩评论