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

📄 myproduct.java

📁 JAVA产品存储系统
💻 JAVA
字号:

/*********************************************************************
 *     this class is designed by Amadan Gong
 *     MYproduct.java define a product class to contain the infomation
 *     about your product
 *     2008/9/22 
 *********************************************************************/
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.*;
import java.text.*;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

interface OnSalePlan{
	void setSaleDiscount();   
void setSaleDate();   
}

 abstract class product{
	  static int PID=0;
	  static int product_ID=0;
	  String product_name;
	  double product_price;
	  String product_description;
	  public product(){
		   product_ID=PID++;
	  }
	  abstract void addads();


}

 class software extends product implements OnSalePlan{
	int reqSpace;// required space(e.g. 6000)
    String os;// operating system(e.g. window)
    String SoftType;//software type(e.g. program, utilities)
	  public software(){
		   product_ID=PID++;
	  }
	  void addads(){
		    JFrame f1=null;  
			f1=new JFrame("ads!!!!!");
			Container contentPane=f1.getContentPane();
			JPanel buttonPanel=new JPanel();
			JLabel   pLabel   =   new   JLabel("");   
			ImageIcon   picture   =   new   ImageIcon("soft.jpg");   
			pLabel.setIcon(picture);   
	        contentPane.add(pLabel,BorderLayout.NORTH);
			f1.pack();
			f1.setVisible(true);
		//	f1.setExtendedState(JFrame.MAXIMIZED_BOTH); 
			f1.addWindowListener(new WindowAdapter(){
				public void windowClosing(WindowEvent e){
					dispose(); 
				}

				private void dispose() {
					// TODO Auto-generated method stub
					
				}
			});// TODO Auto-generated method stub
	  }
	public void setSaleDate() {
	    JFrame f1=null;  
		f1=new JFrame("SALE DATE!!!!!");
		Container contentPane=f1.getContentPane();
		JPanel buttonPanel=new JPanel();
		JLabel   pLabel   =   new   JLabel("");   
		ImageIcon   picture   =   new   ImageIcon("时间2.jpg");   
		pLabel.setIcon(picture);   
        contentPane.add(pLabel,BorderLayout.NORTH);
		f1.pack();
		f1.setVisible(true);
	//	f1.setExtendedState(JFrame.MAXIMIZED_BOTH); 
		f1.addWindowListener(new WindowAdapter(){
			public void windowClosing(WindowEvent e){
				dispose(); 
			}

			private void dispose() {
				// TODO Auto-generated method stub
				
			}
		});// TODO Auto-generated method stub

	}
	public void setSaleDiscount() {
	    JFrame f1=null;  
		f1=new JFrame("DisCount!!!!!");
		Container contentPane=f1.getContentPane();
		JPanel buttonPanel=new JPanel();
		JLabel   pLabel   =   new   JLabel("");   
		ImageIcon   picture   =   new   ImageIcon("折扣1.jpg");   
		pLabel.setIcon(picture);   
        contentPane.add(pLabel,BorderLayout.NORTH);
		f1.pack();
		f1.setVisible(true);
	//	f1.setExtendedState(JFrame.MAXIMIZED_BOTH); 
		f1.addWindowListener(new WindowAdapter(){
			public void windowClosing(WindowEvent e){
				dispose(); 
			}

			private void dispose() {
				// TODO Auto-generated method stub
				
			}
		});// TODO Auto-generated method stub
}
 }
 class stereo extends product{
	int speaker;// number of speackers(e.g. 2)
    int watts;// watts (e.g. 1000)
    void addads(){};
}

 class computer extends product{
	String ProcessorName;
	double ProcessorSpeed;
	int Memory;
	void addads(){};
}

 class desktop extends computer{
	 int MonitorSize;
	  public desktop(){
		   product_ID=PID++;
	  }
	  void addads(){
		    JFrame f1=null;  
			f1=new JFrame("ads!!!!!");
			Container contentPane=f1.getContentPane();
			JPanel buttonPanel=new JPanel();
			JLabel   pLabel   =   new   JLabel("");   
			ImageIcon   picture   =   new   ImageIcon("desktop.jpg");   
			pLabel.setIcon(picture);   
	        contentPane.add(pLabel,BorderLayout.NORTH);
			f1.pack();
			f1.setVisible(true);
		//	f1.setExtendedState(JFrame.MAXIMIZED_BOTH); 
			f1.addWindowListener(new WindowAdapter(){
				public void windowClosing(WindowEvent e){
					dispose(); 
				}

				private void dispose() {
					// TODO Auto-generated method stub
					
				}
			});// TODO Auto-generated method stub
	  }
		public void setSaleDate() {
		    JFrame f1=null;  
			f1=new JFrame("SALE DATE!!!!!");
			Container contentPane=f1.getContentPane();
			JPanel buttonPanel=new JPanel();
			JLabel   pLabel   =   new   JLabel("");   
			ImageIcon   picture   =   new   ImageIcon("时间3.jpg");   
			pLabel.setIcon(picture);   
	        contentPane.add(pLabel,BorderLayout.NORTH);
			f1.pack();
			f1.setVisible(true);
		//	f1.setExtendedState(JFrame.MAXIMIZED_BOTH); 
			f1.addWindowListener(new WindowAdapter(){
				public void windowClosing(WindowEvent e){
					dispose(); 
				}

				private void dispose() {
					// TODO Auto-generated method stub
					
				}
			});// TODO Auto-generated method stub
			
		}
		public void setSaleDiscount() {
		    JFrame f1=null;  
			f1=new JFrame("DisCount!!!!!");
			Container contentPane=f1.getContentPane();
			JPanel buttonPanel=new JPanel();
			JLabel   pLabel   =   new   JLabel("");   
			ImageIcon   picture   =   new   ImageIcon("折扣2.jpg");   
			pLabel.setIcon(picture);   
	        contentPane.add(pLabel,BorderLayout.NORTH);
			f1.pack();
			f1.setVisible(true);
		//	f1.setExtendedState(JFrame.MAXIMIZED_BOTH); 
			f1.addWindowListener(new WindowAdapter(){
				public void windowClosing(WindowEvent e){
					dispose(); 
				}

				private void dispose() {
					// TODO Auto-generated method stub
					
				}
			});// TODO Auto-generated method stub
}
 }
 class laptop extends computer{
	 double thickness;
	 double weight;
	  public laptop(){
		   product_ID=PID++;
	  }
	  void addads(){
		    JFrame f1=null;  
			f1=new JFrame("ads!!!!!");
			Container contentPane=f1.getContentPane();
			JPanel buttonPanel=new JPanel();
			JLabel   pLabel   =   new   JLabel("");   
			ImageIcon   picture   =   new   ImageIcon("laptop.jpg");   
			pLabel.setIcon(picture);   
	        contentPane.add(pLabel,BorderLayout.NORTH);
			f1.pack();
			f1.setVisible(true);
		//	f1.setExtendedState(JFrame.MAXIMIZED_BOTH); 
			f1.addWindowListener(new WindowAdapter(){
				public void windowClosing(WindowEvent e){
					dispose(); 
				}

				private void dispose() {
					// TODO Auto-generated method stub
					
				}
			});// TODO Auto-generated method stub
	  };
		public void setSaleDate() {
		    JFrame f1=null;  
			f1=new JFrame("SALE DATE!!!!!");
			Container contentPane=f1.getContentPane();
			JPanel buttonPanel=new JPanel();
			JLabel   pLabel   =   new   JLabel("");   
			ImageIcon   picture   =   new   ImageIcon("时间4.jpg");   
			pLabel.setIcon(picture);   
	        contentPane.add(pLabel,BorderLayout.NORTH);
			f1.pack();
			f1.setVisible(true);
		//	f1.setExtendedState(JFrame.MAXIMIZED_BOTH); 
			f1.addWindowListener(new WindowAdapter(){
				public void windowClosing(WindowEvent e){
					dispose(); 
				}

				private void dispose() {
					// TODO Auto-generated method stub
					
				}
			});// TODO Auto-generated method stub
			
		}
		public void setSaleDiscount() {
		    JFrame f1=null;  
			f1=new JFrame("DisCount!!!!!");
			Container contentPane=f1.getContentPane();
			JPanel buttonPanel=new JPanel();
			JLabel   pLabel   =   new   JLabel("");   
			ImageIcon   picture   =   new   ImageIcon("折扣3.jpg");   
			pLabel.setIcon(picture);   
	        contentPane.add(pLabel,BorderLayout.NORTH);
			f1.pack();
			f1.setVisible(true);
		//	f1.setExtendedState(JFrame.MAXIMIZED_BOTH); 
			f1.addWindowListener(new WindowAdapter(){
				public void windowClosing(WindowEvent e){
					dispose(); 
				}

				private void dispose() {
					// TODO Auto-generated method stub
					
				}
			});// TODO Auto-generated method stub
}
 }
class hometheater extends stereo{
	int channel;
	  public hometheater(){
		   product_ID=PID++;
	  }
	  void addads(){
		    JFrame f1=null;  
			f1=new JFrame("ads!!!!!");
			Container contentPane=f1.getContentPane();
			JPanel buttonPanel=new JPanel();
			JLabel   pLabel   =   new   JLabel("");   
			ImageIcon   picture   =   new   ImageIcon("home.jpg");   
			pLabel.setIcon(picture);   
	        contentPane.add(pLabel,BorderLayout.NORTH);
			f1.pack();
			f1.setVisible(true);
		//	f1.setExtendedState(JFrame.MAXIMIZED_BOTH); 
			f1.addWindowListener(new WindowAdapter(){
				public void windowClosing(WindowEvent e){
					dispose(); 
				}

				private void dispose() {
					// TODO Auto-generated method stub
					
				}
			});// TODO Auto-generated method stub
	  };
		public void setSaleDate() {
		    JFrame f1=null;  
			f1=new JFrame("SALE DATE!!!!!");
			Container contentPane=f1.getContentPane();
			JPanel buttonPanel=new JPanel();
			JLabel   pLabel   =   new   JLabel("");   
			ImageIcon   picture   =   new   ImageIcon("时间5.jpg");   
			pLabel.setIcon(picture);   
	        contentPane.add(pLabel,BorderLayout.NORTH);
			f1.pack();
			f1.setVisible(true);
		//	f1.setExtendedState(JFrame.MAXIMIZED_BOTH); 
			f1.addWindowListener(new WindowAdapter(){
				public void windowClosing(WindowEvent e){
					dispose(); 
				}

				private void dispose() {
					// TODO Auto-generated method stub
					
				}
			});// TODO Auto-generated method stub
			
		}
		public void setSaleDiscount() {
		    JFrame f1=null;  
			f1=new JFrame("DisCount!!!!!");
			Container contentPane=f1.getContentPane();
			JPanel buttonPanel=new JPanel();
			JLabel   pLabel   =   new   JLabel("");   
			ImageIcon   picture   =   new   ImageIcon("折扣1.jpg");   
			pLabel.setIcon(picture);   
	        contentPane.add(pLabel,BorderLayout.NORTH);
			f1.pack();
			f1.setVisible(true);
		//	f1.setExtendedState(JFrame.MAXIMIZED_BOTH); 
			f1.addWindowListener(new WindowAdapter(){
				public void windowClosing(WindowEvent e){
					dispose(); 
				}

				private void dispose() {
					// TODO Auto-generated method stub
					
				}
			});// TODO Auto-generated method stub
}
}
 class carstereo extends stereo{
	 boolean removable;
	  public carstereo(){
		   product_ID=PID++;
	  }
	  void addads(){
		    JFrame f1=null;  
			f1=new JFrame("ads!!!!!");
			Container contentPane=f1.getContentPane();
			JPanel buttonPanel=new JPanel();
			JLabel   pLabel   =   new   JLabel("");   
			ImageIcon   picture   =   new   ImageIcon("carstereo.jpg");   
			pLabel.setIcon(picture);   
	        contentPane.add(pLabel,BorderLayout.NORTH);
			f1.pack();
			f1.setVisible(true);
		//	f1.setExtendedState(JFrame.MAXIMIZED_BOTH); 
			f1.addWindowListener(new WindowAdapter(){
				public void windowClosing(WindowEvent e){
					dispose(); 
				}

				private void dispose() {
					// TODO Auto-generated method stub
					
				}
			});// TODO Auto-generated method stub
	  };
		public void setSaleDate() {
		    JFrame f1=null;  
			f1=new JFrame("SALE DATE!!!!!");
			Container contentPane=f1.getContentPane();
			JPanel buttonPanel=new JPanel();
			JLabel   pLabel   =   new   JLabel("");   
			ImageIcon   picture   =   new   ImageIcon("时间6.jpg");   
			pLabel.setIcon(picture);   
	        contentPane.add(pLabel,BorderLayout.NORTH);
			f1.pack();
			f1.setVisible(true);
		//	f1.setExtendedState(JFrame.MAXIMIZED_BOTH); 
			f1.addWindowListener(new WindowAdapter(){
				public void windowClosing(WindowEvent e){
					dispose(); 
				}

				private void dispose() {
					// TODO Auto-generated method stub
					
				}
			});// TODO Auto-generated method stub
			
		}
		public void setSaleDiscount() {
		    JFrame f1=null;  
			f1=new JFrame("DisCount!!!!!");
			Container contentPane=f1.getContentPane();
			JPanel buttonPanel=new JPanel();
			JLabel   pLabel   =   new   JLabel("");   
			ImageIcon   picture   =   new   ImageIcon("折扣2.jpg");   
			pLabel.setIcon(picture);   
	        contentPane.add(pLabel,BorderLayout.NORTH);
			f1.pack();
			f1.setVisible(true);
		//	f1.setExtendedState(JFrame.MAXIMIZED_BOTH); 
			f1.addWindowListener(new WindowAdapter(){
				public void windowClosing(WindowEvent e){
					dispose(); 
				}

				private void dispose() {
					// TODO Auto-generated method stub
					
				}
			});// TODO Auto-generated method stub
		}
 }
			




























/*
	 //定义产品方法
	  public Myproduct(){
			 product_ID=++FIRST_ID;
	  }
	 void set_pro(String name,String category,double price,String description)
	 {
		 product_name=name;
		 product_category=category;
		 product_price=price;
		 product_description=description;
	 }
	 //从键盘输入产品信息
	 public  void get_pro()
	 {
         System.out.println ("the product's name is : ");
         product_name =MyInput.readString();
         System.out.println ("the product's category is : ");
         product_category =MyInput.readString();
         System.out.println ("the product's price is : ");
    	 product_price =MyInput.readFloat();
         System.out.println ("the product's description is : ");
         product_description =MyInput.readString();
         
	 }
		public String toString(){
		 	return ("*ID*   "+ new java.text.DecimalFormat("00000").format(product_ID)+"   *NAME*  "+product_name + "   *CATEGORY*  "+product_category+"   *¥"+new java.text.DecimalFormat("0.00").format(product_price)+"   *DESCRIP*  "+product_description);
		 }
}*/

⌨️ 快捷键说明

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