Java 公司财务系统 窗体程序 完整源码
今天為大家分享一個java語言編寫的公司財務管理系統,目前系統已經完成了主要功能,后續會進一步完善。整個系統界面漂亮,有完整得源碼,希望大家可以喜歡。喜歡的幫忙點贊和關注。一起編程、一起進步
開發環境
開發語言為Java,開發環境Eclipse或者IDEA都可以。數據庫采用:MySQL。運行主程序,或者執行打開JAR文件即可以運行本程序。
系統框架
利用JDK自帶的SWING框架開發,不需要安裝第三方JAR包。MySQL數據庫,純窗體模式,直接運行Main文件即可以。同時帶有詳細得設計文檔
運行方法
1 運行Main.java文件
2 程序出現公司財務管理系統登陸的面板
系統主要功能
系統主要分為6個主要的模塊:材料管理、訂單管理、工程管理、員工信息管理、財務管理、汽車消費
1 材料管理:記錄材料的使用情況,包括新增,刪除,修改。材料使用記錄以下一些字段:
記錄編號、材料編號、數量、單價、供貨商、日期、總價。
2 訂單管理:訂單的新增,刪除,修改等功能。訂單記錄包括:客戶、聯系電話、規格、單價、數量、預付款
3 員工管理:員工的新增、刪除、查詢和修改。員工信息包括:用戶工號、姓名、性別、電話、地址、學歷、出生日期。
4 工資管理:工資錄入,查詢和修改。工資信息包括:姓名,身份證、籍貫、月份、工資
5 財務管理:財務管理包括財務的新增、刪除、修改等操作。財務信息包括:記錄編號、客戶名、聯系電話、規格、單價、數量、預付款、總報價剩余款、發生日期。
6 汽車消費:記錄公司汽車消費情況。汽車消費包含字段信息包括:記錄編號、車牌號、消費日期、金額。
7 對所有功能模塊的單據進行打印操作。
系統運行效果
關鍵代碼
package salary; import javax.swing.*; import javax.swing.event.TreeModelEvent; import javax.swing.event.TreeModelListener; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; import javax.swing.tree.DefaultMutableTreeNode; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.print.PrinterException; public class Main_window implements TreeModelListener,TreeSelectionListener{private JPanel panel,panel_1;private JTree tree;private JLabel label,label_1; private JMenuBar menubar; private JMenu menu1,menu2,menu3,menu4,menu5;private DefaultMutableTreeNode node1,node2,node3,node5,node6,leftnode1,leftnode4,leftnode5,leftnode7,leftnode8,leftnode11,rightnode1,rightnode2;JPanel panel_2 = new JPanel(); //中間主要操作區的panelJFrame jf = new JFrame("博森賬務管理");JPanel panel1 = new JPanel(); //創建一個panel對象JPanel panel2 = new JPanel();ImageIcon bottom = new ImageIcon("image\\bottom.jpg");ImageIcon top = new ImageIcon("image\\top.jpg");JLabel label1 = new JLabel(top); //兩個panel盛放兩張圖片JLabel label2 = new JLabel(bottom);public void Main_window(){try{ //設置觀感器 UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");}catch(Exception e1){e1.printStackTrace();}final Container contentpane = jf.getContentPane(); //獲得內容面板jf.getContentPane().setLayout(new BorderLayout());panel1 = (JPanel)contentpane;jf.setSize(1000, 667);panel2.setLayout(new BorderLayout());jf.setJMenuBar(getMenubar());panel_2.setBackground(Color.lightGray);panel_2 = getPanel_1();jf.getContentPane().add(getLabel(), BorderLayout.SOUTH);jf.getContentPane().add(getPanel(), BorderLayout.NORTH);jf.getContentPane().add(getTree(), BorderLayout.WEST);jf.getContentPane().add(panel_2, BorderLayout.CENTER);jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //設置jf的可關性jf.setLocation(130,50);jf.setVisible(true);jf.setResizable(false); jf.show();}/*** @return*/protected JLabel getLabel() { //標簽if (label == null) {label = new JLabel(bottom);label.setText("");}return label;}/*** @return*/protected JPanel getPanel() { //盛放top.jpgif (panel == null) {panel = new JPanel();panel.setLayout(new GridLayout(1, 0));panel.add(getLabel_1());}return panel;}/*** @return*/protected JLabel getLabel_1() { //盛放top.jpg的labelif (label_1 == null) {label_1 = new JLabel(top);label_1.setText("");}return label_1;}/*** @return*/protected JTree getTree() { //樹形結構if (tree == null) { DefaultMutableTreeNode root = new DefaultMutableTreeNode("廣州博森賬務管理系統"); //創建根節點node1 = new DefaultMutableTreeNode("材料管理");node5 = new DefaultMutableTreeNode("賬務管理");node2 = new DefaultMutableTreeNode("訂單管理");node3 = new DefaultMutableTreeNode("員工信息管理");node6 = new DefaultMutableTreeNode("汽車消費");root.add(node1);root.add(node2);root.add(node3); root.add(node5);root.add(node6);leftnode1 = new DefaultMutableTreeNode("進料記錄");node1.add(leftnode1); leftnode4 = new DefaultMutableTreeNode("訂單記錄");node2.add(leftnode4);leftnode5 = new DefaultMutableTreeNode("員工信息記錄");node3.add(leftnode5); leftnode7 = new DefaultMutableTreeNode("工資管理");node3.add(leftnode7);leftnode8 = new DefaultMutableTreeNode("賬務查看"); node5.add(leftnode8);leftnode11 = new DefaultMutableTreeNode("消費查看");node6.add(leftnode11); rightnode2 = new DefaultMutableTreeNode("工資預支");leftnode7.add(rightnode2);tree = new JTree(root);tree.addTreeSelectionListener(this);tree.setBorder(BorderFactory.createLineBorder(Color.lightGray));}return tree;}/*** @return*/protected JPanel getPanel_1() { //中間主要操作區if (panel_1 == null) {panel_1 = new JPanel();panel_2 = new JPanel(); //盛放六個圖標panel_1.setBackground(Color.white);panel_2.setBackground(Color.white); panel_1.setLayout(new BorderLayout());//設置panel_1的布局管理器panel_2.setLayout(new GridLayout(2,3));ImageIcon icon1 = new ImageIcon("image\\材料.jpg");ImageIcon icon2 = new ImageIcon("image\\訂單.jpg");ImageIcon icon3 = new ImageIcon("image\\工程.jpg");ImageIcon icon4 = new ImageIcon("image\\工人.jpg");ImageIcon icon5 = new ImageIcon("image\\賬務.jpg");ImageIcon icon6 = new ImageIcon("image\\汽車.jpg");JLabel label5 = new JLabel(icon1);JLabel label6 = new JLabel(icon2);JLabel label7 = new JLabel(icon3);JLabel label8 = new JLabel(icon4);JLabel label9 = new JLabel(icon5);JLabel label10 = new JLabel(icon6);JLabel label1 = new JLabel(" "); //填充四周的空白JLabel label2 = new JLabel(" ");JLabel label3 = new JLabel(" ");JLabel label4 = new JLabel(" ");panel_1.setLayout(new BorderLayout()); panel_1.add(label1,BorderLayout.SOUTH);panel_1.add(label2,BorderLayout.EAST);panel_1.add(label3,BorderLayout.WEST);panel_1.add(label4,BorderLayout.NORTH);panel_1.add(panel_2,BorderLayout.CENTER);panel_2.add(label5);panel_2.add(label6);panel_2.add(label7);panel_2.add(label8);panel_2.add(label9);panel_2.add(label10);}return panel_1;} /*** @return*/protected JMenuBar getMenubar(){ //創建menubarif(menubar == null){try{ //設置觀感器 UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());}catch(Exception e1){e1.printStackTrace();}menubar = new JMenuBar();menubar.add(getMenu1());menubar.add(getMenu2());menubar.add(getMenu3());menubar.add(getMenu5());menubar.add(getMenu4()); }return menubar;}/*** @return*/ protected JMenu getMenu1(){if(menu1 == null){menu1 = new JMenu();menu1.setText("業績柱形圖(C)");//JMenuItem item1 = new JMenuItem("訂單查詢");//JMenuItem item2 = new JMenuItem("賬務查詢");//JMenuItem item3 = new JMenuItem("材料查詢");//JMenuItem item4 = new JMenuItem("員工工資查詢");//JMenuItem item6 = new JMenuItem("汽車消費查詢");JMenuItem item7 = new JMenuItem("業績柱形圖");item7.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){BarChart_d frame = new BarChart_d();frame.setLocation(130,50);frame.setSize(1000,667);frame.setVisible(true);}});// menu1.add(item1);// menu1.add(item2);// menu1.add(item3);// menu1.add(item4);// menu1.add(item6);menu1.add(item7);}return menu1;}/*** @return*/protected JMenu getMenu2(){if(menu2 == null){menu2 = new JMenu();menu2.setText("表單打印(P)");JMenuItem item1 = new JMenuItem("訂單"); JMenuItem item3 = new JMenuItem("賬務清單");JMenuItem item4 = new JMenuItem("材料清單");item1.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e) {try { Order o = new Order();panel_2.add(o.Order_window());o.table.print();} catch (Exception e1) {// TODO Auto-generated catch blocke1.printStackTrace();}}});item3.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e) {try { Finance f = new Finance();panel_2.add(f.Finance_window());f.table.print();} catch (Exception e1) {// TODO Auto-generated catch blocke1.printStackTrace();}}});item4.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e) {try { Material m = new Material();panel_2.add(m.Material_window());m.table.print();} catch (Exception e1) {// TODO Auto-generated catch blocke1.printStackTrace();}}});menu2.add(item1); menu2.add(item3);menu2.add(item4);}return menu2;}/*** @return*/protected JMenu getMenu3(){ //用戶管理模塊if(menu3 == null){menu3 = new JMenu();menu3.setText("用戶管理(U)");JMenuItem item1 = new JMenuItem("修改密碼");item1.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){new Admin().Admin_window(new Main_window().jf);}});JMenuItem item2 = new JMenuItem("注銷用戶");item2.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){new Admin().Admin_window(new Main_window().jf);}});JMenuItem item3 = new JMenuItem("創建用戶");item3.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){new Admin().Admin_window(new Main_window().jf);}});menu3.add(item1);menu3.add(item2);menu3.add(item3);}return menu3;}/*** @return*/protected JMenu getMenu4(){if(menu4 == null){menu4 = new JMenu();menu4.setText("幫助(H)");JMenuItem item1 = new JMenuItem("操作說明");menu4.add(item1); }return menu4;}/*** @return*/protected JMenu getMenu5(){if(menu5 == null){menu5 = new JMenu();menu5.setText("系統管理(S)");JMenuItem item1 = new JMenuItem("退出登錄");item1.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e) {// TODO Auto-generated method stubint i = JOptionPane.showConfirmDialog(null, "是否要退出?");if(i == 0){ jf.dispose();new Front_window().Front_window();}}});menu5.add(item1); }return menu5;}public void valueChanged(TreeSelectionEvent e) { //事件監聽器// TODO Auto-generated method stubDefaultMutableTreeNode node = (DefaultMutableTreeNode)e.getPath().getLastPathComponent();if(node.equals(leftnode1)){panel_2.removeAll();panel_2.add(new Material().Material_window()); }if(node.equals(leftnode4)){panel_2.removeAll();panel_2.add(new Order().Order_window());}if(node.equals(leftnode5)){panel_2.removeAll();panel_2.add(new Staff().Staff_window());}if(node.equals(rightnode1)){panel_2.removeAll();panel_2.add(new Salary_detail().Detail_window());}if(node.equals(rightnode2)){panel_2.removeAll();panel_2.add(new Salary_advance().advance_window());}if(node.equals(leftnode8)){panel_2.removeAll();panel_2.add(new Finance().Finance_window());}if(node.equals(leftnode11)){panel_2.removeAll();panel_2.add(new Vehicle().Vehicle_window());} }public void treeNodesChanged(TreeModelEvent e) {} //空方法,不必實現public void treeNodesInserted(TreeModelEvent e) {}public void treeNodesRemoved(TreeModelEvent e) {}public void treeStructureChanged(TreeModelEvent e) {} }總結
以上是生活随笔為你收集整理的Java 公司财务系统 窗体程序 完整源码的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【疑难解决】EasyCVR通过SDK接入
- 下一篇: win10设置自动关机