diff --git a/src/main/java/com/bonus/autoweb/UI/frame/Jframe.java b/src/main/java/com/bonus/autoweb/UI/frame/Jframe.java new file mode 100644 index 0000000..a44196a --- /dev/null +++ b/src/main/java/com/bonus/autoweb/UI/frame/Jframe.java @@ -0,0 +1,69 @@ +package com.bonus.autoweb.UI.frame; + +import javax.swing.*; +import javax.swing.border.EmptyBorder; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class Jframe extends JFrame { + + private JPanel contentPane; + + public static void main(String[] args) { + Jframe frame = new Jframe(); + frame.setVisible(true); + } + + public Jframe() { + setTitle("信息填报"); + //设置窗口显示尺寸 + Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize(); + setSize(dimension.width / 2, dimension.height / 2); + Point p = GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint(); + setBounds(p.x - (dimension.width + 100) / 3 * 2 / 2, p.y - dimension.height / 2 / 2, + (dimension.width + 200) / 3 * 2, dimension.height / 5 * 3); + //设置窗口是否可以关闭 + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + contentPane = new JPanel(); + contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); + setContentPane(contentPane); + contentPane.setLayout(null); + JButton logButton = new JButton("日志"); + logButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + new LogAction(); + } + }); + logButton.setFont(new Font("微软雅黑",Font.BOLD,50)); + logButton.setForeground(Color.BLACK); + logButton.setBounds(80, 50, 1100, 100); + contentPane.add(logButton); + + JButton morningButton = new JButton("早报"); + morningButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + new DailyAction("morning_daily"); + } + }); + morningButton.setFont(new Font("微软雅黑",Font.BOLD,50)); + morningButton.setForeground(Color.BLACK); + morningButton.setBounds(80, 250, 1100, 100); + contentPane.add(morningButton); + + JButton eveningButton = new JButton("晚报"); + eveningButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + new DailyAction("evening_daily"); + } + }); + eveningButton.setFont(new Font("微软雅黑",Font.BOLD,50)); + eveningButton.setForeground(Color.BLACK); + eveningButton.setBounds(80, 450, 1100, 100); + contentPane.add(eveningButton); + } + +}