I am currently completely stuck with the following problem: I want an GUI with a cotrol panel at the right to type in some program parameters that should be used to draw multiple lines onto a graphic panel at the left side of my GUI. My approach was to use the Form Designer to arrange the Layout with all the Buttons, Lables and TextFields. Than I created a Class "GraphicPanel" that extends JPanel and I overrided the PaintComponent method of this class in order to draw the lines.
Now I want to add this custom created component via the form Designer to my UI. But when I try this via the Non-Palette-Component option: nothing happens and the component is not even shown in the hierarchy-tree. I have already serached the web for solutions and found that my class needs to be compiled and the ReloadCustomComponents-Button must be clicked after inserting custom stuff. My class is compiled but the ReloadCustomComponents-Button is not shown up in the UI-Designer Toolbar. I tried to configure the toolbar manually - and in the configuration setup Intellij is also listing the Button as a displayed icon - but it is not there when I apply the configuration. Did anyone had the same problem or does anyone have any suggestions what I can try or what else I can check out? I am actually wondering if this is a software bug or whether I missed something different. I am quite a beginner and especially working with UI's and Swing is new for me so I have no real idea how to go on with this. Thanks for any help!
(I am using Intellij Idea 2020.3.1 on Windows and JDK 15.0.1 and my output format for the UI-form code is set to binary class files)
UI component classes used in the UI Designer palette must be compiled for the same or lower Java target version as is used to run IntelliJ IDEA. IDE JDK version is available in Help | About dialog and is 11 for 2020.x IDE versions.
Change the target JDK version to 11 so that IDE can load the component classes. See this answer for the relevant places where JDK language levels are configured.
Related
I am trying to write a plugin for the Universal Gcode Sender (https://winder.github.io/ugs_website/), but when I try to create a JPanel in any directory except my module's main project directory and try to use the Design tab, it just shows the text "Loading..." and I can't do anything in the Design tab. This also happens when I create a new Netbeans Project and try to make a JPanel there.
I don't think this is because of an issue with UGS, rather a Netbeans issue or something.
I literally haven't been able to write any code because the first thing I need to do is make sure I can use the Design tab. Netbeans is entirely stock, I haven't changed anything to cause this.
I have tried multiple re installations of Netbeans and various other solutions. Nothing has worked.
I appreciate any help you can give. If I am missing any important info please tell me and I will supply it.
I am trying to add keyboard shortcuts to an existing Java app. The relevant part is as follows:
public final class Main{
...
private MyKeyEventDispatcher keyDispatcher; /*implements KeyEventDispatcher*/
...
KeyboardFocusManager manager =KeyboardFocusManager.getCurrentKeyboardFocusManager();
keyDispatcher = new MyKeyEventDispatcher(this);
manager.addKeyEventDispatcher(keyDispatcher);
viewer = makeJViewer(); /*an extension of JPanel, which shows a video stream.*/
...
}
Now, the keyboard focus system works as one would expect with the software rendering. However, since the addition of GL rendering support, the behaviour is different. Upon starting the program, keyboard manager works fine. child objest of Main have the focus and the focus manager behaves as defined in Main. When I click on the stream-video button however, ie. when internal JPanels inside Jviewer are rendererred for the first time, although the same buttons and Panels keep the focus, the keyboard manager suddenly stop working. I will have to click on the Jviewer or the gui tools such as buttons, etc. or Tab-out and then tab-in the program for the keyboard to work again. After that, it works fine. Also, this only happens the first time a stream is loaded.
I should also say that this behaviour only occurs with my windows machine and the linux machine handles the same (maven) build just fine. What is interesting, is that if I run the same program in the IntelliJ build environment with JDK java 1.6.0.39, it also works fine in windows.
My questions are:
What is causing the problem? Is the Jviewer somehow not "revalidated" after the rendering of those internal stream JPanels?
Why does the same build work in Windows and not in linux? Something to do with LookAndFeel?
On Windows, Why does the IntelliJ build work fine and the Maven build doesn't? They do seem to have different set of paths for looking up libraries, etc.
How does the focus subsystem decide on the KeyboardFocusManager to use? Is there anything like: getCurrentKeyboardFocusManager().isItBlank() or any way of checking its content programmatically?
Unfortunately the project is fairly modular and I can't define the action for the keyboard shortcuts in my "swing package" as my "Main" package imports "Swing" and Java doesn't like circular dependency; if it wasn't I could define keyboard manager for each child object, including Jviewer individually, but I can't! Is there a property to set so that all the Components in a given window would use the same KeyboardFocusManager?
FYI, Maven version: 3.2.5 and uses same Java JDK as my IDE.
The focus manager issue can be resolved by clearing the global focus owner:
KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner();
I've been trying develop my custom plugin for Eclipse, and basically I want to make is a "richer" version on the current TextHover. I don't know what widget(?) Eclipse uses to display the hovering text, but I want to use something different, like SWT Image or SWT Browser.
Most of the tutorials that I've read suggest that I have to implement my own Java Editor to do this, but I don't want the user to switch to my custom editor just for a simple feature (and I don't want to implement a whole editor).
Some Tests:
I've already created two Eclipse Plugin Projects. The first one is a extension for the JavaEditorTextHovers, and with this project I managed to show some custom Strings when hovering some random texts, but wasn't able to change the hover appearance. The second project was a editor plugin. With this last one I managed to get a Browser to appear when hovering a random text(this tutorial helped me), but again, this editor had nothing, no syntax coloring, no rules, etc., and for the previous reasons, I couldn't accept this has a solution.
Maybe if there was way to change the (or set a new) SourceViewerConfiguration of the current editor I could pass my custom SourceViewerConfiguration, but I'm not sure if this is possible.
I recently tried to open a JPanel form that I created with NetBeans GUI Builder and NetBeans almost freezes up on me. The design form is an all-gray background, not the usual gray area where I can place components surrounded by a white background. If I click on the Source button and then switch back to Design view, all of the tabs in the editor pane disappear.
Fortunately I am using Git for version control. The last commit of this file was over a week ago. I might have to revert to an earlier version to see where this problem was introduced. In the mean time, does anyone have any idea what could cause this behavior? Is it possible that my .form file is corrupted? The application compiles and runs just fine.
It sounds like Netbeans can't load the form due to some internal error. This can sometimes be fixed by doing a clean & build to clear out any old cached data.
If that doesn't work, you can check out the "message.log" for the error...and yes, I wish it would display it on the screen
Off memory it use to be in "{user.profile}/.Netbeans/{version}/var/log" (I think). It got moved on Windows under 7.2 to "{user.profile}\AppData\Roaming\NetBeans\7.2\var\log"
I need to get the name of class that represents the Java SWT/JFace UI component which is currently displayed and highlighted by mouse cursor.
For example, i wish to get something like "org.eclipse.swt.widgets.Table" when my cursor is pointing to any displayed SWT Table control, etc.
Tell me, is there a plugin for Eclipse IDE, or any another utility, which allows to do this?
In this way I want to simplify the process of writing UI-tests for Eclipse-RCP plugin project. Searching for class name and path manually anytime when this needed is very discouraging.
Get hold of the current display Display.getDefault() and call getCursorControl(), once you have the Control call control.getClass().getName().
Install SWT Spy: http://www.eclipse.org/swt/tools.php
SWT Spy is the correct tool to use. However, the mentioned page is not updated.
From Eclipse 4.7 SWT Spy is included in Eclipse PDE. So you can get it by downloading the Eclipse for RCP and RAP.
To launch SWT Spy, press: CTRL + ALT + SHIFT + F9
In case of doubts, please see: http://www.vogella.com/tutorials/EclipseCodeAccess/article.html#swt-spy