1 Reply Latest reply on Jul 29, 2008 4:13 PM by 843851

    HText and HSinglelineEntry

      Hey guys, I was trying two approaches to the input system in a xlet, but in each one I got problems.

      So they are:

      - I wanted a simple numeric entry, so I thought it would be cool make a label, that changes its value when a key is pressed.
      The problem is that HText cannot change the content!
      I thought with another class, but the awt Label, for isntance, cannot receive focus.
      So, what class in Java world can change its content and receive focus?

      - The other aproach was the HSinglelineEntry.
      It receives focus, but I don't know how to make it be editable.
      Here is the code:
           public static HSinglelineEntry criarTextInput(int left, int top, int width, int height, int max) {
                System.out.println("Creating input text");
                HSinglelineEntry textInput = new HSinglelineEntry(left, top, width, height, max);
                textInput.setFont(new Font("Tiresias",Font.BOLD,20));
                try {
                     textInput.setLook(new HSinglelineEntryLook());
                } catch (HInvalidLookException e) {
                     // TODO Auto-generated catch block
                textInput.addKeyListener(xletApp); //xletApp is the xlet class itself
                textInput.setTextContent("teste...", HState.ALL_STATES);
                HTextEvent startEvent = new HTextEvent(textInput,HTextEvent.TEXT_START_CHANGE);
                return textInput;
      Any idea is wellcome