Java布局管理器能让某个组件居中么? Java布局管理器能让某个组件居中么? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 当然能了 ,borderlayout应该就可以满足你的要求。 当然可以,BorderLayout就有Center属性! import java.awt.BorderLayout;import javax.swing.JButton;import javax.swing.JFrame;public class Test extends JFrame { public Test() { this.setTitle("Demo"); this.setBounds(400, 300, 400, 300); this.setDefaultCloseOperation(3); this.setLayout(new BorderLayout()); this.add(new JButton("west"), BorderLayout.WEST); this.add(new JButton("east"), BorderLayout.EAST); this.add(new JButton("north"), BorderLayout.NORTH); this.add(new JButton("south"), BorderLayout.SOUTH); this.add(new JButton("center"), BorderLayout.CENTER); this.setVisible(true); } public static void main(String[] args) { new Test(); } } android 线程池能实现每个线程执行完之后就在主线程显示吗 字符串排序算法, 哪位大侠给看下... Set与HashSet 如何放到一个session里面 如何取session protected static和public static有区别吗? 能否提供一个Socket发送和接受XML文件的例子呢?谢谢!! 这个怎么插入不到数据库里面呢? java中字体的简单问题,求教~~ 从今天开始,要在java版里玩了! 非阻塞I/O中服务器得到的SocketChannel发送数据时的疑问? 高手帮我解决个笔试题 反序列化出现版本号不对
import java.awt.BorderLayout;import javax.swing.JButton;
import javax.swing.JFrame;
public class Test extends JFrame { public Test() {
this.setTitle("Demo");
this.setBounds(400, 300, 400, 300);
this.setDefaultCloseOperation(3);
this.setLayout(new BorderLayout());
this.add(new JButton("west"), BorderLayout.WEST);
this.add(new JButton("east"), BorderLayout.EAST);
this.add(new JButton("north"), BorderLayout.NORTH);
this.add(new JButton("south"), BorderLayout.SOUTH);
this.add(new JButton("center"), BorderLayout.CENTER);
this.setVisible(true);
}
public static void main(String[] args) {
new Test();
}
}