×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jul 2013
    Posts
    1

    Labels and Buttons shows two points while generate new text

    Hello,

    I'm creating an application that generate two random numbers and a random operator (+ - / *) and 4 suggestions. The suggestions are in 4 buttons (3 random numbers and the correct answer)
    My problem is :
    when the generated number have two characters the label text will be two points as you can see in attached pictures



    here is a part of my code i start with create labels
    Code:
    final Label firstNumber = new Label("3");
    		final Label secondNumber = new Label("3");
    		final Label operator = new Label("+");
    		Label equal = new Label("=");
    		final Label result = new Label("?");
    		randomOperations.addComponent(firstNumber);
    		randomOperations.addComponent(operator);
    		randomOperations.addComponent(secondNumber);
    		randomOperations.addComponent(equal);
    		randomOperations.addComponent(result);
    		Game.addComponent(BorderLayout.CENTER, randomOperations);
    then i set the label text to random numbers and operator
    Code:
    firstNumber.setText(a + "");
    				secondNumber.setText(b + "");
    				operator.setText(operation + "");
    please give me hint im new in Lwuit

  2. #2
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    686

    Re: Labels and Buttons shows two points while generate new text

    Well first of all if those answers are supposed to be clickable i dont know why u use labels and not buttons... but to the question at hand
    you can use the setEndsWith3Points method of label to let it know that it shouldnt end in 3 points if the text is too long to fit the component
    and also you should use setPreferredW to set the width of the component to a number that can fit at least 2 characters (+padding)

Similar Threads

  1. Settings list with labels and enumerated text popup setting item ?
    By digitalsol in forum Symbian User Interface
    Replies: 2
    Last Post: 2010-06-25, 06:15
  2. Replies: 2
    Last Post: 2010-06-12, 09:58
  3. Changing a Labels Text
    By SuperSeb in forum Symbian
    Replies: 1
    Last Post: 2010-02-10, 04:23
  4. Replies: 2
    Last Post: 2008-07-30, 09:21
  5. CEikGlobalTextEditor shows old text in scrolling
    By rihoe in forum Symbian User Interface
    Replies: 0
    Last Post: 2006-08-18, 13:16

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×