Running SWT from a RCP app - java

Can I run my swt code in a rcp application, when I am running in swt it works fine when trying to do so from rcp app getting:
Exception in thread "main" java.lang.IllegalArgumentException: Argument cannot be null
at org.eclipse.swt.SWT.error(SWT.java:4263)

Eclipse is based on SWT so you can re-use your code. But you cannot reuse your GUI. You have to create a View instead. Try to google for an example, there are many.

You have to define a view in plugin.xml first then you can re-use your SWT code with very little modification.

Related

Embedding external applications into fxml

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

Is it possible to use SWT on Android-Studio or IntelliJ?

I've used Android-Studio for a long time, and I got used to it over Eclipse.
I wish to create an SWT app for PCs (windows, Linux, macOs) , and use a nice UI mechanism like Window-Builder that used to exist for Eclipse.
Is it a possible thing to do on Android-Studio or IntelliJ ?
If so, how?
There is no visual UI editor like WindowBuilder to create SWT UIs in IntelliJ.
But you certainly can create SWT applications with IntelliJ or any other non-Eclipse IDE for that matter. In my opinion, UI designer are overrated and UIs can be equally well implemented by hand. Thus if you are willing implement the UI in code you simply need to get a copy of the SWT library and you are set.
If you follow the redirects from this question it will guide you to maven artifacts of SWT:
maven project: SWT 3.5 dependency: any official public repo?
Note that SWT comes with a native part that might make extra settings necessary to launch your application.

How to launch swing app with jetbrains layouts in Netbeans

I've created app in IDEA with some swing layouts. I want to launch it in Netbeans in order to profile. But I get:
Exception in thread "main" java.awt.IllegalComponentStateException: contentPane cannot be set to null.
at javax.swing.JRootPane.setContentPane(JRootPane.java:603)
at javax.swing.JDialog.setContentPane(JDialog.java:991)
at TransTest.<init>(TransTest.java:44)
at TransTest.main(TransTest.java:284)
What files etc I should supply in order to run it?
As can be read on the UI designer webpage
Unique Byte-code instrumentation techniques allow you to get rid of complicated Swing code in your Java sources. IntelliJ IDEA's GUI-compiler transparently generates all necessary code needed to create and lay out form components. The GUI-compiler has been integrated into IntelliJ IDEA's make functionality, and is also available as a separate Ant task delivered together with the IntelliJ IDEA distribution. There is also an option to generate Java source code instead of using the byte-code instrumentation approach.
So generate Java source code and use that in NetBeans, or simply hand-code your layouts rather then using a UI designer.

Netbeans Project Types

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.

How can I use a GUI debugger on the Prolog code that runs inside a Java app through JPL?

I'm developing a Java+Prolog application through the JPL bridge. The main application is in Java and it calls the Prolog code using Query.oneSolution("doPrologStuff(here)")
I tried running the GUI debugger/tracer using Query.hasSolution("gtrace") but it throws an exception:
Exception in thread "main" jpl.PrologException: PrologException: error(existence_error(procedure, /(gtrace, 0)), context(:(system, /('$c_call_prolog', 0)), _0))
at jpl.Query.get1(Query.java:336)
...
(Same goes for "guitracer")
Calling gtrace. works well when I run the Prolog code in swipl directly.
When I try Query.hasSolution("trace") it lets me debug the code using the text console, but that's not what I'm looking for. Any ideas how to enable the GUI debugger?
I'm using Eclipse on Ubuntu to develop, but I can try other tools if that helps :)
You need to attach Prolog's graphical environment (xpce). You can do that by loading
the file swi('swipl.rc'). The next question is whether or not event dispatching happens.
That depends on the setup. If you use the latest 5.11.18/5.10.4 versions, you can set the
Prolog flag xpce_threaded to true, which causes SWI-Prolog to run the development tools
in their own thread (currently only works on Unix/Linux systems).

Categories

Resources