关于JButton的问题 在新建一个JButton对象后,用setText方法为这个JButton对象设置值为"1".我发想这个JButton对象的大小,只有在40*40 的情况下才能显示下这个"1",如果再小了则只会显示省略号.但是这个"1"的周围还有很大的空白,请问高手这是为什么呢?有没有方法,让这个 JButton对象的大小小一些(比如10*10)就能显示下"1"呢.?代码和运行结果如下: 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 测试能显示出1import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.border.EmptyBorder;public class TestJButton extends JFrame { private JButton jbutton=new JButton(); public static void main(String[] args){ new TestJButton(); } public TestJButton(){ super("JButtonTest"); this.setSize(200, 200); this.setLocation(100, 100); this.setLayout(null);// this.setLayout(new FlowLayout()); jbutton.setSize(20, 20); jbutton.setBorder(new EmptyBorder(0,0,0,0)); jbutton.setText("1"); jbutton.setFocusable(false); this.add(jbutton); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setVisible(true); } } Socket的readline读取速度还能提高么? JXTA跨网关通信问题 一个线程同步的小问题 问题:有关移动sp于网关痛信的问题 ResultSet对象怎么从后台传到jsp上的 如何用程序登陆unix 一个不知原因的错误,请各位高手帮着看看。谢谢,在线等 有谁使用Textpad的,请进来帮个忙! 高分请教日文系统下的中文输入问题 大家好!我四一个JAVA初学者! 请高人给详细的讲解一下Java的注解 关于Java的一个问题
import javax.swing.JFrame;
import javax.swing.border.EmptyBorder;
public class TestJButton extends JFrame { private JButton jbutton=new JButton();
public static void main(String[] args){
new TestJButton();
}
public TestJButton(){
super("JButtonTest");
this.setSize(200, 200);
this.setLocation(100, 100);
this.setLayout(null);
// this.setLayout(new FlowLayout());
jbutton.setSize(20, 20);
jbutton.setBorder(new EmptyBorder(0,0,0,0));
jbutton.setText("1");
jbutton.setFocusable(false);
this.add(jbutton);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
}
}