Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » WindowBuilder » Generic Panel/Dialog with Actions will not render GUI
Generic Panel/Dialog with Actions will not render GUI [message #899699] Wed, 01 August 2012 22:55 Go to next message
Dave Radtke is currently offline Dave RadtkeFriend
Messages: 2
Registered: August 2012
Junior Member
I have a generic class that extends JPanel. As soon as I introduce an Action the class will no longer generate the UI. I get a null pointer exception.
If I make the class non-generic, or I don't create an instance of the Action in the constructor then it will generate the UI successfully.

I have been able to reproduce this on multiple classes (JPanel and JDialog), attached in a report from a simple example that does not need to be generic, but is a simple example that removes other dependencies and possible other causes


public class OKCancelDialog<T> extends JDialog {

	protected JPanel buttonPanel;
	protected JButton btnOk;
	protected JFrame frame;
	

	public OKCancelDialog(JFrame frame,boolean modal) {
		super(frame,modal);
		
		buttonPanel = new JPanel();
		FlowLayout flowLayout = (FlowLayout) buttonPanel.getLayout();
		flowLayout.setAlignment(FlowLayout.RIGHT);
		getContentPane().add(buttonPanel, BorderLayout.SOUTH);
		
		btnOk = new JButton("OK");
		btnOk.setAction(new OKAction());
		buttonPanel.add(btnOk);
		
	}
	private class OKAction extends AbstractAction {
		public OKAction() {
			putValue(NAME, "ok");
		}
		public void actionPerformed(ActionEvent e) {
			setVisible(false);
		}
	}
	
}




java.lang.NullPointerException
	at org.eclipse.wb.internal.swing.model.bean.ActionInfo.refreshIconImage(ActionInfo.java:118)
	at org.eclipse.wb.internal.swing.model.bean.ActionInfo.access$1(ActionInfo.java:115)
	at org.eclipse.wb.internal.swing.model.bean.ActionInfo$3.refreshed(ActionInfo.java:83)
	at sun.reflect.GeneratedMethodAccessor111.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)

....



Re: Generic Panel/Dialog with Actions will not render GUI [message #899704 is a reply to message #899699] Thu, 02 August 2012 02:11 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
Fixed in trunk.

Konstantin Scheglov,
Google, Inc.
Re: Generic Panel/Dialog with Actions will not render GUI [message #899706 is a reply to message #899704] Thu, 02 August 2012 03:26 Go to previous message
Dave Radtke is currently offline Dave RadtkeFriend
Messages: 2
Registered: August 2012
Junior Member
Excellent, thanks! How often does the update site get updated?

http ://dl.google.com/eclipse/inst/d2wbpro/latest/3.6
Previous Topic:add child in parent constructor
Next Topic:ClassLoader
Goto Forum:
  


Current Time: Fri Apr 19 05:23:16 GMT 2024

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

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

Back to the top