TextField中如何输入或显示固定的字符串

colors 2002-11-26 10:25:37
...全文
140 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
ralihm 2002-11-26
  • 打赏
  • 举报
回复
对输入事件进行监测
1、设定指定的字符数量,当输入量超过了指定数量的时候,textfield不响应,新输入的字符不会出现在输入框
colors 2002-11-26
  • 打赏
  • 举报
回复
不是这个意思,
我是说确定了列后,只能输入与列相同的字符数;不能滚动输入更多了字符;
wangweismb002 2002-11-26
  • 打赏
  • 举报
回复
setText(常量名)
henry_cn 2002-11-26
  • 打赏
  • 举报
回复
JTextField
public JTextField(String text,int columns)
Constructs a new TextField initialized with the specified text and columns. A default model is created.

Parameters:
text - the text to be displayed, or null
columns - the number of columns to use to calculate the preferred width; if columns is set to zero, the preferred width will be whatever naturally results from the component implementation
lelf2000 2002-11-26
  • 打赏
  • 举报
回复
setText()????是不是这个

62,614

社区成员

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

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