I am trying to make calculator and i have an issue with JTextField. When I click numbers(JButtons) like 1,2,3,4,5 , they appears on JTextField like 54321. So, how can i change this to show 12345 instead of 54321?
public void actionPerformed(ActionEvent e) {
JButton clickedButton = (JButton) e.getSource();
String displayValue = parent.getDisplayValue();
String clickedBtnValue = clickedButton.getText();
parent.setDisplayValue(clickedBtnValue + displayValue);
contentPane = new JPanel();
textField = new JTextField(30);
textField.setAlignmentX(Component.LEFT_ALIGNMENT);
contentPane.add(textField);
textField.setHorizontalAlignment(JTextField.RIGHT);
textField.setBounds(10, 11, 152, 32);
textField.setColumns(1);
textField.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
textField.addActionListener(eng);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 184, 312);
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);