Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » WindowBuilder » Extended JPanel background/foreground properties blank dropdown instead of color chooser(WindowBuilder setting extended class properties)
Extended JPanel background/foreground properties blank dropdown instead of color chooser [message #1828341] Mon, 08 June 2020 02:07 Go to next message
John Osborne is currently offline John OsborneFriend
Messages: 7
Registered: June 2020
Junior Member
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 Go to previous messageGo to next message
Damian Caputo is currently offline Damian CaputoFriend
Messages: 3
Registered: May 2020
Location: Argentina
Junior Member
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 #1828446 is a reply to message #1828425] Tue, 09 June 2020 23:09 Go to previous messageGo to next message
John Osborne is currently offline John OsborneFriend
Messages: 7
Registered: June 2020
Junior Member
Yes,I had already seen your post in the hope either you would eventually discover how to do this or someone would reply with a solution.

I can't believe it should be difficult, and I too am puzzled.

Will be reading the JPanel source, and its ancestors as a last resort.

Are you using Eclipse and WindowBuilder under a Windows operating system or a different O/S?

Regards

[Updated on: Tue, 09 June 2020 23:13]

Report message to a moderator

Re: Extended JPanel background/foreground properties blank dropdown instead of color chooser [message #1828489 is a reply to message #1828446] Wed, 10 June 2020 15:55 Go to previous messageGo to next message
Damian Caputo is currently offline Damian CaputoFriend
Messages: 3
Registered: May 2020
Location: Argentina
Junior Member
Latest version of Eclipse.
Latest version of WindowBuilder
Java 13
Windows 10 Pro

I did a little reserch an d I found this page
http://www.iitk.ac.in/esc101/05Aug/tutorial/javabeans/customization/index.html

And this:
https://www.javaworld.com/article/2077063/the-trick-to-controlling-bean-customization.html

And this:
http://ramchavan.weebly.com/uploads/7/1/8/8/7188612/97-javabeans.pdf

And, finally, one book:
Developing Java Beans - O'Reilly

I didn't have enough time to read everything, and I don't know if the answer we are looking for is in this.

I hope you found your answer.
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 Go to previous messageGo to next message
Roberto Fernández is currently offline Roberto FernándezFriend
Messages: 3
Registered: August 2020
Junior Member
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 #1831093 is a reply to message #1831080] Tue, 11 August 2020 15:00 Go to previous messageGo to next message
Roberto Fernández is currently offline Roberto FernándezFriend
Messages: 3
Registered: August 2020
Junior Member
Finally, replacing OpenJDK by Oracle JDK in Project > Properties > Java Build Path > Libraries and rebuilding the Java Bean class fixed this problem for me.
Re: Extended JPanel background/foreground properties blank dropdown instead of color chooser [message #1831124 is a reply to message #1831093] Wed, 12 August 2020 01:05 Go to previous messageGo to next message
John Osborne is currently offline John OsborneFriend
Messages: 7
Registered: June 2020
Junior Member
Roberto Fernández wrote on Tue, 11 August 2020 15:00
Finally, replacing OpenJDK by Oracle JDK in Project > Properties > Java Build Path > Libraries and rebuilding the Java Bean class fixed this problem for me.


Roberto, first of all, thank you for your reply.
I am using Oracle JDK (13.02) but after opening Project > Properties > Java Build Path > Libraries there i a huge list of things.
Where exactly is the Java Bean class and how do I rebuild it?

Thank you in advance.

Regards,Oz

[Updated on: Wed, 12 August 2020 01:07]

Report message to a moderator

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 Go to previous messageGo to next message
Roberto Fernández is currently offline Roberto FernándezFriend
Messages: 3
Registered: August 2020
Junior Member
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 Go to previous message
John Osborne is currently offline John OsborneFriend
Messages: 7
Registered: June 2020
Junior Member
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]

Report message to a moderator

Previous Topic:Custom component public property not shown in property pane
Next Topic:DOWNLOAD AREA REORGANIZED
Goto Forum:
  


Current Time: Fri Aug 14 02:02:53 GMT 2020

Powered by FUDForum. Page generated in 0.07859 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top