embed a Jar thats an jframe into html - java

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.

Related

Java File Doesn't Load in Joomla Site

I am a total newbie in webdesign and I have created a site using the Joomla CMS. However, on a particular page within the site I am trying to launch an interactive calculator that uses java via .class files which are called by an .html file. I used the embedding tag:
<embed src="images/Calculator/classes/examples/PayeCalc.html"
type="application/x-java-applet"
width="1108" height="407">
Nothing shows up on the page however, when I preview it. What am I doing wrong? The .class files are saved in the folder that the .html file is located. Isn't it supposed to call up the files as needed? Why is the page just blank? Can anyone help this newbie to resolve this issue?
Thanks in advance.
Check if your text editor removes the embed tag.
It can happen from the joomla text filters or from the text editor.
Try using JCE text editor and follow the steps described here
Also if you use RSFirewall check this out
Good luck

AWT - testing existing applet

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

Java: How to pretty print .java file

I have a JTextArea, and I have this being populated with a chosen .java file, the problem is that the file is appearing as just normal text. I would like to add some pretty print so that the user will be able to see the file as if the file was open in eclipse (keywords different color, comments will be in grey... etc)
I have not been able to find any good examples online for how to do this. what would be the best way to do this?
EDIT:
I got this to finally work, i added the JSyntaxPane jar file to my classpath (jsyntaxpane-0.9.5-b29.jar to be exact) then i added the following two lines of code to get it working for my JEditorPane.
jsyntaxpane.DefaultSyntaxKit.initKit();
JEditorPane.setContentType("text/java");
This can also be used on the following languages: JavaScript, Properties, Groovy, C, C++, XML, SQL, Ruby and Python... just by simply changing text/java to text/LANGUAGE_YOU_WANT in the above code
JTextArea can only display plain text (like notepad in Windows). If you want to show pretty printed source code with colors, you need JEditorPane, which allows you to display HTML.
Now you can either generate HTML manually with syntax-highlighted Java source code or use some library.
See also
Where can I find a syntax highlighting library for Java?
JEdit-Syntax has a JEditTextArea class that will do syntax highlighting. This project was spun off to package some subcomponents of the JEdit project.

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"));

Java file upload applet - Suggestions needed

I want to build a simple file uploading applet in Java. It will be used to upload files to a regular linux web server. So if someone went to:
http://site.com/file-upload-applet
And uploaded a file there via the applet, it will be accessible at:
http://site.com/uploads/your-file.jpg
The user should be able to click 'Browse', and then look through the folders on his computer ,and be able to select as many files, or every file in a folder, if he wanted. Then, when he hits upload, he should be shown a progress bar while the files are uploaded.
Any thoughts about this, and how this could be accomplished in Java as an applet? I will just need some pointing in the right direction, such as which Libraries to use.
You'd need to have a signed applet, as unsigned applets do not have access to the filesystem.
I found an article about signed Applets.
As for the other components, you'll most likely need a JFileChooser, JProgressBar, and a JButton (that uses Apache HttpClient's PostMethod with a MultipartRequestEntity that wrape the JFileChooser's file in a FilePart).
I used the Apache Commons File Upload, and it worked like a charm. It took away most of the problems I was worried about, and was very easy to use.

Categories