zsh_root
2024-01-02 7b595546af704983dbafcd0d385c8768ddacefc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
package relloc;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextField;
 
import ColorAndFont.ChooseFont;
import PbuliClass.JButtonModel;
import PbuliClass.ShowMessage;
import person.Person;
import person.person_Dell;
public class Sousuo extends JDialog implements WindowListener {
    
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    JTextField text=null;//Îı¾¿ò
    JPanel mb=null;//ÉêÃ÷Ò»¸öÃæ°å
    JButtonModel serch=null;//²éÕÒ±êÇ©
    boolean sou=false;
    
    /**»ñÈ¡¶Ô»°¿ò·½·¨*/
    public Sousuo(String title) {        
        super();
        this.setAlwaysOnTop(true);//×ÜÊÇÖö¥
        this.setTitle(title);
        Toolkit toolkit = getToolkit();// »ñµÃ´°Ì幤¾ß°ü
        Dimension screenSize = toolkit.getScreenSize();// »ñÈ¡ÆÁÄ»´óС
        int width = (int) (screenSize.width* 0.5);// ¼ÆËã´°Ìåпí¶È
        int height = (int) (screenSize.height * 0.5);// ¼ÆËã´°Ìåпí¶È
        int w=320;
        int h=80;
        int x0=width-w/2;//´°Ìåx0×ø±ê
        int y0=height-h/2;//´°Ìåy0×ø±ê
        Container rq=getContentPane();        
        rq.add(getMb());
        this.setBounds(x0, y0,w,h);
        this.addWindowListener((WindowListener) this);
        this.setVisible(true);
    }
    
    /**»ñÈ¡Ãæ°å*/
    public JPanel getMb() {
        if(mb==null){
            mb=new JPanel();
            mb.setLayout(null);
            mb.setBackground(Color.white);
            mb.add(gettext());
            int x=10;
            int y=3;
            int height=30;
            text.setBounds(x, y,200, height);            
            mb.add(getserch());
            serch.setBounds(x+200, y,80, height);
            
        }
        return mb;
    }
    
    public JTextField gettext() {
        if(text==null) {
            text=new JTextField(10);
            text.setFont(ChooseFont.getFont(14));
            text.setForeground(Color.red);
        }
        return text;
    }
    
    /**ËÑË÷°´Å¥*/
    public JButtonModel getserch() {
        if(serch==null) {
            serch=new JButtonModel("ËÑË÷");
            serch.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    String tagid=text.getText().replaceAll(" ", "");
                    Person person=person_Dell.get_Person(tagid);
                    if(person==null) {
                        ShowMessage.zidingyi("ÄãËÑË÷µÄ"+tagid+"²»´æÔÚ");
                        return;
                    }
                    if(sou) {
                        sou=false;
                        serch.setText("È¡Ïû");
                        person.setIschoose(0);
                    }else {
                        sou=true;
                        serch.setText("ËÑË÷");
                        person.setIschoose(1);
                    }
                }
            });
        }
        return serch;
    }
    
    
    @Override
    public void windowOpened(WindowEvent e) {
        // TODO ×Ô¶¯Éú³ÉµÄ·½·¨´æ¸ù
        
    }
 
    @Override
    public void windowClosing(WindowEvent e) {
        Tanchu_Menu.setOpensou(false);
        person_Dell.alert_no_choose();
        
    }
 
    @Override
    public void windowClosed(WindowEvent e) {
        
        
    }
 
    @Override
    public void windowIconified(WindowEvent e) {
        // TODO ×Ô¶¯Éú³ÉµÄ·½·¨´æ¸ù
        
    }
 
    @Override
    public void windowDeiconified(WindowEvent e) {
        // TODO ×Ô¶¯Éú³ÉµÄ·½·¨´æ¸ù
        
    }
 
    @Override
    public void windowActivated(WindowEvent e) {
        // TODO ×Ô¶¯Éú³ÉµÄ·½·¨´æ¸ù
        
    }
 
    @Override
    public void windowDeactivated(WindowEvent e) {
        // TODO ×Ô¶¯Éú³ÉµÄ·½·¨´æ¸ù
        
    }
 
}