面板
JPanel
package com.hua.demo5; import javax.swing.*; import java.awt.*; public class JPanelDemo extends JFrame { public JPanelDemo(){ Container container = getContentPane(); container.setLayout(new GridLayout(2,2,10,10));//后面参数的意思,间距 JPanel panel1 = new JPanel(new GridLayout(1,3)); JPanel panel2 = new JPanel(new GridLayout(1,2)); JPanel panel3 = new JPanel(new GridLayout(2,1)); JPanel panel4 = new JPanel(new GridLayout(3,2)); panel1.add(new JButton("1")); panel1.add(new JButton("1")); panel1.add(new JButton("1")); panel2.add(new JButton("2")); panel2.add(new JButton("2")); panel3.add(new JButton("3")); panel3.add(new JButton("3")); panel4.add(new JButton("4")); panel4.add(new JButton("4")); panel4.add(new JButton("4")); panel4.add(new JButton("4")); panel4.add(new JButton("4")); panel4.add(new JButton("4")); container.add(panel1); container.add(panel2); container.add(panel3); container.add(panel4); this.setVisible(true); this.setBounds(100,100,500,400); } public static void main(String[] args) { new JPanelDemo(); } }
JScrollPanel
package com.hua.demo5; import javax.swing.*; import java.awt.*; public class JScrollDemo extends JFrame { public JScrollDemo(){ Container container = this.getContentPane(); //文本域 JTextArea textArea = new JTextArea(20,50); textArea.setText("飞雪连天射白鹿,笑书神侠倚碧鸳"); //Scroll面板 JScrollPane scrollPane = new JScrollPane(textArea); container.add(scrollPane); this.setBounds(100,100,300,350); this.setVisible(true); this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); } public static void main(String[] args) { new JScrollDemo(); } }
我的一生
第1章-废物的一生
第50章-糟糕的婴儿
第300章-莫欺少年穷
第600章-莫欺中年穷
第1000章-莫欺老年穷
第1100章-不详的离去
第1101章-棺材板的震动
第1150章-盗墓贼的眼泪
第1200章-死者为大