大神看看为啥输入框,也就是jftext,没有显示?

xzwtt163 2014-01-09 08:11:02
public class Text_1 {
static JFrame jf=new JFrame("题目1演示");
static GridBagLayout gridbag = new GridBagLayout();
static GridBagConstraints c = new GridBagConstraints();
static JTextArea jftext=new JTextArea("请输入一个整数");
static JPanel jp=new JPanel(gridbag);
public static void main(String[] args) {
jf.add(jp);
jf.setSize(400, 400);
jf.setVisible(true);
jftext.setVisible(true);
jp.setVisible(true);
gridbag.setConstraints(jftext, c);
}
}
...全文
127 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
suciver 2014-01-10
  • 打赏
  • 举报
回复
楼主没把这个jftext添加到pannel中 少了jp.add(jftext);
remember1989 2014-01-10
  • 打赏
  • 举报
回复
楼主先学会怎么贴代码
public class A {
    public void static main(String[] args) {
        System.out.println("Hello!");
    }
}

62,621

社区成员

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

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