0

Itry to move text in tTextarea to left or to center or to right by pressing to buttons

i did like this but unfortuantly it is not work .

public void actionPerformed(ActionEvent e) {
        if(e.getSource()==buttons[0]){
           area.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
          
        }
        if(e.getSource()==buttons[2]){
            area.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
        }
    }

area if an object from JTextArea

can any one help me ??

thanks in advance

Beshoy atef

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by quuba
0

This work! At and of actionPerformed insert line

System.out.printLine.setText("isLeftToRight " + area.getComponentOrientation().isLeftToRight());

Apply:

    //
    area = new javax.swing.JTextArea();
    jTextField1 = new javax.swing.JTextField();
    area.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
    area.setColumns(20);
    area.setRows(5);
    area.setText("012345"+'\u0660'+'\u0661'+'\u0662'+'\u0663'+'\u0664'+'\u0665');
    //

But I think, this is not what you expect.

Edited by Reverend Jim: Fixed formatting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.