项目源码 :https://github.com/Wo-com/ShipPort
如果觉得不错的话就在GitHub里面给个Star吧
JavaSwing 船只停靠管理可视化主框架,效果如下:
源代码:
import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.BorderLayout; import javax.swing.JLabel; import javax.swing.JTabbedPane; public class Test { private JFrame frame; public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Test window = new Test(); window.frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public Test() { initialize(); } private void initialize() { frame = new JFrame("界面框架"); frame.setBounds(100, 100, 450, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(); frame.getContentPane().add(panel, BorderLayout.NORTH); JLabel label = new JLabel("提示文本"); panel.add(label); JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); frame.getContentPane().add(tabbedPane, BorderLayout.CENTER); JPanel panel_1 = new JPanel(); tabbedPane.addTab("面板1", null, panel_1, null); panel_1.setLayout(null); JLabel label_1 = new JLabel("标签1"); label_1.setBounds(175, 99, 61, 16); panel_1.add(label_1); JPanel panel_2 = new JPanel(); tabbedPane.addTab("面板2", null, panel_2, null); panel_2.setLayout(null); JLabel label_2 = new JLabel("标签2"); label_2.setBounds(184, 103, 61, 16); panel_2.add(label_2); JPanel panel_3 = new JPanel(); tabbedPane.addTab("面板3", null, panel_3, null); panel_3.setLayout(null); JLabel label_3 = new JLabel("标签3"); label_3.setBounds(163, 94, 61, 16); panel_3.add(label_3); JPanel panel_4 = new JPanel(); tabbedPane.addTab("面板4", null, panel_4, null); panel_4.setLayout(null); JLabel label_4 = new JLabel("标签4"); label_4.setBounds(178, 89, 61, 16); panel_4.add(label_4); } }
项目效果图:
主框架源代码:
import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import java.awt.BorderLayout; import javax.swing.JTabbedPane; import javax.swing.JLabel; public class MainUI { public static JFrame frame; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { new MainUI(); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the application. */ public MainUI() { initialize(); } /** * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame("船只停靠管理可视化"); frame.setBounds(100, 100, 840, 500); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); JPanel panel = new JPanel(); frame.getContentPane().add(panel, BorderLayout.NORTH); JLabel label = new JLabel("欢迎使用,本管理系统,没有使用任何框架,界面可随意拖动,界面与数据操作分离方便修改"); panel.add(label); JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); frame.getContentPane().add(tabbedPane, BorderLayout.CENTER); Pane1 panel_1 = new Pane1(); tabbedPane.addTab("泊位管理", null, panel_1, null); panel_1.setLayout(null);//清空布局 Pane2 panel_2 = new Pane2(); tabbedPane.addTab("船只管理", null, panel_2, null); panel_2.setLayout(null);//清空布局 Pane3 panel_3 = new Pane3(); tabbedPane.addTab("停靠指定", null, panel_3, null); panel_3.setLayout(null);//清空布局 Pane4 panel_4 = new Pane4(); tabbedPane.addTab("查看甘特图", null, panel_4, null); panel_4.setLayout(null);//清空布局 } }
原文地址:https://www.cnblogs.com/easyidea/p/11025485.html
时间: 2024-10-10 17:57:19