Extended JPanel background/foreground properties blank dropdown instead of color chooser [message #1828341] |
Mon, 08 June 2020 02:07  |
Eclipse User |
|
|
|
Environment: latest WindowBuilder and Eclipse for Windows
I have scoured the forums and the web for what I suspect is a trivial problem, since I am somewhat of a Java noob but well versed in C# and Visual Studio.
I have a simple subclass of JPanel :
public class OzJPanel extends JPanel {
public OzJPanel() {
super(); // call base constructor
setOpaque(true);
}
}
In order to add it WindowBuilder palette I exported the package containing this to a JAR, added to JAR to WindowBuilder's palette via its Package Manager.
When selecting my extended JPanel and dropping it on a JFrame, instead of its properties showing color dialogs I get only blank combo box drop downs.
What is interesting is that if I add a simple field:
public Color fred = Color.red;
to my class, "fred" shows up in the panel's property list and automatically invokes the color chooser dialog if clicked on.
Why doesn't this work for the inherited foreground/background properties?
Thanks in advance.
|
|
|
Re: Extended JPanel background/foreground properties blank dropdown instead of color chooser [message #1828425 is a reply to message #1828341] |
Tue, 09 June 2020 14:05   |
Eclipse User |
|
|
|
Hi John !!
A few days ago I asked the same.
I extend a JButton and, when insert the extended button in any content pane, the proporties editor shows some kind of empty combo box for almost all properties.
If I add a JButton from the Swing Palette in the same content pane, the properties editor shows all properties correctly.
I test all kind of things.
Calling super method and don't in the constructor.
Implementing Serializable and don't.
Adding a few custom properties (and getters and setters) and don't.
Adding the BeanInfo and don't.
And, of course, all previous tests combined in diferent ways.
Then, I asked here...
And nothing. Nobody answer.
So, if you have any kind of response, please let me know.
This is my question: https://www.eclipse.org/forums/index.php/t/1103906/
|
|
|
|
|
Re: Extended JPanel background/foreground properties blank dropdown instead of color chooser [message #1831080 is a reply to message #1828489] |
Tue, 11 August 2020 10:52   |
Eclipse User |
|
|
|
Hi,
I am facing the same problem and I am very surprised about the few information about this problem. It looks like it is happening to nobody and I have tried also many things looking for a solution.
I have the problem also in the fields that I have created for my bean.
I am using Eclipse 2020-06 (4.16.0) with WindowBuilder 1.9.4.202002151729 (latest releases of both) over Ubuntu 20.04.
So, I decided to open a question in StackOverflow and al bug in Eclipse Bugzilla.
Hopping to have a solution soon.
Best Regards.
|
|
|
|
|
Re: Extended JPanel background/foreground properties blank dropdown instead of color chooser [message #1831125 is a reply to message #1831124] |
Wed, 12 August 2020 06:24   |
Eclipse User |
|
|
|
Hi,
Then, what I recomend you is going to Project > Properties > Java Build Path > Libraries, choose "JRE System Library" and click on "Edit...". There, configure Oracle JDK 1.8 (JavaSE-1.8) in "Execution environment".
Your Java Bean class is OzJPanel. To rebuild it, firtly make sure that Project > Build Automatically is activated and then you should go to Project > Clean..., select the project where your class is in and click on Clean.
After it, do the export process again and add your JAR to WindowBuilder's palette.
Let's see if that works for you.
Best Regards.
|
|
|
Re: Extended JPanel background/foreground properties blank dropdown instead of color chooser [message #1831174 is a reply to message #1831125] |
Thu, 13 August 2020 03:06   |
Eclipse User |
|
|
|
Roberto,
First, again, thank you.
I created a new project (TestDial2) in WindowBuilder using JFrame as my main class, using the project settings you suggested.
I can run it with an empty frame, as expected.
Then:
I also created a new OzDial2 project using the settings you suggested Oracle JDK 1.8 (JavaSE-1.8). Source:
import java.awt.Color;
import java.awt.LayoutManager;
import javax.swing.JPanel;
public class OzDialTest2 extends JPanel {
/**
*
*/
private static final long serialVersionUID = 1L;
private Color testColor = Color.BLACK;
public OzDialTest2() {
// TODO Auto-generated constructor stub
}
public OzDialTest2(LayoutManager layout) {
super(layout);
// TODO Auto-generated constructor stub
}
public OzDialTest2(boolean isDoubleBuffered) {
super(isDoubleBuffered);
// TODO Auto-generated constructor stub
}
public OzDialTest2(LayoutManager layout, boolean isDoubleBuffered) {
super(layout, isDoubleBuffered);
// TODO Auto-generated constructor stub
}
public Color getTestColor() {
return testColor;
}
public void setTestColor(Color testColor) {
this.testColor = testColor;
}
}
I exported OzDial2 to a new location, imported the .jar into TestDial2, added it to the palette manager, OzDial2 as component, but when dragging the OzDial2 to TestDial2, once again, the field testColor appears in the property pane, but with a blank/empty drop down box.
I am at a loss to explain this.
NetBeans IDE does not seem to have this issue, and all the properties being fully available.
Is this a reflection problem WindowsBuider?
Note, I am running under Windows, not Linux.
Thanks again for your insights and responses.
Can you give the ref-ids of the bug reports you have filed on Stackoverflow and Bugzilla?
Regards, Oz
[Updated on: Thu, 13 August 2020 03:16] by Moderator Report message to a moderator
|
|
|
Re: Extended JPanel background/foreground properties blank dropdown instead of color chooser [message #1839171 is a reply to message #1831174] |
Tue, 16 March 2021 13:54   |
Eclipse User |
|
|
|
I have been battling this issue (JPanel subclass and empty property menus) as well and haven't found a solution. I have both Windows and Linux installs and have tried resetting the Java libraries as described above and trying different versions of Java (releases on OpenJDK). The only combination that works is an older Eclipse install that supports Java8.
Driving me a bit nuts... I thought today's (2021-3-16) WindowBuilder update might be a fix but no ...
Does someone have an Eclipse + Java version combination that works that I can try??
Thanks,
Steve
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05228 seconds