我将字符:┬ 写入Swing的JTextArea或者JTextField中,为什么显示就不正常了?

plplum 2009-09-14 11:02:44
我将字符:┬ 写入Swing的JTextArea或者JTextField中,为什么显示就不正常了?
package swing;

import java.awt.BorderLayout;
import javax.swing.JFrame;
import javax.swing.JTextArea;
import javax.swing.JTextField;

public class Test extends JFrame {

private JTextArea textArea_1;
private JTextField textField;
private JTextArea textArea;
/**
* Launch the application
* @param args
*/
public static void main(String args[]) {
try {
Test frame = new Test();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}

/**
* Create the frame
*/
public Test() {
super();
getContentPane().setLayout(null);

textField = new JTextField();
textField.setText("┬");
textField.setBounds(10, 22, 90, 21);
getContentPane().add(textField);

textArea_1 = new JTextArea();
textArea_1.setBounds(10, 82, 87, 156);
textArea_1.setText("┬");
getContentPane().add(textArea_1);
setBounds(100, 100, 500, 375);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

//getContentPane().add(textArea, BorderLayout.CENTER);
//
}

}
...全文
153 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
猿敲月下码 2009-09-14
  • 打赏
  • 举报
回复
实在不行的话就这样:
textField.setText("\u252C");

\u252C 就是这个特殊字符
猿敲月下码 2009-09-14
  • 打赏
  • 举报
回复
没有啊,我运行下可以的

62,621

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧