当前位置:网站首页>Split small interface
Split small interface
2022-07-03 07:00:00 【Bugxiu_ fu】
package com.zking.ui;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
public class Demo extends JFrame {
private JSplitPane jsp = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
private JSplitPane jsp2 = new JSplitPane();
private JPanel jpa = new JPanel();
private JPanel jpb = new JPanel();
private JPanel jpc = new JPanel();
// Upper container assembly
private JLabel jla = new JLabel(" Jiale slag man blacklist management system ");
// Lower left container
private JButton jba = new JButton(" List of scum men ");
private JButton jbb = new JButton(" Scum man coping manual ");
private JButton jbc = new JButton(" Customer list ");
private JButton jbd = new JButton(" Exit the system ");
/*
*
* The contents of the lower right container are displayed in the background by default
*/
public void kk() {
// Empty all components of the last time
jpc.removeAll();
// Set grid layout
jpc.setLayout(new GridLayout(6, 1));
// Custom add components
JButton jButton = new JButton(" There is the following list of scum men :");
JButton jButton1 = new JButton(" Gu Huai'an ");
JButton jButton2 = new JButton(" Pei Cheng ");
JButton jButton3 = new JButton(" Yu sencheng ");
JButton jButton4 = new JButton(" Xu zhimo ");
JButton jButton5 = new JButton(" Gu Changan ");
jpc.add(jButton);
jpc.add(jButton1);
jpc.add(jButton2);
jpc.add(jButton3);
jpc.add(jButton4);
jpc.add(jButton5);
// Refresh
jpc.repaint();
// Repaint
jpc.validate();
}
public void zn() {
// Empty all components of the last time
jpc.removeAll();
jpc.setBackground(Color.yellow);
// Custom add components
JButton jButton = new JButton(" There are the following ways to deal with scum men :");
JButton jButton1 = new JButton(" Hit your chest and head with your fist ");
jpc.add(jButton);
jpc.add(jButton1);
// Refresh
jpc.repaint();
// Repaint
jpc.validate();
}
public Demo() {
this.setTitle("");
this.setSize(500, 500);
this.setDefaultCloseOperation(3);
this.setLocationRelativeTo(null);
// Set the gap
jsp2.setDividerLocation(2);
// Set the thickness of the dividing line
jsp2.setDividerLocation(100);
// Set up JSplitPane Add left and right layout
jsp2.setLeftComponent(jpb);
jsp2.setRightComponent(jpc);
jla.setForeground(Color.red);
jpa.add(jla);
jla.setFont(new Font(" Chinese New Wei ", Font.BOLD, 40));
// Set the gap 、 The thickness of the dividing line
jsp.setDividerSize(2);
jsp.setDividerLocation(86);
// Add the above basic components JSplitPane
jsp.setTopComponent(jpa);
// Add the next section to JSplitPane
jsp.setBottomComponent(jsp2);
jpb.add(jba);
jpb.add(jbb);
jpb.add(jbc);
jpb.add(jbd);
kk();
// List of scum men
jba.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
kk();
}
});
// Scum man coping manual
jbb.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
zn();
}
});
// Exit the system
jbd.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// Close yourself
Demo.this.dispose();
// Close all
// System.exit(0);
}
});
this.getContentPane().add(jsp);
this.setVisible(true);
}
public static void main(String[] args) {
new Demo();
}
}
边栏推荐
猜你喜欢

SQL implementation merges multiple rows of records into one row

Inno setup production and installation package

vmware虚拟机C盘扩容

多个全局异常处理类,怎么规定执行顺序

New knowledge! The virtual machine network card causes your DNS resolution to slow down

Liang Ning: 30 lectures on brain map notes for growth thinking

Software testing learning - day one

Integration test practice (1) theoretical basis

Setting up the development environment of dataworks custom function

每日刷题记录 (十一)
随机推荐
服务器如何设置多界面和装IIS呢?甜甜给你解答!
Laravel框架 踩坑(一)
Software testing assignment - the next day
[Fiddler problem] solve the problem about Fiddler's packet capturing. After the mobile network is configured with an agent, it cannot access the Internet
Use the jvisualvm tool ----- tocmat to start JMX monitoring
Abstract learning
In depth analysis of reentrantlock fair lock and unfair lock source code implementation
Architecture notes
Reading notes of "learn to ask questions"
Thoughts in Starbucks
JMeter test result output
The difference between CONDA and pip
利用C#实现Pdf转图片
UTC time, GMT time, CST time
每日刷题记录 (十一)
Liang Ning: 30 lectures on brain map notes for growth thinking
Centos切换安装mysql5.7和mysql8.0
MySQL mistakenly deleted the root account and failed to log in
How can I split a string at the first occurrence of “-” (minus sign) into two $vars with PHP?
How can the server set up multiple interfaces and install IIS? Tiantian gives you the answer!