Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8111201

calling setText on a TextBox gives NullPointerException

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: fx2.0
    • Fix Version/s: fx2.0
    • Component/s: javafx
    • Labels:

      Description

      Calling the method setText on a TextBox causes a NullPointerException to be thrown:

      java.lang.NullPointerException
              at com.sun.javafx.sg.prism.NGText.getRangeShape(NGText.java:1348)
              at com.sun.javafx.sg.prism.NGText.getSelectionShape(NGText.java:1329)
              at com.sun.javafx.tk.glass.PrismTextHelper.getSelectionShape(PrismTextHelper.java:49)
              at javafx.scene.text.Text.getDecorationShapes(Text.java:443)
              at javafx.scene.text.Text.storeImpl_selectionEnd(Text.java:337)
              at javafx.scene.text.Text.setImpl_selectionEnd(Text.java)
              at com.sun.javafx.scene.control.skin.TextBoxSkin.updateTextSelection(TextBoxSkin.java:158)
              at com.sun.javafx.scene.control.skin.TextBoxSkin.handleControlPropertyChanged(TextBoxSkin.java:92)
              at com.sun.javafx.scene.control.skin.SkinBase$1.handle(SkinBase.java:148)
              at com.sun.javafx.beans.PropertySupport.fireChangedEvent(PropertySupport.java:146)
              at javafx.scene.control.TextInputControl.setDot(TextInputControl.java)
              at javafx.scene.control.TextInputControl.selectRange(TextInputControl.java:695)
              at javafx.scene.control.TextInputControl.selectAll(TextInputControl.java:447)
              at com.sun.javafx.scene.control.behavior.TextInputControlBehavior.focusChanged(TextInputControlBehavior.java:458)
              at com.sun.javafx.scene.control.behavior.TextInputControlBehavior$1.handle(TextInputControlBehavior.java:217)
              at com.sun.javafx.beans.PropertySupport.fireChangedEvent(PropertySupport.java:140)
              at javafx.scene.Node.setFocused(Node.java)
              at javafx.scene.Scene$KeyHandler.setFocusOwner(Scene.java:2002)
              at javafx.scene.Scene$KeyHandler.requestFocus(Scene.java:2061)
              at javafx.scene.Scene$KeyHandler.access$1000(Scene.java:1989)
              at javafx.scene.Scene.requestFocus(Scene.java:1066)
              at javafx.scene.Node.requestFocus(Node.java:3761)
              at com.sun.javafx.scene.traversal.TraversalEngine.trav(TraversalEngine.java:73)
              at javafx.scene.Scene.focusInitial(Scene.java:997)
              at javafx.scene.Scene.access$2300(Scene.java:102)
              at javafx.scene.Scene$ScenePulseListener.focusCleanup(Scene.java:1315)
              at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:1348)
              at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:295)
              at com.sun.javafx.tk.glass.GlassToolkit.pulse(GlassToolkit.java:217)
              at com.sun.javafx.tk.glass.GlassToolkit$3.run(GlassToolkit.java:184)
              at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
              at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:13)
              at com.sun.glass.ui.win.WinApplication$1.run(WinApplication.java:32)
              at java.lang.Thread.run(Thread.java:662)

      Some simple code to reproduce the Exception:

      public class TextBoxException extends Application {
        public static void main(String[] args) {
          Launcher.launch(TextBoxException.class, args);
        }

        @Override
        public void start(Stage primaryStage) {
          TextBox name = new TextBox();
          name.setText("Name");
          primaryStage.setScene(new Scene(name, 500, 500));
          primaryStage.setTitle("TextBox Exception");
          primaryStage.setVisible(true);
        }
      }

        Attachments

          Activity

            People

            • Assignee:
              thor Thor Johannesson (Inactive)
              Reporter:
              jsykorajfx Joeri Sykora (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: