PainelPosicoes.java
7.75 KB
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
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* painelposicoes.java
*
* Created on 13/08/2010, 16:51:28
*/
package gerador;
import javax.swing.JDialog;
import javax.swing.JTable;
/**
*
* @author felipel
*/
public class PainelPosicoes extends javax.swing.JPanel {
JTable tab;
private JDialog janela;
/** Creates new form painelposicoes */
public PainelPosicoes(JTable tabl) {
java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
this.setBounds((screenSize.width - 303) / 2, (screenSize.height - 244) / 2, 303, 244);
initComponents();
tab = tabl;
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
Dx = new javax.swing.JLabel();
displayx = new javax.swing.JTextField();
Dy = new javax.swing.JLabel();
displayy = new javax.swing.JTextField();
Dl = new javax.swing.JLabel();
displayl = new javax.swing.JTextField();
displayc = new javax.swing.JTextField();
Dc = new javax.swing.JLabel();
ok = new javax.swing.JButton();
cancel = new javax.swing.JButton();
setBackground(new java.awt.Color(251, 214, 65));
Dx.setText("Display X:");
displayx.setText("170");
Dy.setText("Display Y:");
displayy.setText("220");
Dl.setText("Display (Largura):");
displayl.setText("640");
displayc.setText("280");
Dc.setText("Display (Comprimento):");
ok.setText("Ok");
ok.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
okActionPerformed(evt);
}
});
cancel.setText("Cancel");
cancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cancelActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(Dx)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(displayx, javax.swing.GroupLayout.DEFAULT_SIZE, 191, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(Dy)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(displayy, javax.swing.GroupLayout.DEFAULT_SIZE, 192, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(Dl)
.addGap(18, 18, 18)
.addComponent(displayl, javax.swing.GroupLayout.DEFAULT_SIZE, 134, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(Dc)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(displayc, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(cancel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(ok, javax.swing.GroupLayout.DEFAULT_SIZE, 59, Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(23, 23, 23)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(Dx)
.addComponent(displayx, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ok))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(Dy)
.addComponent(displayy, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cancel))
.addGap(28, 28, 28)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(Dl)
.addComponent(displayl, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(Dc)
.addComponent(displayc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
private void okActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okActionPerformed
// TODO add your handling code here:
tab.setValueAt("(" + displayx.getText() + "," + displayy.getText() + ") " + "(" + displayl.getText() + "," + displayc.getText() + ")", 0, 2);
janela.dispose();
}//GEN-LAST:event_okActionPerformed
private void cancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelActionPerformed
// TODO add your handling code here:
janela.dispose();
}//GEN-LAST:event_cancelActionPerformed
public void setJanela(JDialog dialogo) {
janela = dialogo;
}
public void setDisplayX(String dx) {
displayx.setText(dx);
}
public void setDisplayY(String dy) {
displayy.setText(dy);
}
public void setDisplayL(String dl) {
displayl.setText(dl);
}
public void setDisplayC(String dc) {
displayc.setText(dc);
}
public void setaTudo() {
tab.setValueAt("(" + displayx.getText() + "," + displayy.getText() + ") " + "(" + displayl.getText() + "," + displayc.getText() + ")", 0, 2);
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel Dc;
private javax.swing.JLabel Dl;
private javax.swing.JLabel Dx;
private javax.swing.JLabel Dy;
private javax.swing.JButton cancel;
private javax.swing.JTextField displayc;
private javax.swing.JTextField displayl;
private javax.swing.JTextField displayx;
private javax.swing.JTextField displayy;
private javax.swing.JButton ok;
// End of variables declaration//GEN-END:variables
}