Jump to content

Recommended Posts

Posted

Boas,

Eu encontrei uma biblioteca que me dava jeito mas só funciona com TextArea's e eu queria usar como simples caixa de texto.

Existe alguma forma de limitar uma TextArea a uma linha? Ao definir uma TextArea com uma linha a única restrição é que só uma linha é visivel, mas o enter permite mudar de linha e não queria isso :/

"What we do for ourselves dies with us. What we do for others and the world, remains and is immortal.", Albert Pine

Blog pessoal : contém alguns puzzles, algoritmos e problemas para se resolver com programação.

Posted

Entretanto descobri, se der jeito a alguém no futuro, é assim:

// impede o uso do enter, ficando uma TextArea de uma linha
minhaTextArea.getInputMap(textArea.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"), "none");

"What we do for ourselves dies with us. What we do for others and the world, remains and is immortal.", Albert Pine

Blog pessoal : contém alguns puzzles, algoritmos e problemas para se resolver com programação.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.