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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.