AutoCompleteTextField NullPointerException

20 Aufrufe
Direkt zur ersten ungelesenen Nachricht

shop.servic...@gmail.com

ungelesen,
10.04.2019, 19:00:1810.04.19
an CodenameOne Discussions
If you are experiencing an issue please mention the full platform your issue applies to:
IDE: NetBeans/Eclipse/IDEA NetBeans 8.2
Desktop OS Windws 10 Pro
Simulator Latest
Device PC, IOS 12+ Android 6+

[EDT] 0:2:35,975 - Exception: java.lang.NullPointerException - null
java.lang.NullPointerException
 at com.codename1.ui.AutoCompleteTextField$FormPointerPressListener.actionPerformed(AutoCompleteTextField.java:464)
 at com.codename1.ui.util.EventDispatcher.fireActionSync(EventDispatcher.java:459)
 at com.codename1.ui.util.EventDispatcher.fireActionEvent(EventDispatcher.java:362)
 at com.codename1.ui.Form.pointerPressed(Form.java:2946)
 at com.codename1.ui.Component.pointerPressed(Component.java:4502)
 at com.codename1.ui.Display.handleEvent(Display.java:2145)
 at com.codename1.ui.Display.edtLoopImpl(Display.java:1152)
 at com.codename1.ui.Display.mainEDTLoop(Display.java:1070)
 at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
 at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)

Uncaught Exception is this code:
Container layered = f.getLayeredPane(AutoCompleteTextField.getClass(), true);
Form f = getComponentForm();
Where "f" = null;Causing the Exception.

Thoughts?

Regards



Shai Almog

ungelesen,
10.04.2019, 22:17:3910.04.19
an CodenameOne Discussions
Did you remove the auto-complete component (or one of its parents) from the form dynamically?

shop.servic...@gmail.com

ungelesen,
11.04.2019, 11:20:1911.04.19
an CodenameOne Discussions
I am using AutoCompleteTextField as a rendered Table Cell. 
After looking more closely, I was instantiating a new AutoCompleteTextField  within the createCell method.
I have stored a new createCell( instance in a vector and pass that element to the createCell method.
for each row, I instantiate and store in this Vector
                Vector myAutoCompleteTextFields.addElement(new AutoCompleteTextField(CarFaxLaborTasks));

                        cell = (AutoCompleteTextField) myAutoCompleteTextFields.elementAt(row);
                        ((AutoCompleteTextField) cell).setText((String) super.getModel().getValueAt(row, column));


This resolved the null pointer exception.
However I am experiencing a display issue.
Initially the Table renders the strings as expected, however when I touch to edit then touch elsewhere (lose focus) the
cell is no longer rendered in that the cell is blank. (When querying the table contents, the data is as expected. Just not seeing in screen)

Thoughts?

Thanks in advance

Regards

Shai Almog

ungelesen,
11.04.2019, 22:26:3111.04.19
an CodenameOne Discussions
I suggest using a single Label or TextArea instance within the renderer. When you reuse the instance the renderer manipulates the component and that triggers artifacts. To make the component look like AutoComplete just use setUIID().

shop.servic...@gmail.com

ungelesen,
12.04.2019, 11:30:5812.04.19
an CodenameOne Discussions
When I change the Component from AutoCompleteTextFiemd to TextArea in
protected Component createCell(Object value, final int row, final int column, boolean editable) method,
The text is rendered appropriately with the exception that I am not able to interact with the AutoCompleteTextFiemd as a pupup of suggestions when this column takes focus.

Thoughts?

Regards

Shai Almog

ungelesen,
13.04.2019, 01:26:2813.04.19
an CodenameOne Discussions
You shouldn't be able to interact with a renderer. Do you mean you don't see the focus behind?
It's probably because the component is opaque.
Allen antworten
Antwort an Autor
Weiterleiten
0 neue Nachrichten