java - 关于JList中的Renderer获取问题。当根据索引index值设置显示的文本内容时,文本显示全都一样。
我重写ListCellRenderer类,继承JPanel。在JPanel中添加一个JLabel用于显示list中的索引。但是设置setText(String.valueOf(index))之后显示的值都为0.如果用控制台直接输入index又是对的,请问有没有大神知道为什...
阿神 2017-04-18 10:30:32 0 0 429
Java Swing JLabel宽度问题
我想让JLabel的宽度自适应,就是说文字有多长JLabel的宽度就多宽。类似Android中wrap_content的效果。应该如何实现呢?望赐教!
怪我咯 2017-04-17 17:58:12 0 1 323
java - 关于使用netbeans创建窗体的问题
因为我们老师没有讲过swing,也没有时间自学,为了赶毕设只能使用netbeans来做窗体。但是有一个问题,我拖入一个标签到JFrame窗体,然后设置这个JLabel的背景为一张图片,用它来充当我登录窗口的背景,可是我不能...
PHP中文网 2017-04-17 17:16:19 0 0 513
java - swing刷新UI控件的线程问题
笔者swing初学,不是很清楚,学习中遇到一个问题,如下。一个窗体(JFrame),窗体上有两个控件,其中一个JButton,一个JLabel,想要实现的效果是,点击button,label显示从0递增到9,每秒递增一次。想当然地在bu...
大家讲道理 2017-04-17 11:57:18 0 3 275