⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 inventorygui.java

📁 it is an inventory system which is used to maintain all the accounts of stores
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
        	jPanelUpdateEnter.setMaximumSize(new  Dimension(180, 30));        	jPanelUpdateEnter.setMinimumSize(new  Dimension(180, 30));        	jPanelUpdateEnter.setPreferredSize(new  Dimension(180, 30));        	jLabelUpdateBlank.setFont(new  Font("Dialog", 0, 12));        	jLabelUpdateBlank.setText("                                 ");        	jPanelUpdateEnter.add(jLabelUpdateBlank);        	jButtonUpdate.setFont(new  Font("Dialog", 0, 12));        	jButtonUpdate.setText("Update");        	jPanelUpdateEnter.add(jButtonUpdate);        	jPanelUpdateSub.add(jPanelUpdateEnter);        	jPanelUpdate.add(jPanelUpdateSub);			// Adds the Update Panel to the Tab Panel        	jTabbedPaneLayout.addTab("Update Prices", jPanelUpdate);			// Setup of the Financial Information Portion of the Tab Panel        	jPanelFinancialInformation.setLayout(new  BoxLayout(jPanelFinancialInformation,  BoxLayout.Y_AXIS));        	jPanelFinancialInformation.setBorder(new  javax.swing.border.TitledBorder(null, "Financial Information",         javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,         javax.swing.border.TitledBorder.DEFAULT_POSITION, new         Font("Dialog", 1, 11)));        	jPanelFinancialInformation.setMaximumSize(new  Dimension(200, 110));        	jPanelFinancialInformation.setMinimumSize(new  Dimension(200, 110));        	jPanelFinancialInformation.setPreferredSize(new  Dimension(200, 110));        	jPanelFinancialStatement.setLayout(new  BoxLayout(jPanelFinancialStatement,  BoxLayout.Y_AXIS));        	jPanelFinancialStatement.setMaximumSize(new  Dimension(500, 35));        	jPanelFinancialStatement.setMinimumSize(new  Dimension(147, 20));        	jPanelFinancialStatement.setPreferredSize(new  Dimension(150, 35));        	jLabelFinancialStatement.setFont(new  Font("Dialog", 0, 12));        	jLabelFinancialStatement.setText("The company currently holds $0.00 in cash.");        	jLabelFinancialStatement.setMaximumSize(new  Dimension(500, 16));        	jLabelFinancialStatement.setMinimumSize(new  Dimension(500, 16));        	jLabelFinancialStatement.setPreferredSize(new  Dimension(500, 16));        	jPanelFinancialStatement.add(jLabelFinancialStatement);        	jPanelFinancialInformation.add(jPanelFinancialStatement);		// Adds the Financial Information Panel to the Tab Panel        	jTabbedPaneLayout.addTab("Financial Information", jPanelFinancialInformation);			// Adds the Tabbed Panel to the Top Portion of the Layout        	jPanelLayoutTop.add(jTabbedPaneLayout);	// Adds the Top Portion of the Layout        	jSplitPaneLayout.setLeftComponent(jPanelLayoutTop);			// Setup of the Bottom Portion of the Layout        	jPanelLayoutBottom.setLayout(new  BoxLayout(jPanelLayoutBottom,  BoxLayout.Y_AXIS));        	jPanelLayoutBottom.setBorder(new  javax.swing.border.EtchedBorder());        	jPanelLayoutBottom.setMaximumSize(new  Dimension(1024, 768));        	jPanelLayoutBottom.setMinimumSize(new  Dimension(700, 390));        	jPanelLayoutBottom.setPreferredSize(new  Dimension(700, 390));        	jPanelInventory.setLayout(new  BoxLayout(jPanelInventory,  BoxLayout.Y_AXIS));	// Setup of the Inventory Panel        	jPanelInventory.setBorder(new  javax.swing.border.TitledBorder("Inventory"));        	jPanelInventory.setMaximumSize(new  Dimension(700, 370));        	jPanelInventory.setMinimumSize(new  Dimension(700, 370));        	jPanelInventory.setPreferredSize(new  Dimension(700, 370));                	// Setup of the Scroll Panel Containing the Inventory Table        	jScrollPaneInventory.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);                        	jScrollPaneInventory.setMinimumSize(new  Dimension(675, 330));        	jScrollPaneInventory.setPreferredSize(new  Dimension(675, 330));        	jScrollPaneInventory.setAutoscrolls(true);                	// Setup of the Inventory Table          	jTableInventory.setAutoResizeMode( JTable.AUTO_RESIZE_ALL_COLUMNS);        	jTableInventory.setMaximumSize(new  Dimension(32767, 32767));        	jTableInventory.setMinimumSize(new  Dimension(650, 350));        	jTableInventory.setPreferredScrollableViewportSize(new  Dimension(650, 350));        	jTableInventory.setPreferredSize(new  Dimension(650, 800));                	// Adds the Inventory Table to the Scroll Panel        	jScrollPaneInventory.setViewportView(jTableInventory);			// Adds the Scroll Panel to the Inventory Panel        	jPanelInventory.add(jScrollPaneInventory);			// Adds the Inventory Panel to the Bottom Layout        	jPanelLayoutBottom.add(jPanelInventory);			// Adds The Bottom Layout to the Bottom of the Split Panel        	jSplitPaneLayout.setRightComponent(jPanelLayoutBottom);			// Adds the Split Panel to the Layout Panel        	jPanelLayout.add(jSplitPaneLayout);	// Adds the Layout Panel to the Main Panel        	jPanelMain.add(jPanelLayout);	// Adds the Main Panel to the Frame        	getContentPane().add(jPanelMain);			// Setup of the File Menu and its Menu Items        	fileMenu.setText("File");	openMenuItem = new JMenuItem("Open...");	openMenuItem.setActionCommand("Open File");	openMenuItem.addActionListener(this);	fileMenu.add(openMenuItem);		        	saveMenuItem.setText("Save");        	saveMenuItem.setActionCommand("Save");        	saveMenuItem.addActionListener(this);        	fileMenu.add(saveMenuItem);			saveAsMenuItem = new JMenuItem("Save As...");	saveAsMenuItem.setActionCommand("Save As");	saveAsMenuItem.addActionListener(this);	fileMenu.add(saveAsMenuItem);		        	fileMenu.add(jSeparator1);        	exitMenuItem.setText("Exit");        	exitMenuItem.addActionListener(new  ActionListener() {            		public void actionPerformed( ActionEvent evt) {                		exitMenuItemActionPerformed(evt);            		}        	});        	fileMenu.add(exitMenuItem);			// Adds the File Menu to the Menu Bar        	menuBar.add(fileMenu);			// Setup of the Tools Menu and its Menu Items        	toolsMenu.setText("Tools");        	jMenuItemSalesData.setText("Sales Data");        	jMenuItemSalesData.setActionCommand("Sales Data");       	 jMenuItemSalesData.addActionListener(this);        	toolsMenu.add(jMenuItemSalesData);        	jMenuItemNewOrders.setText("New Orders");        	jMenuItemNewOrders.setActionCommand("New Orders");        	jMenuItemNewOrders.addActionListener(this);        	toolsMenu.add(jMenuItemNewOrders);        	jMenuItemLiquidation.setText("Liquidation");        	jMenuItemLiquidation.setActionCommand("Liquidation");        	jMenuItemLiquidation.addActionListener(this);        	toolsMenu.add(jMenuItemLiquidation);        	jMenuItemNewItem.setText("New Item");        	jMenuItemNewItem.setActionCommand("New Item");        	jMenuItemNewItem.addActionListener(this);        	toolsMenu.add(jMenuItemNewItem);        	jMenuItemUpdatePrice.setText("Update Prices");        	jMenuItemUpdatePrice.setActionCommand("Update Prices");        	jMenuItemUpdatePrice.addActionListener(this);        	toolsMenu.add(jMenuItemUpdatePrice);        	jMenuItemFinancialInformation.setText("Financial Information");        	jMenuItemFinancialInformation.setActionCommand("Financial Information");        	jMenuItemFinancialInformation.addActionListener(this);        	toolsMenu.add(jMenuItemFinancialInformation);			toolsMenu.add(jSeparator2);		        	jMenuItemSortName.setText("Sort by Item Name");        	sortGroup.add(jMenuItemSortName);        	jMenuItemSortName.setSelected(true);        	jMenuItemSortName.setActionCommand("Sort Name");        	jMenuItemSortName.addActionListener(this);      	jMenuItemSortID.setText("Sort by Item Number");  	sortGroup.add(jMenuItemSortID);        	jMenuItemSortID.setActionCommand("Sort ID");        	jMenuItemSortID.addActionListener(this);  		  	jMenuSortSubMenu.setText("Sort Inventory");  	jMenuSortSubMenu.add(jMenuItemSortName);  	jMenuSortSubMenu.add(jMenuItemSortID);  		  	toolsMenu.add(jMenuSortSubMenu);			jMenuItemUpdateFunds.setText("Update Funds");	jMenuItemUpdateFunds.setActionCommand("Update Funds");	jMenuItemUpdateFunds.addActionListener(this);			toolsMenu.add(jMenuItemUpdateFunds);			// Adds the Tools Menu to the Menu Bar        	menuBar.add(toolsMenu);			// Adds the Menu Bar to the Frame        	setJMenuBar(menuBar);			// Packs the Frame        	pack();                	// Refreshes the Table Data        	refreshTable();                	// Refreshes the Financial Information        	refreshFinancialInformation();    }    private void exitMenuItemActionPerformed( ActionEvent evt)    // Action of Exit Item on the File Menu    {    	int save = JOptionPane.showConfirmDialog(this,"Do you want to save?","", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);        	if(save == JOptionPane.YES_OPTION)        	{        		try{        			companyObject.endProgram();        		}        		catch(Exception e){			JOptionPane.showMessageDialog(null, "Saving Error", "File Error", JOptionPane.ERROR_MESSAGE);        		}        	}        	int exit = JOptionPane.showConfirmDialog(this,"Do you really want to exit?","", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);        	if(exit == JOptionPane.YES_OPTION)        		System.exit(0);    }        private void exitForm( WindowEvent evt)    // Handles the event of the form closing    {    	int save = JOptionPane.showConfirmDialog(this,"Do you want to save?","", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);        	if(save == JOptionPane.YES_OPTION)       	{        		try{        			companyObject.endProgram();        		}        		catch(Exception e){				JOptionPane.showMessageDialog(null, "Saving Error", "File Error", JOptionPane.ERROR_MESSAGE);		        		}        	}        	System.exit(0);    }        public static void main(String args[]) throws IOException    // Main function: creates a new object of inventoryGui and displays the graphical user interface    {        new InventoryGui().show();    }        // Gui Components    private  JFileChooser fileChooser;    private  JMenuItem jMenuItemUpdateFunds;    private  ButtonGroup sortGroup;    private  JMenu jMenuSortSubMenu;    private  JRadioButtonMenuItem jMenuItemSortName;    private  JRadioButtonMenuItem jMenuItemSortID;    private  JMenuItem exitMenuItem;    private  JMenu fileMenu;    private  JButton jButtonLiquidateEnter;    private  JButton jButtonNewItemEnter;    private  JButton jButtonOrderEnter;    private  JButton jButtonSalesEnter;    private  JButton jButtonUpdate;    private  JLabel jLabelFinancialStatement;    private  JLabel jLabelLiquidateBlank;    private  JLabel jLabelLiquidateItemNumber;    private  JLabel jLabelNewItemBlank;    private  JLabel jLabelNewItemDescprition;    private  JLabel jLabelNewItemInitialAmount;    private  JLabel jLabelNewItemItemNumber;    private  JLabel jLabelNewItemName;    private  JLabel jLabelNewItemOrderPrice;    private  JLabel jLabelNewItemSalesPrice;    private  JLabel jLabelOrderBlank;    private  JLabel jLabelOrderItemNumber;    private  JLabel jLabelOrderQuantity;    private  JLabel jLabelSalesBlank;    private  JLabel jLabelSalesItemNumber;    private  JLabel jLabelSalesQuantity;    private  JLabel jLabelUpdateBlank;    private  JLabel jLabelUpdateItemNumber;    private  JLabel jLabelUpdateOrderPrice;    private  JLabel jLabelUpdateSalesPrice;    private  JMenuItem jMenuItemFinancialInformation;    private  JMenuItem jMenuItemLiquidation;    private  JMenuItem jMenuItemNewItem;    private  JMenuItem jMenuItemNewOrders;    private  JMenuItem jMenuItemSalesData;    private  JMenuItem jMenuItemUpdatePrice;    private  JPanel jPanelLayoutBottom;    private  JPanel jPanelFinancialInformation;    private  JPanel jPanelFinancialStatement;    private  JPanel jPanelInventory;    private  JPanel jPanelLayout;    private  JPanel jPanelLayoutTop;    private  JPanel jPanelLiquidate;    private  JPanel jPanelLiquidateEnter;    private  JPanel jPanelLiquidateIItemNumber;    private  JPanel jPanelMain;    private  JPanel jPanelNewItem;    private  JPanel jPanelNewItemDescription;    private  JPanel jPanelNewItemEnter;    private  JPanel jPanelNewItemInitialAmount;    private  JPanel jPanelNewItemItemNumber;    private  JPanel jPanelNewItemLeft;    private  JPanel jPanelNewItemName;    private  JPanel jPanelNewItemOrderPrice;    private  JPanel jPanelNewItemRight;    private  JPanel jPanelNewItemSalesPrice;    private  JPanel jPanelOrderEnter;    private  JPanel jPanelOrderItemNumber;    private  JPanel jPanelOrderQuantity;    private  JPanel jPanelOrders;    private  JPanel jPanelSales;    private  JPanel jPanelSalesEnter;    private  JPanel jPanelSalesItemNumber;    private  JPanel jPanelSalesQuantity;    private  JPanel jPanelUpdate;    private  JPanel jPanelUpdateEnter;    private  JPanel jPanelUpdateItemNumber;    private  JPanel jPanelUpdateOrderPrice;    private  JPanel jPanelUpdateSalesPrice;    private  JPanel jPanelUpdateSub;    private  JScrollPane jScrollPaneInventory;    private  JSeparator jSeparator1;    private  JSeparator jSeparator2;    private  JSplitPane jSplitPaneLayout;    private  JTabbedPane jTabbedPaneLayout;    private  JTable jTableInventory;    private  JTextField jTextFieldNewItemDescrpition;    private  JTextField jTextFieldNewItemInitialAmount;    private  JTextField jTextFieldNewItemName;    private  JTextField jTextFieldNewItemOrderPrice;    private  JTextField jTextFieldNewItemSalesPrice;    private  JTextField jTextFieldOrderItemNumber;    private  JTextField jTextFieldOrderQuantity;    private  JTextField jTextFieldSalesItemNumber;    private  JTextField jTextFieldNewItemNumber;    private  JTextField jTextFieldSalesQuantity;    private  JTextField jTextFieldUpdateItemNumber;    private  JTextField jTextFieldUpdateOrderPrice;    private  JTextField jTextFieldUpdateSalesPrice;    private  JTextField jTextFieldlLiquidateItemNumber;    private  JMenuBar menuBar;    private  JMenuItem openMenuItem;    private  JMenuItem pasteMenuItem;    private  JMenuItem saveAsMenuItem;    private  JMenuItem saveMenuItem;    private  JMenu toolsMenu;   }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -