AWT - testing existing applet - java

I need to test Java Applet written in AWT for browsers, but I don't know how to connect to existing frame/dialog/button.
Is any option to get list of existing AWT object in system, and do something with them?
I tried with FEST-AWT, but if I understand correctly, he only allow to create new objects and do things on them.

I have only written one applet in the browser with AWT. What i did was whipped up a basic XHTML document and used the "applet" tag. You put this in the same directory as your .java applet, passing it the arguement code="InitClass.class" (double check that is the right name for the arguement). From there, you compile your applet in your IDE and then open your html doc in your browser. applet tag was deprrcated in HTML4

Related

embed a Jar thats an jframe into html

I have a problem, I want to embed a Jar into my html code.
The problem is that I use JFrames and not in my java Code. If i use Applets what was an example for a solution my Programm doesnt work anymore because of diffrent error messages,their is no Problem with set Title, so I wanted to ask if their is any way to embed my Jar file into my website without making it to an Applet.

Easiest way to render HTML from String in Java

I need to render HTML page from a Java String. The String contains a full HTML page which may include CSS and Javascript. I know that some CSS/script reference may missing because I only has the html, so it's not a problem.
I have tried using JEditorPane, but it only works for very simple HTML. If it can't render, it will display nothing.
Is there any library I can use?
You can use the Desktop class. It will open the default browser of your platform.
Read the section from the Swing tutorial on How to Integrate With the Desktop Class for more information and working examples.

Show HTML mark-up in JFrame or open Browser

I am writing a Java program that creates HTML code.
What's the best/easiest possibility to have a preview of the code?
Show the code in the JFrame: How can I do this?
Open the windows browser with the created File? Is this possible?
A totally different approach?
Both are quite easy to do. Here is a page from the Java tutorial that shows how to display HTML in Swing (you'd use a file: URL to display the contents of a file.) You can display a URL in an external browser using Java 6's Desktop class:
Desktop.getDesktop().browse(new URI("file://myfile.html"));
Alternately, save the data in a file with the *.html extension and use
Desktop.getDesktop().open(new File("myfile.html"));

How can I get html content from a browser that can do the html correction and js scripting?

I need a solution for getting HTML content from a browser. As rendering in a browser, js will be ran, and if not, js won't be ran. So any html libraries like lxml, beautifulsoup and others are all not gonna work.
I've searched a project named pywebkitgtk, but it's purpose is to create a browser with a front end.
Is there any way to put a url into a "fake browser" and render it and run its all javascript and save it into a html file? I don't need any front-end, just back-end is ok.
I need to use Python or java to do that.
selenium-rc lets you drive an actual browser for your purpose, under control of any of several languages at your choice, which include both Python and Java. Check it out!
For a detailed example of use with Python, see here.

include a cpp file in jsp

i am very new to jsp... i am currently doing a project where i have to interface a card reader with my html page.
i got the card-reader code in a cpp and .h file. is there any way i can use these file with my jsp.. or do i have to recode it in java and include a .js file.
specifically, i have a text input for ID on my page. i need it to be populated with the input from card. i got the code to interact with card and extract that number in cpp program. so can i like call that function from my html page?
Why on earth you need to interface your card-reader to your JSP page. It doesn't make any sense to me, I am sorry. First understand that JSP is a Java web technology for presentation, which runs on server and spit HTML to the browser. Hence, what you get on the client is HTML.
Now, could you please elaborate what you are trying to achieve?
There are several way to do this:
You could do a system call from your jsp if your C++-code can run standalone.
You could use a Java-C++-bridge.
You could use the Java Native Interface.
You will have to look into the Java Native Interface if you want to reference C++ code from java.
For more information see the following:
Wikipedia
API Guide
Nice Guide in PDF format
A jsp renders HTML, in the part you will see in your browser you are no longer in your jsp, you are not even in your code anymore.
If you want to read a card from an HTML page you will need to ignore the fact you have jsp technology and realise its HTML technology you are using.
SO you will need an applet, some flash, some activeX or other browser technonlogy first before even trying to interface with the cpp
if you need to read from card JSP cannot help you. If you read card number otherwise and send it to JSP with POST, then you do not need any reading. What you might need is signed applet on user's side which will try to read card from card reader. Then I will advise you to use javax.card - java 1.6 has a support for reading smart cards ...
http://java.sun.com/javacard/

Categories