title: Codename One Button desconfigures upon screen rotation
body: <p>I have an Android application that uses permanent landscape orientation. I am using the maven project structure.</p>
  <p>Inside a container are a couple of buttons with css margin, padding and border settings.</p>
  <p>One of the buttons has a special background once it has been selected by the user.</p>
  <p>Problem is that the selected button loses margin and padding when the screen is rotated both in the simulator and the installed device. When the screen is not rotated, the button keeps the configurations.</p>
  <p>How does this happen and how can I avoid this?</p>
  <p>Here is a screenshot:</p>
  <p><a href="https://i.stack.imgur.com/87tsh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/87tsh.png" alt="enter image description here" /></a></p>
  <p>Here is my code:</p>
  <pre><code>    String [] listInputStrings = listString.get(0);
  
      for (String string : listInputStrings) {
          
          Button buttonLetter = new Button(string);
          buttonLetter.setUIID(&quot;OneButtonLetter&quot;);
          buttonLetter.setName(&quot;unselected&quot;);
          containerButtons.add(buttonLetter);
          
          buttonLetter.addActionListener(l -&gt; {
              for (Component component : containerButtons) {
                  component.setName(&quot;unselected&quot;);
              }
              buttonLetter.setName(&quot;selected&quot;);
          });
          
          buttonLetter.addActionListener(l -&gt; {           
              for (Component component : containerButtons) {
                  String name = component.getName();
                  if (name.equals(&quot;selected&quot;)) {
                      component.setUIID(&quot;OneButtonLetterSelected&quot;);
                  } else {
                      component.setUIID(&quot;OneButtonLetter&quot;);
                  }
              }
          });
  
          containerCenter.add(BorderLayout.CENTER, containerButtons);
         
          containerButtons.setUIID(&quot;OneContainerButtons&quot;);
      
          Display.getInstance().lockOrientation(false);
  </code></pre>
  <p>CSS :</p>
  <pre><code>OneButtonLetterGeneral {
      background-color: #3366ff;
      border-radius: 2pt;
      color: white;
      font-size: 9pt;
      text-align: center;
  }
  
  OneButtonLetter {
      cn1-derive: OneButtonLetterGeneral;
      margin-top: 10pt;
      margin-bottom: 10pt;
      margin-left: 10pt;
      margin-right: 0pt;
      padding-top: 20pt;
      padding-bottom: 20pt;
      padding-left: 40pt;
      padding-right: 40pt;
  }
  
  OneButtonLetter.pressed {
      background-color: #4d79ff;
      font-size: 10pt;
      padding-top: 10pt;
      padding-bottom: 10pt;
      padding-left: 0pt;
      padding-right: 0pt;
  }
  
  OneButtonLetterSelected {
      cn1-derive: OneButtonLetterGeneral;
      background-color: #0039e6;
  }
  
  OneContainerButtons {
      border: 0.5pt solid #4d4d00;
      margin: 0pt;
      padding-top: 10pt;
      padding-bottom: 10pt;
      padding-left: 10pt;
      padding-right: 20pt;
  }
  </code></pre>