Biblioteca Java - Blame information for rev 32
Subversion Repositories:
(root)/Courses and labs samples/ISP/Exemple_ISP_Cluj_2015/GuiDemo/src/guidemo/SampleApplication.java
Rev | Author | Line No. | Line |
---|---|---|---|
32 | mihai | 1 | /* |
2 | * To change this license header, choose License Headers in Project Properties. | ||
3 | * To change this template file, choose Tools | Templates | ||
4 | * and open the template in the editor. | ||
5 | */ | ||
6 | package guidemo; | ||
7 | |||
8 | /** | ||
9 | * | ||
10 | * @author Mihai Hulea mihai.hulea@aut.utcluj.ro | ||
11 | */ | ||
12 | public class SampleApplication extends javax.swing.JFrame { | ||
13 | |||
14 | /** | ||
15 | * Creates new form SampleApplication | ||
16 | */ | ||
17 | public SampleApplication() { | ||
18 | initComponents(); | ||
19 | } | ||
20 | |||
21 | /** | ||
22 | * This method is called from within the constructor to initialize the form. | ||
23 | * WARNING: Do NOT modify this code. The content of this method is always | ||
24 | * regenerated by the Form Editor. | ||
25 | */ | ||
26 | @SuppressWarnings("unchecked") | ||
27 | // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents | ||
28 | private void initComponents() { | ||
29 | |||
30 | jPanel1 = new javax.swing.JPanel(); | ||
31 | jLabel1 = new javax.swing.JLabel(); | ||
32 | jButton1 = new javax.swing.JButton(); | ||
33 | jTextField1 = new javax.swing.JTextField(); | ||
34 | menuBar = new javax.swing.JMenuBar(); | ||
35 | fileMenu = new javax.swing.JMenu(); | ||
36 | openMenuItem = new javax.swing.JMenuItem(); | ||
37 | saveMenuItem = new javax.swing.JMenuItem(); | ||
38 | saveAsMenuItem = new javax.swing.JMenuItem(); | ||
39 | exitMenuItem = new javax.swing.JMenuItem(); | ||
40 | editMenu = new javax.swing.JMenu(); | ||
41 | cutMenuItem = new javax.swing.JMenuItem(); | ||
42 | copyMenuItem = new javax.swing.JMenuItem(); | ||
43 | pasteMenuItem = new javax.swing.JMenuItem(); | ||
44 | deleteMenuItem = new javax.swing.JMenuItem(); | ||
45 | helpMenu = new javax.swing.JMenu(); | ||
46 | contentsMenuItem = new javax.swing.JMenuItem(); | ||
47 | aboutMenuItem = new javax.swing.JMenuItem(); | ||
48 | |||
49 | setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); | ||
50 | |||
51 | jLabel1.setText("Press this button:"); | ||
52 | |||
53 | jButton1.setText("jButton1"); | ||
54 | |||
55 | jTextField1.addActionListener(new java.awt.event.ActionListener() { | ||
56 | public void actionPerformed(java.awt.event.ActionEvent evt) { | ||
57 | jTextField1ActionPerformed(evt); | ||
58 | } | ||
59 | }); | ||
60 | |||
61 | javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); | ||
62 | jPanel1.setLayout(jPanel1Layout); | ||
63 | jPanel1Layout.setHorizontalGroup( | ||
64 | jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||
65 | .addGroup(jPanel1Layout.createSequentialGroup() | ||
66 | .addContainerGap() | ||
67 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) | ||
68 | .addComponent(jTextField1) | ||
69 | .addGroup(jPanel1Layout.createSequentialGroup() | ||
70 | .addComponent(jLabel1) | ||
71 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | ||
72 | .addComponent(jButton1))) | ||
73 | .addContainerGap(228, Short.MAX_VALUE)) | ||
74 | ); | ||
75 | jPanel1Layout.setVerticalGroup( | ||
76 | jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||
77 | .addGroup(jPanel1Layout.createSequentialGroup() | ||
78 | .addGap(24, 24, 24) | ||
79 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | ||
80 | .addComponent(jLabel1) | ||
81 | .addComponent(jButton1)) | ||
82 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | ||
83 | .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | ||
84 | .addContainerGap(206, Short.MAX_VALUE)) | ||
85 | ); | ||
86 | |||
87 | fileMenu.setMnemonic('f'); | ||
88 | fileMenu.setText("File"); | ||
89 | |||
90 | openMenuItem.setMnemonic('o'); | ||
91 | openMenuItem.setText("Open"); | ||
92 | fileMenu.add(openMenuItem); | ||
93 | |||
94 | saveMenuItem.setMnemonic('s'); | ||
95 | saveMenuItem.setText("Save"); | ||
96 | fileMenu.add(saveMenuItem); | ||
97 | |||
98 | saveAsMenuItem.setMnemonic('a'); | ||
99 | saveAsMenuItem.setText("Save As ..."); | ||
100 | saveAsMenuItem.setDisplayedMnemonicIndex(5); | ||
101 | fileMenu.add(saveAsMenuItem); | ||
102 | |||
103 | exitMenuItem.setMnemonic('x'); | ||
104 | exitMenuItem.setText("Exit"); | ||
105 | exitMenuItem.addActionListener(new java.awt.event.ActionListener() { | ||
106 | public void actionPerformed(java.awt.event.ActionEvent evt) { | ||
107 | exitMenuItemActionPerformed(evt); | ||
108 | } | ||
109 | }); | ||
110 | fileMenu.add(exitMenuItem); | ||
111 | |||
112 | menuBar.add(fileMenu); | ||
113 | |||
114 | editMenu.setMnemonic('e'); | ||
115 | editMenu.setText("Edit"); | ||
116 | |||
117 | cutMenuItem.setMnemonic('t'); | ||
118 | cutMenuItem.setText("Cut"); | ||
119 | editMenu.add(cutMenuItem); | ||
120 | |||
121 | copyMenuItem.setMnemonic('y'); | ||
122 | copyMenuItem.setText("Copy"); | ||
123 | editMenu.add(copyMenuItem); | ||
124 | |||
125 | pasteMenuItem.setMnemonic('p'); | ||
126 | pasteMenuItem.setText("Paste"); | ||
127 | editMenu.add(pasteMenuItem); | ||
128 | |||
129 | deleteMenuItem.setMnemonic('d'); | ||
130 | deleteMenuItem.setText("Delete"); | ||
131 | editMenu.add(deleteMenuItem); | ||
132 | |||
133 | menuBar.add(editMenu); | ||
134 | |||
135 | helpMenu.setMnemonic('h'); | ||
136 | helpMenu.setText("Help"); | ||
137 | |||
138 | contentsMenuItem.setMnemonic('c'); | ||
139 | contentsMenuItem.setText("Contents"); | ||
140 | helpMenu.add(contentsMenuItem); | ||
141 | |||
142 | aboutMenuItem.setMnemonic('a'); | ||
143 | aboutMenuItem.setText("About"); | ||
144 | helpMenu.add(aboutMenuItem); | ||
145 | |||
146 | menuBar.add(helpMenu); | ||
147 | |||
148 | setJMenuBar(menuBar); | ||
149 | |||
150 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); | ||
151 | getContentPane().setLayout(layout); | ||
152 | layout.setHorizontalGroup( | ||
153 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||
154 | .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | ||
155 | ); | ||
156 | layout.setVerticalGroup( | ||
157 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | ||
158 | .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | ||
159 | ); | ||
160 | |||
161 | pack(); | ||
162 | }// </editor-fold>//GEN-END:initComponents | ||
163 | |||
164 | private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuItemActionPerformed | ||
165 | System.exit(0); | ||
166 | }//GEN-LAST:event_exitMenuItemActionPerformed | ||
167 | |||
168 | private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed | ||
169 | // TODO add your handling code here: | ||
170 | }//GEN-LAST:event_jTextField1ActionPerformed | ||
171 | |||
172 | /** | ||
173 | * @param args the command line arguments | ||
174 | */ | ||
175 | public static void main(String args[]) { | ||
176 | /* Set the Nimbus look and feel */ | ||
177 | //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> | ||
178 | /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. | ||
179 | * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html | ||
180 | */ | ||
181 | try { | ||
182 | for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { | ||
183 | if ("Nimbus".equals(info.getName())) { | ||
184 | javax.swing.UIManager.setLookAndFeel(info.getClassName()); | ||
185 | break; | ||
186 | } | ||
187 | } | ||
188 | } catch (ClassNotFoundException ex) { | ||
189 | java.util.logging.Logger.getLogger(SampleApplication.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | ||
190 | } catch (InstantiationException ex) { | ||
191 | java.util.logging.Logger.getLogger(SampleApplication.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | ||
192 | } catch (IllegalAccessException ex) { | ||
193 | java.util.logging.Logger.getLogger(SampleApplication.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | ||
194 | } catch (javax.swing.UnsupportedLookAndFeelException ex) { | ||
195 | java.util.logging.Logger.getLogger(SampleApplication.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); | ||
196 | } | ||
197 | //</editor-fold> | ||
198 | |||
199 | /* Create and display the form */ | ||
200 | java.awt.EventQueue.invokeLater(new Runnable() { | ||
201 | public void run() { | ||
202 | new SampleApplication().setVisible(true); | ||
203 | } | ||
204 | }); | ||
205 | } | ||
206 | |||
207 | // Variables declaration - do not modify//GEN-BEGIN:variables | ||
208 | private javax.swing.JMenuItem aboutMenuItem; | ||
209 | private javax.swing.JMenuItem contentsMenuItem; | ||
210 | private javax.swing.JMenuItem copyMenuItem; | ||
211 | private javax.swing.JMenuItem cutMenuItem; | ||
212 | private javax.swing.JMenuItem deleteMenuItem; | ||
213 | private javax.swing.JMenu editMenu; | ||
214 | private javax.swing.JMenuItem exitMenuItem; | ||
215 | private javax.swing.JMenu fileMenu; | ||
216 | private javax.swing.JMenu helpMenu; | ||
217 | private javax.swing.JButton jButton1; | ||
218 | private javax.swing.JLabel jLabel1; | ||
219 | private javax.swing.JPanel jPanel1; | ||
220 | private javax.swing.JTextField jTextField1; | ||
221 | private javax.swing.JMenuBar menuBar; | ||
222 | private javax.swing.JMenuItem openMenuItem; | ||
223 | private javax.swing.JMenuItem pasteMenuItem; | ||
224 | private javax.swing.JMenuItem saveAsMenuItem; | ||
225 | private javax.swing.JMenuItem saveMenuItem; | ||
226 | // End of variables declaration//GEN-END:variables | ||
227 | |||
228 | } |