UI for a java lib - java

I have a java library that generates a report given some simple input parameters. Currently its a console app. I wanted to create an extremely simple UI for this. What is the quickest way to achieve this ? Are there alternatives other than embedding this library in an application server and then creating a web server that will call it to get the results.

If you are using Eclipse, you can use SWT, WindowBuilder plugins.
http://www.eclipse.org/windowbuilder/
http://www.eclipse.org/swt/

Why a web server? Creating simple GUI with Java's swing is simple enough, and it'll allow you to use the library directly.
Another option is to write a simple GUI application that'll run the console application you already have. If you are using Windows I recommend using HTA for the GUI, and WScript.Shell.Run for running the console application. If you are using Linux, you might want to check out node-webkit and use the child_process module for running the console application.

Related

Can Processing code in java run outside of the processing ide as a gui application?

I am talking about p5.js equivalent in java called Processing using which i can program a lot of graphical elements and it has event handling capabilities.
I have written my java code inside the processin ide . But i want this to work as a standalone gui application. Is this doable ? If so how ?
Yes, the easiest way is to use Menu->File->Export-Application from the Processing app to generate a stand-alone executable for your platform.

Running my swing program on a browser

I'm doing my academic project currently. Its based on swings and awt. I am running it in command prompt. Is there any possibility for me to run it on a browser
In order to run a Java application in a browser, you need to make it (or wrap it) in an Applet. A Swing application is actually usually designed as a desktop application (meaning, standalone). Applets tend to be pretty resource-intensive for your user.
You should create an applet probably, that could run in a browser.
An applet can have GUI part too similar to a desktop GUI app.
The GUI of the applet can be based on Swing or AWT.
See also:
http://docs.oracle.com/javase/7/docs/api/java/applet/Applet.html
Take a look at Java Web Start which will allow you to deploy your application as is without any redevelopment of the code.
The First Suggestion is to use Applets. If that is not confortable for you and if you have a simple Swing application, I would recommend that you look at AjaxSwing
I onced used it on a simple Application and it works.
Webstart is another Way to go. You have Options to take, pick the one that works best for you.

java desktop app gui in html5/JS

can I create Gui in html5/JS for the desktop java application. If yes, what tools I need and how would I connect GUI with java code?
Possible - but not entirely sure why you'd want to do that.
Your main options would be:
Have the Java application act as a local web server and connect to it with a browser. Would be a wierd design but fairly easy to make it work. It's essentially the same as you would do if you had a remote Java web server so the components are pretty standard - you could use a toolkit like Vaadin for example.
Run JavaScript within a Java hosted environment / embedded browser. Should be possible with Rhino - though I must admit I haven't ever seen this approach used to build a desktop GUI
The first option in particular might make sense if you were considering using the application remotely at some point in the future.
Overall though, I'm still not sure if this is a good idea. The JavaScript web frameworks still aren't IMHO as good as the native Java ones (SWT, Swing or JavaFX) for building local desktop application GUIs.

How to have a Java application get the latest version of itself?

I would like to make an update finder, so to speak. The client application would send a request to the server, get the latest version, and return it to the user in the form of a prompt:
There is a new update, X.x. Would you like to update?
Something of that nature. How would I go about doing this?
Also, if possible, please don't suggest API's unless it is either really necessary or it would be really hard for a beginner to understand. I would like to keep my project working with core Java packages.
Have you looked at Java Web Start?
Updates to a Java Web Start application are automatically downloaded when the application is run standalone from the user's desktop.
http://docs.oracle.com/javase/tutorial/deployment/webstart/
One way to do this easily in Java is to use Java Web Start.

Code generation between JSP <-> Swing

Is there any tool that can convert already programmed Swing J2SE into JSP J2EE shell?.
Thanks!
No, there is no such tool. Although you might found some attempts to do it, desktop and WEB paradigms are way too different to have a tool that converts between between them properly.
If you absolutely must run your APP on a WEB environment, you might find easier to convert your Swing application into a Web Applet. It's not the same though. An Applet is basically a Swing application running inside a browser. Not a WEB-WEB application.

Categories