Problem with combobox renderer

Swing Designer allows you to quickly create the frames, panels, dialogs, applets and other UI elements that comprise Java Swing applications.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

Problem with combobox renderer

Postby doc » Mon Jul 06, 2009 3:09 am

Hi,
after adding a renderer to a combobox I get an error in design view:

------------------------------------------------snip--------------------------------------------------------

Code: Select all
WindowBuilder internal error

WindowBuilder encountered unexpected internal error. Please contact support.



Show stack trace.
Hide stack trace.

Stack trace:
java.lang.AbstractMethodError
   at javax.swing.plaf.basic.BasicComboBoxUI.paintCurrentValue(Unknown Source)
   at com.sun.java.swing.plaf.windows.WindowsComboBoxUI.paintCurrentValue(Unknown Source)
   at javax.swing.plaf.basic.BasicComboBoxUI.paint(Unknown Source)
   at com.sun.java.swing.plaf.windows.WindowsComboBoxUI.paint(Unknown Source)
   at javax.swing.plaf.ComponentUI.update(Unknown Source)
   at javax.swing.JComponent.paintComponent(Unknown Source)
   at javax.swing.JComponent.printComponent(Unknown Source)
   at javax.swing.JComponent.paint(Unknown Source)
   at javax.swing.JComponent.print(Unknown Source)
   at javax.swing.JComponent.paintChildren(Unknown Source)
   at javax.swing.JComponent.printChildren(Unknown Source)
   at javax.swing.JComponent.paint(Unknown Source)
   at javax.swing.JComponent.print(Unknown Source)
   at javax.swing.JComponent.paintChildren(Unknown Source)
   at javax.swing.JComponent.printChildren(Unknown Source)
   at javax.swing.JComponent.paint(Unknown Source)
   at javax.swing.JComponent.print(Unknown Source)
   at javax.swing.JComponent.paintChildren(Unknown Source)
   at javax.swing.JComponent.printChildren(Unknown Source)
   at javax.swing.JComponent.paint(Unknown Source)
   at javax.swing.JLayeredPane.paint(Unknown Source)
   at javax.swing.JComponent.print(Unknown Source)
   at javax.swing.JComponent.paintChildren(Unknown Source)
   at javax.swing.JComponent.printChildren(Unknown Source)
   at javax.swing.JComponent.paint(Unknown Source)
   at javax.swing.JComponent.print(Unknown Source)
   at java.awt.GraphicsCallback$PrintCallback.run(Unknown Source)
   at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
   at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)
   at java.awt.Container.print(Unknown Source)
   at sun.awt.windows.WComponentPeer.print(Unknown Source)
   at sun.awt.windows.WCanvasPeer.print(Unknown Source)
   at sun.awt.windows.WPanelPeer.print(Unknown Source)
   at sun.awt.windows.WWindowPeer.print(Unknown Source)
   at java.awt.GraphicsCallback$PeerPrintCallback.run(Unknown Source)
   at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
   at java.awt.Component.printAll(Unknown Source)
   at com.instantiations.designer.swing.utils.SwingImageUtils$4.run(SwingImageUtils.java:260)
   at java.awt.event.InvocationEvent.dispatch(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.run(Unknown Source)

Full context stack trace:
java.lang.reflect.InvocationTargetException
   at java.awt.EventQueue.invokeAndWait(Unknown Source)
   at com.instantiations.designer.swing.utils.SwingImageUtils.runInDispatchThread(SwingImageUtils.java:659)
   at com.instantiations.designer.swing.utils.SwingImageUtils.makeShots(SwingImageUtils.java:258)
   at com.instantiations.designer.swing.model.component.ComponentInfo.createShotImages(ComponentInfo.java:235)
   at com.instantiations.designer.swing.model.component.ComponentInfo.refresh_fetch(ComponentInfo.java:110)
   at com.instantiations.designer.swing.model.component.ContainerInfo.refresh_fetch(ContainerInfo.java:200)
   at com.instantiations.designer.core.model.ObjectInfo$4.run(ObjectInfo.java:391)
   at com.instantiations.designer.core.utils.execution.ExecutionUtils.runDesignTime(ExecutionUtils.java:86)
   at com.instantiations.designer.core.model.ObjectInfo.refresh(ObjectInfo.java:388)
   at com.instantiations.designer.core.editor.DesignPage.internal_refreshGEF_withProgress(DesignPage.java:443)
   at com.instantiations.designer.core.editor.DesignPage.access$800(DesignPage.java:57)
   at com.instantiations.designer.core.editor.DesignPage$7$1.run(DesignPage.java:316)
   at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:178)
   at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
   at org.eclipse.swt.widgets.Display.syncExec(Display.java:4251)
   at com.instantiations.designer.core.editor.DesignPage$7.run(DesignPage.java:313)
   at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
   at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
   at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:507)
   at com.instantiations.designer.core.editor.DesignPage.internal_refreshGEF(DesignPage.java:334)
   at com.instantiations.designer.core.editor.UndoManager.refreshDesignerEditor(UndoManager.java:444)
   at com.instantiations.designer.core.editor.UndoManager.activate(UndoManager.java:77)
   at com.instantiations.designer.core.editor.DesignPage.handleActiveState_True(DesignPage.java:216)
   at com.instantiations.designer.core.editor.DesignPage.handleActiveState(DesignPage.java:203)
   at com.instantiations.designer.core.editor.multi.DefaultMultiMode.showPage(DefaultMultiMode.java:80)
   at com.instantiations.designer.core.editor.multi.DefaultMultiMode$1.widgetSelected(DefaultMultiMode.java:43)
   at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:228)
   at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
   at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
   at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1027)
   at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1012)
   at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:770)
   at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3242)
   at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:2017)
   at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:320)
   at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
   at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
   at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3823)
   at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3422)
   at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2384)
   at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2348)
   at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2200)
   at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:495)
   at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
   at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:490)
   at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
   at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
   at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
   at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
   at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
   at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:386)
   at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
   at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
   at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
Caused by: java.lang.AbstractMethodError
   at javax.swing.plaf.basic.BasicComboBoxUI.paintCurrentValue(Unknown Source)
   at com.sun.java.swing.plaf.windows.WindowsComboBoxUI.paintCurrentValue(Unknown Source)
   at javax.swing.plaf.basic.BasicComboBoxUI.paint(Unknown Source)
   at com.sun.java.swing.plaf.windows.WindowsComboBoxUI.paint(Unknown Source)
   at javax.swing.plaf.ComponentUI.update(Unknown Source)
   at javax.swing.JComponent.paintComponent(Unknown Source)
   at javax.swing.JComponent.printComponent(Unknown Source)
   at javax.swing.JComponent.paint(Unknown Source)
   at javax.swing.JComponent.print(Unknown Source)
   at javax.swing.JComponent.paintChildren(Unknown Source)
   at javax.swing.JComponent.printChildren(Unknown Source)
   at javax.swing.JComponent.paint(Unknown Source)
   at javax.swing.JComponent.print(Unknown Source)
   at javax.swing.JComponent.paintChildren(Unknown Source)
   at javax.swing.JComponent.printChildren(Unknown Source)
   at javax.swing.JComponent.paint(Unknown Source)
   at javax.swing.JComponent.print(Unknown Source)
   at javax.swing.JComponent.paintChildren(Unknown Source)
   at javax.swing.JComponent.printChildren(Unknown Source)
   at javax.swing.JComponent.paint(Unknown Source)
   at javax.swing.JLayeredPane.paint(Unknown Source)
   at javax.swing.JComponent.print(Unknown Source)
   at javax.swing.JComponent.paintChildren(Unknown Source)
   at javax.swing.JComponent.printChildren(Unknown Source)
   at javax.swing.JComponent.paint(Unknown Source)
   at javax.swing.JComponent.print(Unknown Source)
   at java.awt.GraphicsCallback$PrintCallback.run(Unknown Source)
   at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
   at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)
   at java.awt.Container.print(Unknown Source)
   at sun.awt.windows.WComponentPeer.print(Unknown Source)
   at sun.awt.windows.WCanvasPeer.print(Unknown Source)
   at sun.awt.windows.WPanelPeer.print(Unknown Source)
   at sun.awt.windows.WWindowPeer.print(Unknown Source)
   at java.awt.GraphicsCallback$PeerPrintCallback.run(Unknown Source)
   at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source)
   at java.awt.Component.printAll(Unknown Source)
   at com.instantiations.designer.swing.utils.SwingImageUtils$4.run(SwingImageUtils.java:260)
   at java.awt.event.InvocationEvent.dispatch(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.run(Unknown Source)


------------------------------------------------snip--------------------------------------------------------

The sample source:



Code: Select all
package test;

import java.awt.BorderLayout;


public class Test extends JDialog
{

  private final JPanel contentPanel = new JPanel();

  /**
   * Launch the application.
   */
  public static void main(String[] args)
  {
    try
    {
      Test dialog = new Test();
      dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
      dialog.setVisible(true);
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
  }

  /**
   * Create the dialog.
   */
  public Test()
  {
    setBounds(100, 100, 450, 300);
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setLayout(new FlowLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    {
      JComboBox comboBox = new JComboBox();
      comboBox.setPreferredSize(new Dimension(100,20));
      comboBox.setRenderer(new ListCellRenderer()
      {
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
            boolean cellHasFocus)
        {
          return new JLabel("whatever");
        }
      });
      contentPanel.add(comboBox);
    }
    {
      JPanel buttonPane = new JPanel();
      buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
      getContentPane().add(buttonPane, BorderLayout.SOUTH);
    }
  }

}


The same error is shown in the logfile.

Eclipse 3.4, SwingBuider 7.1.0

best regards
doc
 
Posts: 14
Joined: Thu Jun 25, 2009 1:52 am

Re: Problem with combobox renderer

Postby Eric Clayberg » Mon Jul 06, 2009 12:12 pm

Please give this a try using the latest Swing Designer v7.1 build.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: Problem with combobox renderer

Postby doc » Mon Jul 06, 2009 10:38 pm

Latest Swing Designer v7.1 build is ok for the test case.

Feeding the method "getListCellRendererComponent" with more lines will cause the same error:

Code: Select all
comboBox.setRenderer(new ListCellRenderer()
      {
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
            boolean cellHasFocus)
        {
          JLabel label = new JLabel("whatever");
          return label;
        }
      });

Same behavior with JTextField, JCheckBox ...
doc
 
Posts: 14
Joined: Thu Jun 25, 2009 1:52 am

Re: Problem with combobox renderer

Postby Eric Clayberg » Wed Jul 08, 2009 11:44 am

Please give this a try using the latest Swing Designer v7.1 build.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: Problem with combobox renderer

Postby doc » Wed Jul 08, 2009 10:11 pm

Using the product version 7.1.0.200907080724 the problem is still existing...

- best regards
doc
 
Posts: 14
Joined: Thu Jun 25, 2009 1:52 am

Re: Problem with combobox renderer

Postby Eric Clayberg » Thu Jul 09, 2009 2:21 pm

Apparently, the fix had not been released to the build yet.

Please give this a try using the latest Swing Designer v7.1 build.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: Problem with combobox renderer

Postby doc » Thu Jul 09, 2009 11:11 pm

Thanks, the problem is solved...
doc
 
Posts: 14
Joined: Thu Jun 25, 2009 1:52 am

Re: Problem with combobox renderer

Postby Eric Clayberg » Fri Jul 10, 2009 5:49 pm

Glad that worked.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to Swing Designer

Who is online

Users browsing this forum: No registered users and 1 guest