Select all (CTRL + A) option that is not in the SWT text box

I am using the SWT application. I cannot select all the text in a text box or text area Ctrl+A.

Is there any way to achieve this?

+3
source share
3 answers
text.addKeyListener(new KeyAdapter() {
    @Override
    public void keyPressed(KeyEvent e)
    {
        if (e.stateMask == SWT.CTRL && e.keyCode == 'a') {
            text.selectAll();
            e.doit = false;
        }
    }
});
+6
source

Ideally, according to LAF doco, if you set the right look, you should get it automatically.

UIManager.setLookAndFeel(
            UIManager.getCrossPlatformLookAndFeelClassName());

If you do not see what they did here http://www.roseindia.net/java/example/java/swing/copy-data-from-ms.shtml

-1
source

Source: https://habr.com/ru/post/1733493/


All Articles