Extended JPanel background/foreground properties blank dropdown instead of color chooser [message #1828341] |
Sun, 07 June 2020 22: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 #1831174 is a reply to message #1831125] |
Wed, 12 August 2020 23: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: Wed, 12 August 2020 23:16] by Moderator
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04496 seconds