JTextFieldLimit in 6.5

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

JTextFieldLimit in 6.5

Postby pan » Mon Nov 26, 2007 4:18 pm

Have you you tried <JTextFieldLimit class> with Swing Designer?

http://www.cs.unc.edu/Courses/comp118/m ... Limit.html

Swing Designer doesn't render a window that contains JTextFieldLimit object.
pan
 
Posts: 2
Joined: Mon Nov 26, 2007 4:09 pm

Re: JTextFieldLimit in 6.5

Postby Eric Clayberg » Mon Nov 26, 2007 5:01 pm

pan wrote:Have you you tried <JTextFieldLimit class> with Swing Designer? Swing Designer doesn't render a window that contains JTextFieldLimit object.

I have never heard of that class, and it does not appear to be part of the JDK.

With out a complete test case and your log file, I couldn't even begin to guess at what the issue might be.
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

Postby pan » Mon Nov 26, 2007 7:50 pm

JTextFieldLimit Class look like this

Code: Select all
import javax.swing.*;
import javax.swing.text.*;

public class JTextFieldLimit extends PlainDocument {
  private int limit;
  // optional uppercase conversion
  private boolean toUppercase = false;
 
  JTextFieldLimit(int limit) {
   super();
   this.limit = limit;
   }
   
  JTextFieldLimit(int limit, boolean upper) {
   super();
   this.limit = limit;
   toUppercase = upper;
   }

  public void insertString
    (int offset, String  str, AttributeSet attr)
      throws BadLocationException {
   if (str == null) return;

   if ((getLength() + str.length()) <= limit) {
     if (toUppercase) str = str.toUpperCase();
     super.insertString(offset, str, attr);
     }
   }
}


and this class is used like this

Code: Select all
textField = new JTextField();
textField.setDocument(new JTextFieldLimit(10));


And here's log file in .metadata/.log

--------------------------------------------------------------------------

!ENTRY com.swtdesigner 4 4 2007-11-27 13:14:08.187
!MESSAGE Designer internal error [6.5.1.20071126134849]: com.swtdesigner.properties.PropertyException: java.lang.NoSuchMethodException: JTextFieldLimit.<init>()
<component: null class: unknownType>
!STACK 0
org.apache.commons.lang.exception.NestableError: com.swtdesigner.properties.PropertyException: java.lang.NoSuchMethodException: JTextFieldLimit.<init>()
<component: null class: unknownType>
at com.swtdesigner.model.swing.properties.custom.DesignTimeHelper.execute(DesignTimeHelper.java:56)
at com.swtdesigner.model.JavaInfo.notifyPropertyChanged(JavaInfo.java:5603)
at com.swtdesigner.model.JavaInfo.notifyPropertyChanged(JavaInfo.java:5584)
at com.swtdesigner.gef.common.property.DesignerEditorPropertyComposite.handleRootNodeSelected(DesignerEditorPropertyComposite.java:662)
at com.swtdesigner.gef.common.property.DesignerEditorPropertyComposite.updatePropertyComposite(DesignerEditorPropertyComposite.java:865)
at com.swtdesigner.gef.DesignerEditor.parseCompilationUnit(DesignerEditor.java:1170)
at com.swtdesigner.gef.DesignerEditor$17.execute(DesignerEditor.java:1072)
at com.swtdesigner.model.swing.properties.custom.DesignTimeHelper.execute(DesignTimeHelper.java:54)
at com.swtdesigner.gef.DesignerEditor.handleActivate(DesignerEditor.java:1066)
at com.swtdesigner.gef.DesignerEditor.handleActivate(DesignerEditor.java:1059)
at com.swtdesigner.editors.MultiPageEditor.showDesignEditor(MultiPageEditor.java:426)
at com.swtdesigner.editors.MultiPageEditor$2.widgetSelected(MultiPageEditor.java:196)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:962)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:947)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:706)
at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3227)
at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:2005)
at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:316)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:169)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
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:508)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
Caused by: com.swtdesigner.properties.PropertyException: java.lang.NoSuchMethodException: JTextFieldLimit.<init>()
<component: null class: unknownType>
at com.swtdesigner.model.swing.component.ComponentBeanInfo.prepareControl(ComponentBeanInfo.java:697)
at com.swtdesigner.model.swing.component.ComponentBeanInfo.createGUIComponent(ComponentBeanInfo.java:601)
at com.swtdesigner.model.JavaInfo$18.execute(JavaInfo.java:5608)
at com.swtdesigner.model.swing.properties.custom.DesignTimeHelper.execute(DesignTimeHelper.java:54)
... 44 more
Caused by: java.lang.NoSuchMethodException: JTextFieldLimit.<init>()
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.getDeclaredConstructor(Unknown Source)
at com.swtdesigner.model.swing.JavaBeanInfo.createBeanObject0(JavaBeanInfo.java:375)
at com.swtdesigner.model.swing.JavaBeanInfo.createBeanObject(JavaBeanInfo.java:325)
at com.swtdesigner.model.swing.bean.nonvisual.NonVisualBeanContainerInfo.createBeans(NonVisualBeanContainerInfo.java:68)
at com.swtdesigner.model.swing.component.ContainerBeanInfo.createControl(ContainerBeanInfo.java:650)
at com.swtdesigner.model.swing.component.ComponentBeanInfo.prepareControl(ComponentBeanInfo.java:615)
... 47 more[/code]
pan
 
Posts: 2
Joined: Mon Nov 26, 2007 4:09 pm

Postby Eric Clayberg » Tue Nov 27, 2007 5:01 am

Try this again using the latest v6.5.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


Return to Swing Designer

Who is online

Users browsing this forum: No registered users and 1 guest