|  | 
                     
                      | 
                           
                            |  |  
                            |  - - - - - - - - - - - - - - ผู้ให้การสนับสนุน- - - - - - - - - - - - - - 
 |  						    
                      		|  |  						    
                      		|  |   
                            |  กระทู้ #1980 [Java] (จาก IP: 125.24.242.206) 
                                 
                                  | อยากจะได้ source code เกี่ยวกับการ search 
                                      คืออยากจะถามว่า ถ้าเราต้องการหา source code ที่เกี่ยวกับการ insert และ search ข้อมูลที่เราใส่เข้าไป จะไปหาได้จากไหนหรอครับ คือว่าผมต้องเอาตัวนี้ไปเปรียบเทียบกับ ตัวproject จบ ที่ผมทำอ่ะครับ ว่ามานเร็วกว่าหรือช้ากว่ายังไงขนาดไหน 
 |   
                                  | จากคุณ 
                                    : 
                                    Tong / the_crown_bear@hotmail.com                                    [2008-04-24 02:51:30] |   |  
  ความคิดเห็น  #26714  (จาก IP: 203.149.53.82) 
                                 
                                  | คือ.. ผมไม่ทราบนะครับว่าจะหาได้จากที่ไหน หากเป็นการหาจาก database แล้วหละก็เขาก็คงหาคล้ายคุณแหละครับ ... มันอยู่ที่ข้อมูลที่ค้นหามีมากน้อยแค่ไหน, query โหดหรือเปล่า แค่เท่านี้ความเร็วมันก็ต่างกันแล้วครับ อย่างที่ผมใช้อยู่ตอนนี้เป็น Search Engine ที่เขียนด้วย c ข้อมูลทั้งหมดประมาณ 300000+ rows ค้นหาทุก column เวลาที่ใช้จะประมาณ ไม่เกิน 2 วิ ครับ ... แต่ถ้าเป็นเป็นจาก database ด้วยข้อมูลเดียวกันเวลาที่ได้จะประมาณ 5 วิ อย่างน้อย...
 ^_^ คิดว่าคงช่วยได้บ้างนะ
 |   
                                  | จากคุณ 
                                    : 
                                    Boysoot                                    [2008-04-30 09:23:42] |  |  
  ความคิดเห็น  #27113  (จาก IP: 203.158.215.80) 
                                 
                                  | import java.awt.*; import java.awt.event.*;
 import javax.swing.*;
 
 public class  Final_151_1 extends JFrame implements ActionListener, MouseListener, KeyListener {
 private final static int SHOW = 16;
 private int countIce=0;
 private int totalPrice=0;
 private JLabel lblShow=new JLabel("Select ice scream.",SwingConstants.CENTER);
 private JLabel showPic[]=new JLabel[SHOW];
 private JLabel showPrice[]=new JLabel[SHOW];
 private JPanel panelShow[]=new JPanel[SHOW];
 private JPanel panelPic=new JPanel();
 private String iceName[]={"ʵÃÍàºÍÃÕè","ªçͤâ¡áÅçµ","¤ÃÕÁªÕÊ","ÁÑÅàºÍÃÕè","᤹µÒÅÙ»","ÁйÒÇ","¡ÅéÇÂËÍÁ",
 "ÃÒÊàºÍÃÕè","ÁÐÁèǧ","¡Ð·ÔÊ´","áÍ»à»ÔéÅ","Áͤ¤èÒ","ÇÒ¹ÔÅÅÒ","ÅÔ鹨Õè","ÊéÁ","¹éÍÂ˹èÒ"};
 private TextArea txtArea=new TextArea("",7,25,0);
 private JTextField txtTotal=new JTextField(5);
 private JTextField txtGetMoney=new JTextField(5);
 private JTextField txtOutMoney=new JTextField(5);
 private JLabel labelTotal=new JLabel("ÃÒ¤Ò");
 private JLabel labelGetMoney=new JLabel("ÃѺà§Ô¹");
 private JLabel labelOutMoney=new JLabel("·Í¹à§Ô¹");
 private JPanel panelMoney=new JPanel();
 private JPanel panelOne=new JPanel();
 private JPanel panelTwo=new JPanel();
 private JPanel panelThree=new JPanel();
 private JPanel panel123=new JPanel();
 private JPanel panelIceScream=new JPanel();
 private final String newline = "\n";
 
 public Final_151_1(){
 super("IceScream Shop");
 panelIceScream.setLayout(new BorderLayout());
 lblShow.setFont(new Font(lblShow.getFont().toString(),Font.BOLD,20));
 panelIceScream.add(lblShow,BorderLayout.NORTH);
 panelIceScream.setBackground(Color.white);
 panelPic.setLayout(new GridLayout(2,8));
 panelPic.setBackground(Color.white);
 for(int i=0; i<SHOW; i++){
 panelShow[i] = new JPanel();
 panelShow[i].setLayout(new BorderLayout());
 panelShow[i].add(new JLabel(new ImageIcon("ice"+(i+1)+".jpg")),BorderLayout.NORTH);
 panelShow[i].add(new JLabel(iceName[i],SwingConstants.CENTER),BorderLayout.CENTER);
 panelShow[i].add(new JLabel(" "),BorderLayout.SOUTH);
 panelShow[i].setBackground(Color.white);
 panelShow[i].addMouseListener(this);
 panelPic.add(panelShow[i]);
 }
 panelIceScream.add(panelPic,BorderLayout.SOUTH);
 
 panelMoney.setLayout(new BorderLayout());
 panelOne.setLayout(new FlowLayout(FlowLayout.RIGHT));
 panelTwo.setLayout(new FlowLayout(FlowLayout.RIGHT));
 panelThree.setLayout(new FlowLayout(FlowLayout.RIGHT));
 panel123.setLayout(new GridLayout(3,1));
 panelOne.add(labelTotal);
 panelOne.add(txtTotal);
 panelTwo.add(labelGetMoney);
 panelTwo.add(txtGetMoney);
 panelThree.add(labelOutMoney);
 panelThree.add(txtOutMoney);
 panel123.add(panelOne);
 panel123.add(panelTwo);
 panel123.add(panelThree);
 txtArea.setEditable(false);
 panelMoney.add(txtArea,BorderLayout.NORTH);
 panelMoney.add(panel123,BorderLayout.CENTER);
 
 Container container = getContentPane();
 container.setLayout(new BorderLayout());
 container.setBackground(Color.blue);
 container.add(panelIceScream,BorderLayout.WEST);
 container.add(panelMoney,BorderLayout.EAST);
 
 txtGetMoney.addKeyListener(this);
 
 setSize(780, 250);
 setVisible(true);
 
 }
 
 public static void main(String[] args) {
 Final_151_1 app = new Final_151_1();
 app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 }
 
 public void actionPerformed(ActionEvent e){}
 public void mouseClicked(MouseEvent e){
 
 for(int i=0; i<SHOW; i++){
 if (e.getSource()==panelShow[i]){
 txtArea.append(++countIce+"."+iceName[i]+newline );
 totalPrice=(countIce*20);
 txtTotal.setText(Integer.toString(totalPrice));
 
 
 
 }
 }
 
 }
 
 
 public void mouseReleased(MouseEvent e){}
 public void mousePressed(MouseEvent e){}
 public void mouseExited(MouseEvent e){}
 public void mouseEntered(MouseEvent e){}
 public void keyTyped(KeyEvent e){}
 public void keyReleased(KeyEvent e){}
 public void keyPressed(KeyEvent e){
 if ((e.getSource()==txtGetMoney)&&(e.getKeyCode()==KeyEvent.VK_ENTER)){
 if (Integer.parseInt(txtTotal.getText())<=Integer.parseInt(txtGetMoney.getText())){
 txtOutMoney.setText(Integer.parseInt(txtGetMoney.getText())-Integer.parseInt(txtTotal.getText())+"");
 txtGetMoney.setForeground(Color.BLACK);
 }
 if (Integer.parseInt(txtTotal.getText())>Integer.parseInt(txtGetMoney.getText())){
 txtOutMoney.setText("");
 txtGetMoney.setForeground(Color.RED);
 }
 }
 
 }
 }//Class
 |   
                                  | จากคุณ 
                                    : 
                                    4444 / 0876                                    [2008-09-22 10:18:15] |  |  |  
                            |  - - - - - - - - - - - - - - ผู้ให้การสนับสนุน- - - - - - - - - - - - - - 
 |  |  
                      |  |  |  |