Biblioteca Java - Blame information for rev 4

Subversion Repositories:
Rev:
Rev Author Line No. Line
4 mihai 1 package oop.controltemperatura;
2  
3 /*
4  * To change this template, choose Tools | Templates
5  * and open the template in the editor.
6  */
7  
8 /**
9  *
10  * @author evo2
11  */
12 public class TermostatUI extends javax.swing.JFrame {
13  
14     Termostat tr;
15  
16     public TermostatUI(Termostat tr) {
17         this.tr = tr;
18         initComponents();
19     }
20     /**
21      * Creates new form TermostatUI
22      */
23     public TermostatUI() {
24         initComponents();
25     }
26  
27     void afiseazaStare(String s){
28         this.textStare.setText(s);
29     }
30  
31     void afiseazaTemperatura(String s){
32         this.textCurent.setText(s);
33     }
34  
35     /**
36      * This method is called from within the constructor to initialize the form.
37      * WARNING: Do NOT modify this code. The content of this method is always
38      * regenerated by the Form Editor.
39      */
40     @SuppressWarnings("unchecked")
41     // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
42     private void initComponents() {
43  
44         jLabel1 = new javax.swing.JLabel();
45         textMax = new javax.swing.JTextField();
46         jLabel2 = new javax.swing.JLabel();
47         textMin = new javax.swing.JTextField();
48         jLabel3 = new javax.swing.JLabel();
49         textCurent = new javax.swing.JTextField();
50         butonMaxMinus = new javax.swing.JButton();
51         butonMaxPlus = new javax.swing.JButton();
52         butonMinMinus = new javax.swing.JButton();
53         butonMinPlus = new javax.swing.JButton();
54         jLabel4 = new javax.swing.JLabel();
55         textStare = new javax.swing.JTextField();
56  
57         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
58  
59         jLabel1.setText("Termperatura maxima:");
60  
61         jLabel2.setText("Temperatura minima:");
62  
63         jLabel3.setText("Temperatura curenta:");
64  
65         butonMaxMinus.setText("-");
66         butonMaxMinus.addActionListener(new java.awt.event.ActionListener() {
67             public void actionPerformed(java.awt.event.ActionEvent evt) {
68                 butonMaxMinusActionPerformed(evt);
69             }
70         });
71  
72         butonMaxPlus.setText("+");
73         butonMaxPlus.addActionListener(new java.awt.event.ActionListener() {
74             public void actionPerformed(java.awt.event.ActionEvent evt) {
75                 butonMaxPlusActionPerformed(evt);
76             }
77         });
78  
79         butonMinMinus.setText("-");
80  
81         butonMinPlus.setText("+");
82  
83         jLabel4.setText("Stare:");
84  
85         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
86         getContentPane().setLayout(layout);
87         layout.setHorizontalGroup(
88             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
89             .addGroup(layout.createSequentialGroup()
90                 .addContainerGap()
91                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
92                     .addComponent(jLabel1)
93                     .addComponent(jLabel2)
94                     .addComponent(jLabel3)
95                     .addComponent(jLabel4))
96                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
97                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
98                     .addComponent(textMax, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
99                     .addComponent(textMin)
100                     .addComponent(textCurent)
101                     .addComponent(textStare))
102                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
103                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
104                     .addGroup(layout.createSequentialGroup()
105                         .addComponent(butonMaxMinus)
106                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
107                         .addComponent(butonMaxPlus))
108                     .addGroup(layout.createSequentialGroup()
109                         .addComponent(butonMinMinus)
110                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
111                         .addComponent(butonMinPlus)))
112                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
113         );
114         layout.setVerticalGroup(
115             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
116             .addGroup(layout.createSequentialGroup()
117                 .addContainerGap()
118                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
119                     .addComponent(jLabel1)
120                     .addComponent(textMax, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
121                     .addComponent(butonMaxMinus)
122                     .addComponent(butonMaxPlus))
123                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
124                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
125                     .addComponent(jLabel2)
126                     .addComponent(textMin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
127                     .addComponent(butonMinMinus)
128                     .addComponent(butonMinPlus))
129                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
130                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
131                     .addComponent(jLabel3)
132                     .addComponent(textCurent, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
133                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
134                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
135                     .addComponent(jLabel4)
136                     .addComponent(textStare, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
137                 .addContainerGap(16, Short.MAX_VALUE))
138         );
139  
140         pack();
141     }// </editor-fold>//GEN-END:initComponents
142  
143     private void butonMaxMinusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butonMaxMinusActionPerformed
144         int t = tr.citesteMax();
145         t = t - 1;
146         tr.setMax(t);
147         textMax.setText(""+t);
148     }//GEN-LAST:event_butonMaxMinusActionPerformed
149  
150     private void butonMaxPlusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butonMaxPlusActionPerformed
151         int t = tr.citesteMax();
152         t = t + 1;
153         tr.setMax(t);
154         textMax.setText(""+t);
155     }//GEN-LAST:event_butonMaxPlusActionPerformed
156  
157     /**
158      * @param args the command line arguments
159      */
160     public static void main(String args[]) {
161         /* Set the Nimbus look and feel */
162         //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
163         /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
164          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
165          */
166         try {
167             for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
168                 if ("Nimbus".equals(info.getName())) {
169                     javax.swing.UIManager.setLookAndFeel(info.getClassName());
170                     break;
171                 }
172             }
173         } catch (ClassNotFoundException ex) {
174             java.util.logging.Logger.getLogger(TermostatUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
175         } catch (InstantiationException ex) {
176             java.util.logging.Logger.getLogger(TermostatUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
177         } catch (IllegalAccessException ex) {
178             java.util.logging.Logger.getLogger(TermostatUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
179         } catch (javax.swing.UnsupportedLookAndFeelException ex) {
180             java.util.logging.Logger.getLogger(TermostatUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
181         }
182         //</editor-fold>
183  
184         /* Create and display the form */
185         java.awt.EventQueue.invokeLater(new Runnable() {
186             public void run() {
187                 new TermostatUI().setVisible(true);
188             }
189         });
190     }
191     // Variables declaration - do not modify//GEN-BEGIN:variables
192     private javax.swing.JButton butonMaxMinus;
193     private javax.swing.JButton butonMaxPlus;
194     private javax.swing.JButton butonMinMinus;
195     private javax.swing.JButton butonMinPlus;
196     private javax.swing.JLabel jLabel1;
197     private javax.swing.JLabel jLabel2;
198     private javax.swing.JLabel jLabel3;
199     private javax.swing.JLabel jLabel4;
200     private javax.swing.JTextField textCurent;
201     private javax.swing.JTextField textMax;
202     private javax.swing.JTextField textMin;
203     private javax.swing.JTextField textStare;
204     // End of variables declaration//GEN-END:variables
205 }