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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
package PbuliClass;
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.ImageIcon;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextField;
import DataBase.DatabaseManagement;
import Frame.AnchorManage;
import Method.Bj;
import Method.GetNowTime;
import anchor.Anchor_Dell;
public class FastAddAnc extends JDialog implements WindowListener {
 
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
 
    JPanel mb=null;
    JlableModel  anchorId=new JlableModel("»ùÕ¾µÄID:");//»ùÕ¾id    
    JlableModel  posx=new JlableModel("X×ø±ê(cm):");//x×ø±ê
    JlableModel  posy=new JlableModel("Y×ø±ê(cm):");//y×ø±ê
    JlableModel  posz=new JlableModel("Z×ø±ê(cm):");//z×ø±ê
    
    JTextField anchornum=null;//»ùÕ¾×ÜÊý
    JTextField anchorIdFile=null;//»ùÕ¾idÎı¾¿ò
    JTextField posxFile=null;//x×ø±êÎı¾¿ò
    JTextField posyFile=null;//y×ø±êÎı¾¿ò
    JTextField poszFile=null;//z×ø±êÎı¾¿ò
    JButtonModel sure=null;//È·¶¨°´Å¥
    /**¹Ø±Õ¶Ô»°¿ò·½·¨*/
    public void closeTagDialog() {
        this.dispose();
 
    }
 
    /**»ñÈ¡¶Ô»°¿ò·½·¨*/
    public FastAddAnc(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 x0=width-200;//´°Ìåx0×ø±ê
        int y0=height-230;//´°Ìåy0×ø±ê
        Container rq=getContentPane();        
        rq.add(getMb());
        this.setBounds(x0, y0, 450, 300);
        this.addWindowListener((WindowListener) this);
        this.setVisible(true);
        this.setIconImage(new ImageIcon("image/icon/versionicon.png").getImage());
    }
 
    /**»ñÈ¡Ãæ°å*/
    public JPanel getMb() {
        if(mb==null){
            mb=new JPanel();            
            mb.setLayout(null);
            mb.setBackground(Color.white);
            int x=50;
            int y=30;
            int height=25;
            mb.add(anchorId);
            mb.add(posx);
            mb.add(posy);
            mb.add(posz);
            
            mb.add(getAnchorIdFile());
            mb.add(getPosxFile());
            mb.add(getPosyFile());
            mb.add(getPoszFile());
            mb.add(getSure());
            mb.add(getAnchornum());
            int x0=100;    
            int w=230;
            anchorId.setBounds(x, y, x0, height);
            anchorIdFile.setBounds(x+x0, y,100, height);
            anchornum.setBounds(x+x0+110, y,w-110, height);
            
            int y1=y+25+20;            
            posx.setBounds(x, y1, x0, height);
            posxFile.setBounds(x+x0, y1,w, height);
            
            int y2=y1+25+20;    
            posy.setBounds(x, y2, x0, height);
            posyFile.setBounds(x+x0, y2,w, height);
            
            int y3=y2+25+20;    
            posz.setBounds(x, y3, x0, height);
            poszFile.setBounds(x+x0, y3,w, height);
            
            int y4=y3+45;
            sure.setBounds(165, y4, 120, height);
            
            
        }
        return mb;
    }
    public JTextField getAnchorIdFile() {
        if(anchorIdFile==null) {
            anchorIdFile=new JTextField(10);
        }
 
        return anchorIdFile;
    }
    public JTextField getPosxFile() {
        if(posxFile==null) {
            posxFile=new JTextField(10);
        }
 
        return posxFile;
    }
    public JTextField getPosyFile() {
        if(posyFile==null) {
            posyFile=new JTextField(10);
        }
        return posyFile;
    }
 
    /**»ñÈ¡Z×ø±êµÄÎı¾¿ò*/
    public JTextField getPoszFile() {
        if(poszFile==null) {
            poszFile=new JTextField(10);
        }
        return poszFile;
    }
    
    
    /**»ñȡȷ¶¨°´Å¥*/
    public JButtonModel getSure() {
        if(sure==null) {
            sure=new JButtonModel("È·  ¶¨");
            sure.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {                        
                    String acr=anchorIdFile.getText();
                    String x=posxFile.getText();
                    String y=posyFile.getText();
                    String z=poszFile.getText();
                    String[]  ziduan= {"anchorid","POSX","POSY","POSZ","layer","zu","liangcheng","GreateTime"};
                    String[] zhi= {acr,x,y,z,"0","0","65535",GetNowTime.now()};
                    DatabaseManagement.insertfast("tb_achor", ziduan, zhi);
                    AnchorManage.add_new_anchor_do(acr, x, y, z, "0", "0", "65535", "","0","1","0");
                    Bj.setHavefas(false);
                    int ac=Integer.parseInt(acr);
                    Bj.setAnc(ac+1);
                    closeTagDialog() ;
                }
            });
        }
 
        return sure;
    }
 
    @Override
    public void windowOpened(WindowEvent e) {
        // TODO ×Ô¶¯Éú³ÉµÄ·½·¨´æ¸ù
        
    }
 
    @Override
    public void windowClosing(WindowEvent e) {
        Bj.setHavefas(false);
        
    }
 
    @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 ×Ô¶¯Éú³ÉµÄ·½·¨´æ¸ù
        
    }
 
    public JTextField getAnchornum() {
        if(anchornum==null) {            
            anchornum=new JTextField("»ùÕ¾×ÜÊý£º"+Anchor_Dell.getAnchor_vector().size());
            anchornum.setEnabled(false);
        }
        return anchornum;
    }
 
}