I am trying to start an external application (java swing) and them display the java window within another java application. I can start at external application pretty easily but I can't seem to see a way of displaying it with something like a javafx pane.
There is no way you can do so only if the other app is embedded into your code that you have it's source code now you can open it inside your app in the case of swing javafx you can open them in the same app not a big deal I hope this might help you
Related
We are going to create a java standalone Desktop application. We are searching for the best solution for the presentation layer. I saw javaFX and really liked it, but I am a bit confused. Can it be used in standalone Desktop applications?
Can I use javaFX in my standalone Desktop app and also use css to style the Ui?
It is perfectly possible to use JavaFX in a standalone Desktop app and apply CSS styling to it.
In JavaFX's lingo, this is know as a "Standalone" or "Self-Contained" deployment.
You can even integrate it with Swing or SWT, if the need arises. Note, though, that it's not possible the other way round.
When a help topic is clicked on an OSX app's Help menu the so-called Help Viewer loads with the relevant page shown.
How can this be achieved by a Java Swing app?
Traditionally like this:
Application.getApplication().openHelpViewer();
where Application is in com.apple.eawt. To make it work properly the whole application will have to be jarred up and embedded appropriately in an .app structure with the help documents in the right place. The Jarbundler ant task will do this for you.
I am currently working on a research project for a University in which I am doing GUI interactions with my database and launching an external program based on the data. I'm using runtime commands (once the OS is detected) to launch that external program with the selected data.
My question is how can I embed an external program's GUI inside a Java frame, if that is even remotely possible?
Given the clarifying comments on the question, the short answer is "no, you can't do that".
Java cannot display a native program's GUI within a JFrame, even if the target program was actually architected to allow it's GUI to be presented within another program's frame.
Are you using a console application? You have to intercept its stdout to do it correctly. So you can show the text that the 3rd party application is outputting in an UI control that you can put into JFrame.
It depends from the application you want to embed to the JFrame, but you can try to use jawt:
https://docs.oracle.com/javase/9/docs/specs/AWT_Native_Interface.html
You will be able to get the native OS specific window handle and can draw on top of it, or can you use it as a container. Note that only HW components are supported, so you will need to add Panel/Canvas to the JFrame and then use that for your native app.
This is similar to this question:
Native JNI/JAWT Swing application runs successfully on Java 6, but fails on Java 7 (64-bit Windows 7 OS)
Use java.lang.Process or java.lang.Runtime.exec.
http://www.java-tips.org/java-se-tips/java.util/from-runtime.exec-to-processbuilder.html
I'm building a Java application using NetBeans 7.0. The app is intended for use on Windows, so I guess the tool I'm really making most use of is Java Swing (for the cool, nifty screen elements).
My question relates to NetBeans' process of creating the various project types. The application I'm building is based on the "Java Desktop Application" template (?). My problem is that there seems to be a nice load of bloat built into that, and I can't figure out how to remove most of it without blowing up the app.
As a test, I created a "Java Application"project, but this has the opposite problem -- there's absolutely nothing built into the code, and I can figure out how to add anything. Specifically, a Java Desktop Application project created in NetBeans give me the ability to directly edit the screen layout like in Visual Studio. However, a Java Application does not appear to have this capability, I have no idea how (or even if) this can be addressed.
If I could start with a no-frills Java application, and add some capability to edit its layout and control the function of the screen elements (i.e. make it a windows application, I think), that would be just about perfect.
Does anybody have a suggestion for a minimal, but functional NetBeans application start point??
Thanks,
R.
If you start with a plain Java Application then as you realize you start with a bare bones type application. To add a GUI you can add New>JFRame Form. It adds a class that extends JFrame and Netbeans will recognize that it should open it in the visual editor for you.
So I built a program in Java using swing for the interface and i didn't realize how difficult it would be to convert it to be used as an android application. Is there any way for me to easily convert or rebuilt the program to be sold in the android market place? If not can anyone point me toward any resources to help build a android.
I did the same thing awhile back. Although there is no program out there that I know of to convert it directly. The Java code and the android code are very similar. Since android doesn't use swing's UI it uses XML based UI. once you get the UI functions of the android app down your Java code can be easily imported.
I am working on converting my Java app into an android app now. Most of my classes imported with no problem.
AjaxSwing allows to convert Swing applications and use them directly on android or ipad, see http://www.creamtec.com/products/ajaxswing/solutions/java_swing_ui_on_ipad.html
What I would do is that I would build the UI in XML, then I give the items an ID and reference to it in Java, and then I'll trigger everything by button clicks so what one button does in your swing layout does the same on android. You can't copy/paste it.
swing UI was meant for desktops and pc's but for
android you have to use Xml then you can keep your java codes as they are in the various activities
then use your event handling skills to trigger them
Open the project's properties
Select Java Build Path
Select Libraries tab
From there you can Add External Jars and you can use swing layout