gpt4 book ai didi

java - Swing 文本字段方向

转载 作者:行者123 更新时间:2023-12-01 17:41:33 26 4
gpt4 key购买 nike

嗨,我想从右到左显示文本,我使用 setComponentOrientation 但就我而言,我想要显示的文本是十进制数字,并且点首先出现在文本的左侧,当我添加另一个时数字比点向右移动,因为它本来应该放在第一位。检查照片以更好地了解我的问题。 image

This is just the textfield part.
textField = new JTextField();
textField.setBounds(55, 42, 158, 29);
frame.getContentPane().add(textField);
textField.setColumns(10);
textField.setBorder(null);
textField.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);

最佳答案

我认为您应该使用setHorizo​​ntalAlignment()而不是setComponentOrientation()

关于java - Swing 文本字段方向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60480557/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com