当前位置:网站首页>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();
}
}
边栏推荐
- Winter vacation work of software engineering practice
- [day15] introduce the features, advantages and disadvantages of promise, and how to implement it internally. Implement promise by hand
- File links cannot be opened or downloaded in Google browser
- 10000小時定律不會讓你成為編程大師,但至少是個好的起點
- In depth analysis of reentrantlock fair lock and unfair lock source code implementation
- [Fiddler problem] solve the problem about Fiddler's packet capturing. After the mobile network is configured with an agent, it cannot access the Internet
- [C /vb.net] convert PDF to svg/image, svg/image to PDF
- JS date comparison
- JMeter JSON extractor extracts two parameters at the same time
- RestHighLevelClient获取某个索引的mapping
猜你喜欢
Sorting out the core ideas of the pyramid principle
Interfaces and related concepts
10000小時定律不會讓你成為編程大師,但至少是個好的起點
dataworks自定义函数开发环境搭建
Machine learning | simple but feature standardization methods that can improve the effect of the model (comparison and analysis of robustscaler, minmaxscaler, standardscaler)
Mise en place d'un environnement de développement de fonctions personnalisées
JMeter test result output
Winter vacation work of software engineering practice
Inno Setup 制作安装包
Software testing learning - day one
随机推荐
MySQL transaction rollback, error points record
Software testing learning - the next day
[untitled]
Jenkins
Gridome + strapi + vercel + PM2 deployment case of [static site (3)]
[classes and objects] explain classes and objects in simple terms
Flask Foundation
[Code] occasionally take values, judge blanks, look up tables, verify, etc
每日刷題記錄 (十一)
How can the server set up multiple interfaces and install IIS? Tiantian gives you the answer!
Operation principle of lua on C: Foundation
Software testing assignment - day 3
Search engine Bing Bing advanced search skills
UTC时间、GMT时间、CST时间
[set theory] equivalence classes (concept of equivalence classes | examples of equivalence classes | properties of equivalence classes | quotient sets | examples of quotient sets)*
爬虫代码基础教学
Application scenarios of Catalan number
Hands on redis master-slave replication, sentinel master-slave switching, cluster sharding
How to specify the execution order for multiple global exception handling classes
Interfaces and related concepts