I have 3 buttons: "Q", "W" and "E". When clicked they should append their letter to a StringBuilder
. Like this:
StringBuilder s = new StringBuilder();
(When "Q" button is clicked):
s.append("q");
(When "W" button clicked):
s.append("w");
But what I want is to have a maximum of 3 characters to be in the StringBuilder
.
3 digits after reaching the initial character of a key is pressed at the end wiper and write a new one. After the StringBuilder
reaches three characters, it will remove the initial one and append the next. Like marquee.
Example:
StringBuilder is "QWW",
When E button clicked StringBuilder must be "WWE".
When W button clicked StringBuilder must be "WEW".