当前位置:网站首页>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();
}
}
边栏推荐
- Inno setup production and installation package
- Software testing assignment - day 3
- UTC时间、GMT时间、CST时间
- Setting up the development environment of dataworks custom function
- How can the server set up multiple interfaces and install IIS? Tiantian gives you the answer!
- Software testing learning - day 3
- 爬虫代码基础教学
- RestHighLevelClient获取某个索引的mapping
- 多个全局异常处理类,怎么规定执行顺序
- 10 000 volumes - Guide de l'investisseur en valeur [l'éducation d'un investisseur en valeur]
猜你喜欢
Realize PDF to picture conversion with C #
Software testing assignment - day 1
golang操作redis:写入、读取kv数据
Machine learning | simple but feature standardization methods that can improve the effect of the model (comparison and analysis of robustscaler, minmaxscaler, standardscaler)
Setting up the development environment of dataworks custom function
MySQL installation
[set theory] equivalence classes (concept of equivalence classes | examples of equivalence classes | properties of equivalence classes | quotient sets | examples of quotient sets)*
Summary of UI module design and practical application of agent mode
2022-06-23 vgmp OSPF inter domain security policy NAT policy (under update)
100000 bonus is divided up. Come and meet the "sister who braves the wind and waves" among the winners
随机推荐
The difference between CONDA and pip
Software testing learning - day 3
Use the jvisualvm tool ----- tocmat to start JMX monitoring
2022-06-23 VGMP-OSPF-域间安全策略-NAT策略(更新中)
IC_ EDA_ All virtual machine (rich Edition): questasim, vivado, VCs, Verdi, DC, Pt, spyglass, icc2, synthesize, innovative, ic617, mmsim, process library
卡特兰数(Catalan)的应用场景
Inno setup production and installation package
【code】if (list != null && list.size() > 0)优化,集合判空实现方式
C2338 Cannot format an argument. To make type T formattable provide a formatter<T> specialization:
Mise en place d'un environnement de développement de fonctions personnalisées
Sorting out the core ideas of the pyramid principle
crontab定时任务
PHP install composer
[Code] if (list! = null & list. Size() > 0) optimization, set empty judgment implementation method
Understand software testing
php artisan
CentOS switches and installs mysql5.7 and mysql8.0
error C2017: 非法的转义序列
Selenium key knowledge explanation
Getting started with pytest