Windows Azure Cloud Storage ermöglicht es Ihnen bereits ab 0,10€ pro GB/Monat die Vorteile der Cloud zu nutzen.
Hypercell ein ] Hypercell aus ] Zeige Navigation ] Verstecke Navigation ]
c++.de  
   
Advanced Developers Conference     
Bücher-Shop mit Amazon (Buchkategorien)C++ : Referenzen zu C++ : C++ Builder : Visual C++ : C# : Java : Spieleprogrammierung : Systemprogrammierung Linux : Software-Entwicklung : .NET : Compilertechnik : Algorithmen & Datenstrukturen : Objektorientierung : Entwurfsmuster : UML : eXtreme Programming : Scrum : Projektmanagement : Software-Testing : Datenbanken : Tom DeMarco : Dilbert : User Friendly
C/C++ Forum :: Java ::  BigDecimal / String nach BigDecimal konvertieren  
Gehen Sie zu Seite Zurück  1, 2
  Zeige alle Beiträge auf einer Seite
Auf Beitrag antworten
Autor Nachricht
kristallkugel
Unregistrierter




Beitrag kristallkugel Unregistrierter 14:36:05 08.02.2010   Titel:              Zitieren

:( ich werd mein kopf gegen tisch gefühl nicht so wirklich los ...

illegal forward reference wäre meines wissens nach etwas in der art
Code:
String s = s;
Code:
String s = s;
Code:
String s = s;


ich habe keine ahnung ob du sowas in deinem code machst, du bist ja recht knausrig mit der preisgabe deines codes. ob der fehler wirklich bei deinem BigDecimal passiert? keine ahnung, aber ein guter anfang wäre zb den fehler komplett zu posten, eventuell auch gleich mal den ganzen relevanten code?
LiGERWooD
Unregistrierter




Beitrag LiGERWooD Unregistrierter 14:51:00 08.02.2010   Titel:              Zitieren

Code:
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
/*
 * TaschenrechnerView.java
 */

package taschenrechner;

import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.math.BigInteger;
import javax.swing.Timer;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JFrame;

/**
 * The application's main frame.
 */
public class TaschenrechnerView extends FrameView {

    public TaschenrechnerView(SingleFrameApplication app) {
        super(app);

        initComponents();

        // status bar initialization - message timeout, idle icon and busy animation, etc
        ResourceMap resourceMap = getResourceMap();
        int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
        messageTimer = new Timer(messageTimeout, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                statusMessageLabel.setText("");
            }
        });
        messageTimer.setRepeats(false);
        int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
        for (int i = 0; i < busyIcons.length; i++) {
            busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
        }
        busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
                statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
            }
        });
        idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
        statusAnimationLabel.setIcon(idleIcon);
        progressBar.setVisible(false);

        // connecting action tasks to status bar via TaskMonitor
        TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
        taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                String propertyName = evt.getPropertyName();
                if ("started".equals(propertyName)) {
                    if (!busyIconTimer.isRunning()) {
                        statusAnimationLabel.setIcon(busyIcons[0]);
                        busyIconIndex = 0;
                        busyIconTimer.start();
                    }
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(true);
                } else if ("done".equals(propertyName)) {
                    busyIconTimer.stop();
                    statusAnimationLabel.setIcon(idleIcon);
                    progressBar.setVisible(false);
                    progressBar.setValue(0);
                } else if ("message".equals(propertyName)) {
                    String text = (String)(evt.getNewValue());
                    statusMessageLabel.setText((text == null) ? "" : text);
                    messageTimer.restart();
                } else if ("progress".equals(propertyName)) {
                    int value = (Integer)(evt.getNewValue());
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(false);
                    progressBar.setValue(value);
                }
            }
        });
    }

    @Action
    public void showAboutBox() {
        if (aboutBox == null) {
            JFrame mainFrame = TaschenrechnerApp.getApplication().getMainFrame();
            aboutBox = new TaschenrechnerAboutBox(mainFrame);
            aboutBox.setLocationRelativeTo(mainFrame);
        }
        TaschenrechnerApp.getApplication().show(aboutBox);
    }

    /** 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">                          
    private void initComponents() {

        mainPanel = new javax.swing.JPanel();
        Display = new javax.swing.JTextField();
        ZifferNull = new javax.swing.JButton();
        ZifferEins = new javax.swing.JButton();
        ZifferZwei = new javax.swing.JButton();
        ZifferDrei = new javax.swing.JButton();
        ZifferVier = new javax.swing.JButton();
        ZifferFünf = new javax.swing.JButton();
        ZifferSechs = new javax.swing.JButton();
        ZifferSieben = new javax.swing.JButton();
        ZifferAcht = new javax.swing.JButton();
        ZifferNeun = new javax.swing.JButton();
        SymbolKomma = new javax.swing.JButton();
        Additionszeichen = new javax.swing.JButton();
        menuBar = new javax.swing.JMenuBar();
        javax.swing.JMenu fileMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
        javax.swing.JMenu helpMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();
        statusPanel = new javax.swing.JPanel();
        javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator();
        statusMessageLabel = new javax.swing.JLabel();
        statusAnimationLabel = new javax.swing.JLabel();
        progressBar = new javax.swing.JProgressBar();

        mainPanel.setName("mainPanel"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(taschenrechner.TaschenrechnerApp.class).getContext().getResourceMap(TaschenrechnerView.class);
        Display.setText(resourceMap.getString("Display.text")); // NOI18N
        Display.setName("Display"); // NOI18N

        ZifferNull.setFont(resourceMap.getFont("ZifferNull.font")); // NOI18N
        ZifferNull.setText(resourceMap.getString("ZifferNull.text")); // NOI18N
        ZifferNull.setName("ZifferNull"); // NOI18N
        ZifferNull.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                ZifferNullMouseClicked(evt);
            }
        });

        ZifferEins.setFont(resourceMap.getFont("ZifferEins.font")); // NOI18N
        ZifferEins.setText(resourceMap.getString("ZifferEins.text")); // NOI18N
        ZifferEins.setName("ZifferEins"); // NOI18N
        ZifferEins.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                ZifferEinsMouseClicked(evt);
            }
        });

        ZifferZwei.setFont(resourceMap.getFont("ZifferZwei.font")); // NOI18N
        ZifferZwei.setText(resourceMap.getString("ZifferZwei.text")); // NOI18N
        ZifferZwei.setName("ZifferZwei"); // NOI18N
        ZifferZwei.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                ZifferZweiMouseClicked(evt);
            }
        });

        ZifferDrei.setFont(resourceMap.getFont("ZifferDrei.font")); // NOI18N
        ZifferDrei.setText(resourceMap.getString("ZifferDrei.text")); // NOI18N
        ZifferDrei.setName("ZifferDrei"); // NOI18N
        ZifferDrei.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                ZifferDreiMouseClicked(evt);
            }
        });

        ZifferVier.setFont(resourceMap.getFont("ZifferVier.font")); // NOI18N
        ZifferVier.setText(resourceMap.getString("ZifferVier.text")); // NOI18N
        ZifferVier.setName("ZifferVier"); // NOI18N
        ZifferVier.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                ZifferVierMouseClicked(evt);
            }
        });

        ZifferFünf.setFont(resourceMap.getFont("ZifferFünf.font")); // NOI18N
        ZifferFünf.setText(resourceMap.getString("ZifferFünf.text")); // NOI18N
        ZifferFünf.setName("ZifferFünf"); // NOI18N
        ZifferFünf.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                ZifferFünfMouseClicked(evt);
            }
        });

        ZifferSechs.setFont(resourceMap.getFont("ZifferSechs.font")); // NOI18N
        ZifferSechs.setText(resourceMap.getString("ZifferSechs.text")); // NOI18N
        ZifferSechs.setName("ZifferSechs"); // NOI18N
        ZifferSechs.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                ZifferSechsMouseClicked(evt);
            }
        });

        ZifferSieben.setFont(resourceMap.getFont("ZifferSieben.font")); // NOI18N
        ZifferSieben.setText(resourceMap.getString("ZifferSieben.text")); // NOI18N
        ZifferSieben.setName("ZifferSieben"); // NOI18N
        ZifferSieben.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                ZifferSiebenMouseClicked(evt);
            }
        });

        ZifferAcht.setFont(resourceMap.getFont("ZifferAcht.font")); // NOI18N
        ZifferAcht.setText(resourceMap.getString("ZifferAcht.text")); // NOI18N
        ZifferAcht.setName("ZifferAcht"); // NOI18N
        ZifferAcht.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                ZifferAchtMouseClicked(evt);
            }
        });

        ZifferNeun.setFont(resourceMap.getFont("ZifferNeun.font")); // NOI18N
        ZifferNeun.setText(resourceMap.getString("ZifferNeun.text")); // NOI18N
        ZifferNeun.setName("ZifferNeun"); // NOI18N
        ZifferNeun.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                ZifferNeunMouseClicked(evt);
            }
        });

        SymbolKomma.setFont(resourceMap.getFont("SymbolKomma.font")); // NOI18N
        SymbolKomma.setText(resourceMap.getString("SymbolKomma.text")); // NOI18N
        SymbolKomma.setName("SymbolKomma"); // NOI18N
        SymbolKomma.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                SymbolKommaMouseClicked(evt);
            }
        });

        Additionszeichen.setFont(resourceMap.getFont("Additionszeichen.font")); // NOI18N
        Additionszeichen.setText(resourceMap.getString("Additionszeichen.text")); // NOI18N
        Additionszeichen.setName("Additionszeichen"); // NOI18N
        Additionszeichen.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                AdditionszeichenMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
        mainPanel.setLayout(mainPanelLayout);
        mainPanelLayout.setHorizontalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(Display, javax.swing.GroupLayout.PREFERRED_SIZE, 466, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addComponent(ZifferNull)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(ZifferEins)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(ZifferZwei)
                        .addGap(18, 18, 18)
                        .addComponent(Additionszeichen))
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addComponent(ZifferDrei)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(ZifferVier)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(ZifferFünf))
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, mainPanelLayout.createSequentialGroup()
                                .addComponent(ZifferNeun)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(SymbolKomma, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, mainPanelLayout.createSequentialGroup()
                                .addComponent(ZifferSechs)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(ZifferSieben)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(ZifferAcht)))
                .addContainerGap(205, Short.MAX_VALUE))
        );
        mainPanelLayout.setVerticalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(Display, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ZifferNull)
                    .addComponent(ZifferEins)
                    .addComponent(ZifferZwei)
                    .addComponent(Additionszeichen))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ZifferDrei)
                    .addComponent(ZifferVier)
                    .addComponent(ZifferFünf))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ZifferSechs)
                    .addComponent(ZifferSieben)
                    .addComponent(ZifferAcht))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ZifferNeun)
                    .addComponent(SymbolKomma))
                .addContainerGap(266, Short.MAX_VALUE))
        );

        menuBar.setName("menuBar"); // NOI18N

        fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
        fileMenu.setName("fileMenu"); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(taschenrechner.TaschenrechnerApp.class).getContext().getActionMap(TaschenrechnerView.class, this);
        exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
        exitMenuItem.setName("exitMenuItem"); // NOI18N
        fileMenu.add(exitMenuItem);

        menuBar.add(fileMenu);

        helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N
        helpMenu.setName("helpMenu"); // NOI18N

        aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
        aboutMenuItem.setName("aboutMenuItem"); // NOI18N
        helpMenu.add(aboutMenuItem);

        menuBar.add(helpMenu);

        statusPanel.setName("statusPanel"); // NOI18N

        statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N

        statusMessageLabel.setName("statusMessageLabel"); // NOI18N

        statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N

        progressBar.setName("progressBar"); // NOI18N

        javax.swing.GroupLayout statusPanelLayout = new javax.swing.GroupLayout(statusPanel);
        statusPanel.setLayout(statusPanelLayout);
        statusPanelLayout.setHorizontalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(statusPanelSeparator, javax.swing.GroupLayout.DEFAULT_SIZE, 683, Short.MAX_VALUE)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(statusMessageLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 508, Short.MAX_VALUE)
                .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(statusAnimationLabel)
                .addContainerGap())
        );
        statusPanelLayout.setVerticalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addComponent(statusPanelSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(statusMessageLabel)
                    .addComponent(statusAnimationLabel)
                    .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(3, 3, 3))
        );

        setComponent(mainPanel);
        setMenuBar(menuBar);
        setStatusBar(statusPanel);
    }// </editor-fold>                        

    boolean Komma;
    boolean ZahlIstGanz;
    java.math.BigDecimal Term;

    private void ZifferNullMouseClicked(java.awt.event.MouseEvent evt) {                                        
        if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
        Display.setText(Display.getText() + "0");
    }                                      

    private void ZifferEinsMouseClicked(java.awt.event.MouseEvent evt) {                                        
        if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
        Display.setText(Display.getText() + "1");
    }                                      

    private void ZifferZweiMouseClicked(java.awt.event.MouseEvent evt) {                                        
        if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
        Display.setText(Display.getText() + "2");
    }                                      

    private void ZifferDreiMouseClicked(java.awt.event.MouseEvent evt) {                                        
        if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
        Display.setText(Display.getText() + "3");
    }                                      

    private void ZifferVierMouseClicked(java.awt.event.MouseEvent evt) {                                        
        if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
        Display.setText(Display.getText() + "4");
    }                                      

    private void ZifferFünfMouseClicked(java.awt.event.MouseEvent evt) {                                        
        if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
        Display.setText(Display.getText() + "5");
    }                                      

    private void ZifferSechsMouseClicked(java.awt.event.MouseEvent evt) {                                        
        if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
        Display.setText(Display.getText() + "6");
    }                                        

    private void ZifferSiebenMouseClicked(java.awt.event.MouseEvent evt) {                                          
        if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
        Display.setText(Display.getText() + "7");
    }                                        

    private void ZifferAchtMouseClicked(java.awt.event.MouseEvent evt) {                                        
        if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
        Display.setText(Display.getText() + "8");
    }                                      

    private void ZifferNeunMouseClicked(java.awt.event.MouseEvent evt) {                                        
        if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
        Display.setText(Display.getText() + "9");
    }                                      

    private void SymbolKommaMouseClicked(java.awt.event.MouseEvent evt) {                                        
        if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
        if(Komma == false) {
            Display.setText(Display.getText() + ".");
            Komma = true;
            SymbolKomma.setEnabled(false);
        }
    }                                        

    private void AdditionszeichenMouseClicked(java.awt.event.MouseEvent evt) {                                              
        Term = Term + new java.math.BigDecimal(Display.getText());
        Display.setText(String.valueOf(Term));
        ZahlIstGanz = true;
        Komma = false;
        SymbolKomma.setEnabled(true);
    }                                            

    // Variables declaration - do not modify                    
    private javax.swing.JButton Additionszeichen;
    private javax.swing.JTextField Display;
    private javax.swing.JButton SymbolKomma;
    private javax.swing.JButton ZifferAcht;
    private javax.swing.JButton ZifferDrei;
    private javax.swing.JButton ZifferEins;
    private javax.swing.JButton ZifferFünf;
    private javax.swing.JButton ZifferNeun;
    private javax.swing.JButton ZifferNull;
    private javax.swing.JButton ZifferSechs;
    private javax.swing.JButton ZifferSieben;
    private javax.swing.JButton ZifferVier;
    private javax.swing.JButton ZifferZwei;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JProgressBar progressBar;
    private javax.swing.JLabel statusAnimationLabel;
    private javax.swing.JLabel statusMessageLabel;
    private javax.swing.JPanel statusPanel;
    // End of variables declaration                  

    private final Timer messageTimer;
    private final Timer busyIconTimer;
    private final Icon idleIcon;
    private final Icon[] busyIcons = new Icon[15];
    private int busyIconIndex = 0;

    private JDialog aboutBox;
}
Code:
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
/*
* TaschenrechnerView.java
*/

package taschenrechner;

import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.math.BigInteger;
import javax.swing.Timer;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JFrame;

/**
* The application's main frame.
*/
public class TaschenrechnerView extends FrameView {

public TaschenrechnerView(SingleFrameApplication app) {
super(app);

initComponents();

// status bar initialization - message timeout, idle icon and busy animation, etc
ResourceMap resourceMap = getResourceMap();
int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
messageTimer = new Timer(messageTimeout, new ActionListener() {
public void actionPerformed(ActionEvent e) {
statusMessageLabel.setText("");
}
});
messageTimer.setRepeats(false);
int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
for (int i = 0; i < busyIcons.length; i++) {
busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
}
busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {
public void actionPerformed(ActionEvent e) {
busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
}
});
idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
statusAnimationLabel.setIcon(idleIcon);
progressBar.setVisible(false);

// connecting action tasks to status bar via TaskMonitor
TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
public void propertyChange(java.beans.PropertyChangeEvent evt) {
String propertyName = evt.getPropertyName();
if ("started".equals(propertyName)) {
if (!busyIconTimer.isRunning()) {
statusAnimationLabel.setIcon(busyIcons[0]);
busyIconIndex = 0;
busyIconTimer.start();
}
progressBar.setVisible(true);
progressBar.setIndeterminate(true);
} else if ("done".equals(propertyName)) {
busyIconTimer.stop();
statusAnimationLabel.setIcon(idleIcon);
progressBar.setVisible(false);
progressBar.setValue(0);
} else if ("message".equals(propertyName)) {
String text = (String)(evt.getNewValue());
statusMessageLabel.setText((text == null) ? "" : text);
messageTimer.restart();
} else if ("progress".equals(propertyName)) {
int value = (Integer)(evt.getNewValue());
progressBar.setVisible(true);
progressBar.setIndeterminate(false);
progressBar.setValue(value);
}
}
});
}

@Action
public void showAboutBox() {
if (aboutBox == null) {
JFrame mainFrame = TaschenrechnerApp.getApplication().getMainFrame();
aboutBox = new TaschenrechnerAboutBox(mainFrame);
aboutBox.setLocationRelativeTo(mainFrame);
}
TaschenrechnerApp.getApplication().show(aboutBox);
}

/** 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">
private void initComponents() {

mainPanel = new javax.swing.JPanel();
Display = new javax.swing.JTextField();
ZifferNull = new javax.swing.JButton();
ZifferEins = new javax.swing.JButton();
ZifferZwei = new javax.swing.JButton();
ZifferDrei = new javax.swing.JButton();
ZifferVier = new javax.swing.JButton();
ZifferFünf = new javax.swing.JButton();
ZifferSechs = new javax.swing.JButton();
ZifferSieben = new javax.swing.JButton();
ZifferAcht = new javax.swing.JButton();
ZifferNeun = new javax.swing.JButton();
SymbolKomma = new javax.swing.JButton();
Additionszeichen = new javax.swing.JButton();
menuBar = new javax.swing.JMenuBar();
javax.swing.JMenu fileMenu = new javax.swing.JMenu();
javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
javax.swing.JMenu helpMenu = new javax.swing.JMenu();
javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();
statusPanel = new javax.swing.JPanel();
javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator();
statusMessageLabel = new javax.swing.JLabel();
statusAnimationLabel = new javax.swing.JLabel();
progressBar = new javax.swing.JProgressBar();

mainPanel.setName("mainPanel"); // NOI18N

org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(taschenrechner.TaschenrechnerApp.class).getContext().getResourceMap(TaschenrechnerView.class);
Display.setText(resourceMap.getString("Display.text")); // NOI18N
Display.setName("Display"); // NOI18N

ZifferNull.setFont(resourceMap.getFont("ZifferNull.font")); // NOI18N
ZifferNull.setText(resourceMap.getString("ZifferNull.text")); // NOI18N
ZifferNull.setName("ZifferNull"); // NOI18N
ZifferNull.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
ZifferNullMouseClicked(evt);
}
});

ZifferEins.setFont(resourceMap.getFont("ZifferEins.font")); // NOI18N
ZifferEins.setText(resourceMap.getString("ZifferEins.text")); // NOI18N
ZifferEins.setName("ZifferEins"); // NOI18N
ZifferEins.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
ZifferEinsMouseClicked(evt);
}
});

ZifferZwei.setFont(resourceMap.getFont("ZifferZwei.font")); // NOI18N
ZifferZwei.setText(resourceMap.getString("ZifferZwei.text")); // NOI18N
ZifferZwei.setName("ZifferZwei"); // NOI18N
ZifferZwei.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
ZifferZweiMouseClicked(evt);
}
});

ZifferDrei.setFont(resourceMap.getFont("ZifferDrei.font")); // NOI18N
ZifferDrei.setText(resourceMap.getString("ZifferDrei.text")); // NOI18N
ZifferDrei.setName("ZifferDrei"); // NOI18N
ZifferDrei.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
ZifferDreiMouseClicked(evt);
}
});

ZifferVier.setFont(resourceMap.getFont("ZifferVier.font")); // NOI18N
ZifferVier.setText(resourceMap.getString("ZifferVier.text")); // NOI18N
ZifferVier.setName("ZifferVier"); // NOI18N
ZifferVier.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
ZifferVierMouseClicked(evt);
}
});

ZifferFünf.setFont(resourceMap.getFont("ZifferFünf.font")); // NOI18N
ZifferFünf.setText(resourceMap.getString("ZifferFünf.text")); // NOI18N
ZifferFünf.setName("ZifferFünf"); // NOI18N
ZifferFünf.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
ZifferFünfMouseClicked(evt);
}
});

ZifferSechs.setFont(resourceMap.getFont("ZifferSechs.font")); // NOI18N
ZifferSechs.setText(resourceMap.getString("ZifferSechs.text")); // NOI18N
ZifferSechs.setName("ZifferSechs"); // NOI18N
ZifferSechs.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
ZifferSechsMouseClicked(evt);
}
});

ZifferSieben.setFont(resourceMap.getFont("ZifferSieben.font")); // NOI18N
ZifferSieben.setText(resourceMap.getString("ZifferSieben.text")); // NOI18N
ZifferSieben.setName("ZifferSieben"); // NOI18N
ZifferSieben.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
ZifferSiebenMouseClicked(evt);
}
});

ZifferAcht.setFont(resourceMap.getFont("ZifferAcht.font")); // NOI18N
ZifferAcht.setText(resourceMap.getString("ZifferAcht.text")); // NOI18N
ZifferAcht.setName("ZifferAcht"); // NOI18N
ZifferAcht.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
ZifferAchtMouseClicked(evt);
}
});

ZifferNeun.setFont(resourceMap.getFont("ZifferNeun.font")); // NOI18N
ZifferNeun.setText(resourceMap.getString("ZifferNeun.text")); // NOI18N
ZifferNeun.setName("ZifferNeun"); // NOI18N
ZifferNeun.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
ZifferNeunMouseClicked(evt);
}
});

SymbolKomma.setFont(resourceMap.getFont("SymbolKomma.font")); // NOI18N
SymbolKomma.setText(resourceMap.getString("SymbolKomma.text")); // NOI18N
SymbolKomma.setName("SymbolKomma"); // NOI18N
SymbolKomma.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
SymbolKommaMouseClicked(evt);
}
});

Additionszeichen.setFont(resourceMap.getFont("Additionszeichen.font")); // NOI18N
Additionszeichen.setText(resourceMap.getString("Additionszeichen.text")); // NOI18N
Additionszeichen.setName("Additionszeichen"); // NOI18N
Additionszeichen.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
AdditionszeichenMouseClicked(evt);
}
});

javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(mainPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(Display, javax.swing.GroupLayout.PREFERRED_SIZE, 466, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(mainPanelLayout.createSequentialGroup()
.addComponent(ZifferNull)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ZifferEins)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ZifferZwei)
.addGap(18, 18, 18)
.addComponent(Additionszeichen))
.addGroup(mainPanelLayout.createSequentialGroup()
.addComponent(ZifferDrei)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ZifferVier)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ZifferFünf))
.addGroup(mainPanelLayout.createSequentialGroup()
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, mainPanelLayout.createSequentialGroup()
.addComponent(ZifferNeun)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(SymbolKomma, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, mainPanelLayout.createSequentialGroup()
.addComponent(ZifferSechs)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ZifferSieben)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ZifferAcht)))
.addContainerGap(205, Short.MAX_VALUE))
);
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(mainPanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(Display, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(ZifferNull)
.addComponent(ZifferEins)
.addComponent(ZifferZwei)
.addComponent(Additionszeichen))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(ZifferDrei)
.addComponent(ZifferVier)
.addComponent(ZifferFünf))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(ZifferSechs)
.addComponent(ZifferSieben)
.addComponent(ZifferAcht))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(ZifferNeun)
.addComponent(SymbolKomma))
.addContainerGap(266, Short.MAX_VALUE))
);

menuBar.setName("menuBar"); // NOI18N

fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
fileMenu.setName("fileMenu"); // NOI18N

javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(taschenrechner.TaschenrechnerApp.class).getContext().getActionMap(TaschenrechnerView.class, this);
exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
exitMenuItem.setName("exitMenuItem"); // NOI18N
fileMenu.add(exitMenuItem);

menuBar.add(fileMenu);

helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N
helpMenu.setName("helpMenu"); // NOI18N

aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
aboutMenuItem.setName("aboutMenuItem"); // NOI18N
helpMenu.add(aboutMenuItem);

menuBar.add(helpMenu);

statusPanel.setName("statusPanel"); // NOI18N

statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N

statusMessageLabel.setName("statusMessageLabel"); // NOI18N

statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N

progressBar.setName("progressBar"); // NOI18N

javax.swing.GroupLayout statusPanelLayout = new javax.swing.GroupLayout(statusPanel);
statusPanel.setLayout(statusPanelLayout);
statusPanelLayout.setHorizontalGroup(
statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(statusPanelSeparator, javax.swing.GroupLayout.DEFAULT_SIZE, 683, Short.MAX_VALUE)
.addGroup(statusPanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(statusMessageLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 508, Short.MAX_VALUE)
.addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(statusAnimationLabel)
.addContainerGap())
);
statusPanelLayout.setVerticalGroup(
statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(statusPanelLayout.createSequentialGroup()
.addComponent(statusPanelSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(statusMessageLabel)
.addComponent(statusAnimationLabel)
.addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(3, 3, 3))
);

setComponent(mainPanel);
setMenuBar(menuBar);
setStatusBar(statusPanel);
}// </editor-fold>

boolean Komma;
boolean ZahlIstGanz;
java.math.BigDecimal Term;

private void ZifferNullMouseClicked(java.awt.event.MouseEvent evt) {
if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
Display.setText(Display.getText() + "0");
}

private void ZifferEinsMouseClicked(java.awt.event.MouseEvent evt) {
if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
Display.setText(Display.getText() + "1");
}

private void ZifferZweiMouseClicked(java.awt.event.MouseEvent evt) {
if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
Display.setText(Display.getText() + "2");
}

private void ZifferDreiMouseClicked(java.awt.event.MouseEvent evt) {
if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
Display.setText(Display.getText() + "3");
}

private void ZifferVierMouseClicked(java.awt.event.MouseEvent evt) {
if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
Display.setText(Display.getText() + "4");
}

private void ZifferFünfMouseClicked(java.awt.event.MouseEvent evt) {
if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
Display.setText(Display.getText() + "5");
}

private void ZifferSechsMouseClicked(java.awt.event.MouseEvent evt) {
if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
Display.setText(Display.getText() + "6");
}

private void ZifferSiebenMouseClicked(java.awt.event.MouseEvent evt) {
if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
Display.setText(Display.getText() + "7");
}

private void ZifferAchtMouseClicked(java.awt.event.MouseEvent evt) {
if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
Display.setText(Display.getText() + "8");
}

private void ZifferNeunMouseClicked(java.awt.event.MouseEvent evt) {
if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
Display.setText(Display.getText() + "9");
}

private void SymbolKommaMouseClicked(java.awt.event.MouseEvent evt) {
if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
if(Komma == false) {
Display.setText(Display.getText() + ".");
Komma = true;
SymbolKomma.setEnabled(false);
}
}

private void AdditionszeichenMouseClicked(java.awt.event.MouseEvent evt) {
Term = Term + new java.math.BigDecimal(Display.getText());
Display.setText(String.valueOf(Term));
ZahlIstGanz = true;
Komma = false;
SymbolKomma.setEnabled(true);
}

// Variables declaration - do not modify
private javax.swing.JButton Additionszeichen;
private javax.swing.JTextField Display;
private javax.swing.JButton SymbolKomma;
private javax.swing.JButton ZifferAcht;
private javax.swing.JButton ZifferDrei;
private javax.swing.JButton ZifferEins;
private javax.swing.JButton ZifferFünf;
private javax.swing.JButton ZifferNeun;
private javax.swing.JButton ZifferNull;
private javax.swing.JButton ZifferSechs;
private javax.swing.JButton ZifferSieben;
private javax.swing.JButton ZifferVier;
private javax.swing.JButton ZifferZwei;
private javax.swing.JPanel mainPanel;
private javax.swing.JMenuBar menuBar;
private javax.swing.JProgressBar progressBar;
private javax.swing.JLabel statusAnimationLabel;
private javax.swing.JLabel statusMessageLabel;
private javax.swing.JPanel statusPanel;
// End of variables declaration

private final Timer messageTimer;
private final Timer busyIconTimer;
private final Icon idleIcon;
private final Icon[] busyIcons = new Icon[15];
private int busyIconIndex = 0;

private JDialog aboutBox;
}
Code:
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
/*
 * TaschenrechnerView.java
 */

package taschenrechner;

import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.math.BigInteger;
import javax.swing.Timer;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JFrame;

/**
 * The application's main frame.
 */
public class TaschenrechnerView extends FrameView {

    public TaschenrechnerView(SingleFrameApplication app) {
        super(app);

        initComponents();

        // status bar initialization - message timeout, idle icon and busy animation, etc
        ResourceMap resourceMap = getResourceMap();
        int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
        messageTimer = new Timer(messageTimeout, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                statusMessageLabel.setText("");
            }
        });
        messageTimer.setRepeats(false);
        int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
        for (int i = 0; i < busyIcons.length; i++) {
            busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
        }
        busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
                statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
            }
        });
        idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
        statusAnimationLabel.setIcon(idleIcon);
        progressBar.setVisible(false);

        // connecting action tasks to status bar via TaskMonitor
        TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
        taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                String propertyName = evt.getPropertyName();
                if ("started".equals(propertyName)) {
                    if (!busyIconTimer.isRunning()) {
                        statusAnimationLabel.setIcon(busyIcons[0]);
                        busyIconIndex = 0;
                        busyIconTimer.start();
                    }
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(true);
                } else if ("done".equals(propertyName)) {
                    busyIconTimer.stop();
                    statusAnimationLabel.setIcon(idleIcon);
                    progressBar.setVisible(false);
                    progressBar.setValue(0);
                } else if ("message".equals(propertyName)) {
                    String text = (String)(evt.getNewValue());
                    statusMessageLabel.setText((text == null) ? "" : text);
                    messageTimer.restart();
                } else if ("progress".equals(propertyName)) {
                    int value = (Integer)(evt.getNewValue());
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(false);
                    progressBar.setValue(value);
                }
            }
        });
    }

    @Action
    public void showAboutBox() {
        if (aboutBox == null) {
            JFrame mainFrame = TaschenrechnerApp.getApplication().getMainFrame();
            aboutBox = new TaschenrechnerAboutBox(mainFrame);
            aboutBox.setLocationRelativeTo(mainFrame);
        }
        TaschenrechnerApp.getApplication().show(aboutBox);
    }

    /** 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">                          
    private void initComponents() {

        mainPanel = new javax.swing.JPanel();
        Display = new javax.swing.JTextField();
        ZifferNull = new javax.swing.JButton();
        ZifferEins = new javax.swing.JButton();
        ZifferZwei = new javax.swing.JButton();
        ZifferDrei = new javax.swing.JButton();
        ZifferVier = new javax.swing.JButton();
        ZifferFünf = new javax.swing.JButton();
        ZifferSechs = new javax.swing.JButton();
        ZifferSieben = new javax.swing.JButton();
        ZifferAcht = new javax.swing.JButton();
        ZifferNeun = new javax.swing.JButton();
        SymbolKomma = new javax.swing.JButton();
        Additionszeichen = new javax.swing.JButton();
        menuBar = new javax.swing.JMenuBar();
        javax.swing.JMenu fileMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
        javax.swing.JMenu helpMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();
        statusPanel = new javax.swing.JPanel();
        javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator();
        statusMessageLabel = new javax.swing.JLabel();
        statusAnimationLabel = new javax.swing.JLabel();
        progressBar = new javax.swing.JProgressBar();

        mainPanel.setName("mainPanel"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(taschenrechner.TaschenrechnerApp.class).getContext().getResourceMap(TaschenrechnerView.class);
        Display.setText(resourceMap.getString("Display.text")); // NOI18N
        Display.setName("Display"); // NOI18N

        ZifferNull.setFont(resourceMap.getFont("ZifferNull.font")); // NOI18N
        ZifferNull.setText(resourceMap.getString("ZifferNull.text")); // NOI18N
        ZifferNull.setName("ZifferNull"); // NOI18N
        ZifferNull.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                ZifferNullMouseClicked(evt);
            }
        });

        ZifferEins.setFont(resourceMap.getFont("ZifferEins.font")); // NOI18N
        ZifferEins.setText(resourceMap.getString("ZifferEins.text")); // NOI18N
        ZifferEins.setName("ZifferEins"); // NOI18N
        ZifferEins.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                ZifferEinsMouseClicked(evt);
            }
        });

        ZifferZwei.setFont(resourceMap.getFont("ZifferZwei.font")); // NOI18N
        ZifferZwei.setText(resourceMap.getString("ZifferZwei.text")); // NOI18N
        ZifferZwei.setName("ZifferZwei"); // NOI18N
        ZifferZwei.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                ZifferZweiMouseClicked(evt);
            }
        });

        ZifferDrei.setFont(resourceMap.getFont("ZifferDrei.font")); // NOI18N
        ZifferDrei.setText(resourceMap.getString("ZifferDrei.text")); // NOI18N
        ZifferDrei.setName("ZifferDrei"); // NOI18N
        ZifferDrei.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                ZifferDreiMouseClicked(evt);
            }
        });

        ZifferVier.setFont(resourceMap.getFont("ZifferVier.font")); // NOI18N
        ZifferVier.setText(resourceMap.getString("ZifferVier.text")); // NOI18N
        ZifferVier.setName("ZifferVier"); // NOI18N
        ZifferVier.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                ZifferVierMouseClicked(evt);
            }
        });

        ZifferFünf.setFont(resourceMap.getFont("ZifferFünf.font")); // NOI18N
        ZifferFünf.setText(resourceMap.getString("ZifferFünf.text")); // NOI18N
        ZifferFünf.setName("ZifferFünf"); // NOI18N
        ZifferFünf.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                ZifferFünfMouseClicked(evt);
            }
        });

        ZifferSechs.setFont(resourceMap.getFont("ZifferSechs.font")); // NOI18N
        ZifferSechs.setText(resourceMap.getString("ZifferSechs.text")); // NOI18N
        ZifferSechs.setName("ZifferSechs"); // NOI18N
        ZifferSechs.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                ZifferSechsMouseClicked(evt);
            }
        });

        ZifferSieben.setFont(resourceMap.getFont("ZifferSieben.font")); // NOI18N
        ZifferSieben.setText(resourceMap.getString("ZifferSieben.text")); // NOI18N
        ZifferSieben.setName("ZifferSieben"); // NOI18N
        ZifferSieben.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                ZifferSiebenMouseClicked(evt);
            }
        });

        ZifferAcht.setFont(resourceMap.getFont("ZifferAcht.font")); // NOI18N
        ZifferAcht.setText(resourceMap.getString("ZifferAcht.text")); // NOI18N
        ZifferAcht.setName("ZifferAcht"); // NOI18N
        ZifferAcht.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                ZifferAchtMouseClicked(evt);
            }
        });

        ZifferNeun.setFont(resourceMap.getFont("ZifferNeun.font")); // NOI18N
        ZifferNeun.setText(resourceMap.getString("ZifferNeun.text")); // NOI18N
        ZifferNeun.setName("ZifferNeun"); // NOI18N
        ZifferNeun.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                ZifferNeunMouseClicked(evt);
            }
        });

        SymbolKomma.setFont(resourceMap.getFont("SymbolKomma.font")); // NOI18N
        SymbolKomma.setText(resourceMap.getString("SymbolKomma.text")); // NOI18N
        SymbolKomma.setName("SymbolKomma"); // NOI18N
        SymbolKomma.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                SymbolKommaMouseClicked(evt);
            }
        });

        Additionszeichen.setFont(resourceMap.getFont("Additionszeichen.font")); // NOI18N
        Additionszeichen.setText(resourceMap.getString("Additionszeichen.text")); // NOI18N
        Additionszeichen.setName("Additionszeichen"); // NOI18N
        Additionszeichen.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                AdditionszeichenMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
        mainPanel.setLayout(mainPanelLayout);
        mainPanelLayout.setHorizontalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(Display, javax.swing.GroupLayout.PREFERRED_SIZE, 466, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addComponent(ZifferNull)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(ZifferEins)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(ZifferZwei)
                        .addGap(18, 18, 18)
                        .addComponent(Additionszeichen))
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addComponent(ZifferDrei)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(ZifferVier)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(ZifferFünf))
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, mainPanelLayout.createSequentialGroup()
                                .addComponent(ZifferNeun)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(SymbolKomma, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, mainPanelLayout.createSequentialGroup()
                                .addComponent(ZifferSechs)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(ZifferSieben)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(ZifferAcht)))
                .addContainerGap(205, Short.MAX_VALUE))
        );
        mainPanelLayout.setVerticalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(Display, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ZifferNull)
                    .addComponent(ZifferEins)
                    .addComponent(ZifferZwei)
                    .addComponent(Additionszeichen))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ZifferDrei)
                    .addComponent(ZifferVier)
                    .addComponent(ZifferFünf))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ZifferSechs)
                    .addComponent(ZifferSieben)
                    .addComponent(ZifferAcht))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ZifferNeun)
                    .addComponent(SymbolKomma))
                .addContainerGap(266, Short.MAX_VALUE))
        );

        menuBar.setName("menuBar"); // NOI18N

        fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
        fileMenu.setName("fileMenu"); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(taschenrechner.TaschenrechnerApp.class).getContext().getActionMap(TaschenrechnerView.class, this);
        exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
        exitMenuItem.setName("exitMenuItem"); // NOI18N
        fileMenu.add(exitMenuItem);

        menuBar.add(fileMenu);

        helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N
        helpMenu.setName("helpMenu"); // NOI18N

        aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
        aboutMenuItem.setName("aboutMenuItem"); // NOI18N
        helpMenu.add(aboutMenuItem);

        menuBar.add(helpMenu);

        statusPanel.setName("statusPanel"); // NOI18N

        statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N

        statusMessageLabel.setName("statusMessageLabel"); // NOI18N

        statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N

        progressBar.setName("progressBar"); // NOI18N

        javax.swing.GroupLayout statusPanelLayout = new javax.swing.GroupLayout(statusPanel);
        statusPanel.setLayout(statusPanelLayout);
        statusPanelLayout.setHorizontalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(statusPanelSeparator, javax.swing.GroupLayout.DEFAULT_SIZE, 683, Short.MAX_VALUE)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(statusMessageLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 508, Short.MAX_VALUE)
                .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(statusAnimationLabel)
                .addContainerGap())
        );
        statusPanelLayout.setVerticalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addComponent(statusPanelSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(statusMessageLabel)
                    .addComponent(statusAnimationLabel)
                    .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(3, 3, 3))
        );

        setComponent(mainPanel);
        setMenuBar(menuBar);
        setStatusBar(statusPanel);
    }// </editor-fold>                        

    boolean Komma;
    boolean ZahlIstGanz;
    java.math.BigDecimal Term;

    private void ZifferNullMouseClicked(java.awt.event.MouseEvent evt) {                                        
        if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
        Display.setText(Display.getText() + "0");
    }                                      

    private void ZifferEinsMouseClicked(java.awt.event.MouseEvent evt) {                                        
        if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
        Display.setText(Display.getText() + "1");
    }                                      

    private void ZifferZweiMouseClicked(java.awt.event.MouseEvent evt) {                                        
        if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
        Display.setText(Display.getText() + "2");
    }                                      

    private void ZifferDreiMouseClicked(java.awt.event.MouseEvent evt) {                                        
        if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
        Display.setText(Display.getText() + "3");
    }                                      

    private void ZifferVierMouseClicked(java.awt.event.MouseEvent evt) {                                        
        if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
        Display.setText(Display.getText() + "4");
    }                                      

    private void ZifferFünfMouseClicked(java.awt.event.MouseEvent evt) {                                        
        if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
        Display.setText(Display.getText() + "5");
    }                                      

    private void ZifferSechsMouseClicked(java.awt.event.MouseEvent evt) {                                        
        if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
        Display.setText(Display.getText() + "6");
    }                                        

    private void ZifferSiebenMouseClicked(java.awt.event.MouseEvent evt) {                                          
        if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
        Display.setText(Display.getText() + "7");
    }                                        

    private void ZifferAchtMouseClicked(java.awt.event.MouseEvent evt) {                                        
        if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
        Display.setText(Display.getText() + "8");
    }                                      

    private void ZifferNeunMouseClicked(java.awt.event.MouseEvent evt) {                                        
        if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
        Display.setText(Display.getText() + "9");
    }                                      

    private void SymbolKommaMouseClicked(java.awt.event.MouseEvent evt) {                                        
        if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
        if(Komma == false) {
            Display.setText(Display.getText() + ".");
            Komma = true;
            SymbolKomma.setEnabled(false);
        }
    }                                        

    private void AdditionszeichenMouseClicked(java.awt.event.MouseEvent evt) {                                              
        Term = Term + new java.math.BigDecimal(Display.getText());
        Display.setText(String.valueOf(Term));
        ZahlIstGanz = true;
        Komma = false;
        SymbolKomma.setEnabled(true);
    }                                            

    // Variables declaration - do not modify                    
    private javax.swing.JButton Additionszeichen;
    private javax.swing.JTextField Display;
    private javax.swing.JButton SymbolKomma;
    private javax.swing.JButton ZifferAcht;
    private javax.swing.JButton ZifferDrei;
    private javax.swing.JButton ZifferEins;
    private javax.swing.JButton ZifferFünf;
    private javax.swing.JButton ZifferNeun;
    private javax.swing.JButton ZifferNull;
    private javax.swing.JButton ZifferSechs;
    private javax.swing.JButton ZifferSieben;
    private javax.swing.JButton ZifferVier;
    private javax.swing.JButton ZifferZwei;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JProgressBar progressBar;
    private javax.swing.JLabel statusAnimationLabel;
    private javax.swing.JLabel statusMessageLabel;
    private javax.swing.JPanel statusPanel;
    // End of variables declaration                  

    private final Timer messageTimer;
    private final Timer busyIconTimer;
    private final Icon idleIcon;
    private final Icon[] busyIcons = new Icon[15];
    private int busyIconIndex = 0;

    private JDialog aboutBox;
}
kristallkugel
Unregistrierter




Beitrag kristallkugel Unregistrierter 17:47:15 08.02.2010   Titel:              Zitieren

und fehlermeldung gibts keine mehr?
LiGERWooD
Unregistrierter




Beitrag LiGERWooD Unregistrierter 19:16:39 08.02.2010   Titel:              Zitieren

Habe das Problem gefunden.
Code:
Term = Term + new java.math.BigDecimal(Display.getText());
Code:
Term = Term + new java.math.BigDecimal(Display.getText());
Code:
Term = Term + new java.math.BigDecimal(Display.getText());
geht nicht. Nur ohne Term +
also
Code:
Term = new java.math.BigDecimal(Display.getText());
Code:
Term = new java.math.BigDecimal(Display.getText());
Code:
Term = new java.math.BigDecimal(Display.getText());
.
Dasd
Mitglied

Benutzerprofil
Anmeldungsdatum: 22.08.2003
Beiträge: 1036
Beitrag Dasd Mitglied 09:34:44 09.02.2010   Titel:              Zitieren

http://java.sun.com/javase/6/docs/api/java/math/BigDecimal.html#add%28java.math.BigDecimal%29

Java Code:
Term = Term.add(new java.math.BigDecimal(Display.getText()));
Java Code:
Term = Term.add(new java.math.BigDecimal(Display.getText()));
Java Code:
Term = Term.add(new java.math.BigDecimal(Display.getText()));
LiGERWooD
Unregistrierter




Beitrag LiGERWooD Unregistrierter 16:11:49 10.02.2010   Titel:              Zitieren

Dasd schrieb:
http://java.sun.com/javase/6/docs/api/java/math/BigDecimal.html#add%28java.math.BigDecimal%29

Java Code:
Term = Term.add(new java.math.BigDecimal(Display.getText()));
Java Code:
Term = Term.add(new java.math.BigDecimal(Display.getText()));
Java Code:
Term = Term.add(new java.math.BigDecimal(Display.getText()));


ahja Danke!

Hatte es aber so
Code:
java.math.BigDecimal Temp = new java.math.BigDecimal(Display.getText());
Term = Term.add(Temp);
Code:
java.math.BigDecimal Temp = new java.math.BigDecimal(Display.getText());
Term = Term.add(Temp);
Code:
java.math.BigDecimal Temp = new java.math.BigDecimal(Display.getText());
Term = Term.add(Temp);
gemacht.

Bitte Thread Schließen.
DEvent
Mitglied

Benutzerprofil
Anmeldungsdatum: 27.12.2003
Beiträge: 3270
Beitrag DEvent Mitglied 12:09:36 12.02.2010   Titel:              Zitieren

Hat es einen Grund wieso du nicht die Klassen importierst und stattdessen so was schreibst?
Java Code:
private javax.swing.JButton Additionszeichen;
    private javax.swing.JTextField Display;
    private javax.swing.JButton SymbolKomma;
    private javax.swing.JButton ZifferAcht;
    private javax.swing.JButton ZifferDrei;
    private javax.swing.JButton ZifferEins;
    private javax.swing.JButton ZifferFünf;
Java Code:
private javax.swing.JButton Additionszeichen;
private javax.swing.JTextField Display;
private javax.swing.JButton SymbolKomma;
private javax.swing.JButton ZifferAcht;
private javax.swing.JButton ZifferDrei;
private javax.swing.JButton ZifferEins;
private javax.swing.JButton ZifferFünf;
Java Code:
private javax.swing.JButton Additionszeichen;
    private javax.swing.JTextField Display;
    private javax.swing.JButton SymbolKomma;
    private javax.swing.JButton ZifferAcht;
    private javax.swing.JButton ZifferDrei;
    private javax.swing.JButton ZifferEins;
    private javax.swing.JButton ZifferFünf;


Und das hier ist auch Sinnlos
Java Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1
2
3
4
5
6
7
8
9
10
11
12
13
14
private void ZifferNullMouseClicked(java.awt.event.MouseEvent evt) {                                        
        if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
        Display.setText(Display.getText() + "0");
    }                                      

    private void ZifferEinsMouseClicked(java.awt.event.MouseEvent evt) {                                        
        if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
        Display.setText(Display.getText() + "1");
    }                                      

    private void ZifferZweiMouseClicked(java.awt.event.MouseEvent evt) {                                        
        if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
        Display.setText(Display.getText() + "2");
    }                                      
Java Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
private void ZifferNullMouseClicked(java.awt.event.MouseEvent evt) {
if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
Display.setText(Display.getText() + "0");
}

private void ZifferEinsMouseClicked(java.awt.event.MouseEvent evt) {
if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
Display.setText(Display.getText() + "1");
}

private void ZifferZweiMouseClicked(java.awt.event.MouseEvent evt) {
if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
Display.setText(Display.getText() + "2");
}
Java Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
private void ZifferNullMouseClicked(java.awt.event.MouseEvent evt) {                                        
        if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
        Display.setText(Display.getText() + "0");
    }                                      

    private void ZifferEinsMouseClicked(java.awt.event.MouseEvent evt) {                                        
        if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
        Display.setText(Display.getText() + "1");
    }                                      

    private void ZifferZweiMouseClicked(java.awt.event.MouseEvent evt) {                                        
        if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
        Display.setText(Display.getText() + "2");
    }                                      


Wieso nicht eine generelle Methode
Java Code:
private void ZifferMouseClicked(MouseEvent evt, int clicked) {
        if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
        Display.setText(Display.getText() + Integer.toString(clicked));
}
Java Code:
private void ZifferMouseClicked(MouseEvent evt, int clicked) {
if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
Display.setText(Display.getText() + Integer.toString(clicked));
}
Java Code:
private void ZifferMouseClicked(MouseEvent evt, int clicked) {
        if(ZahlIstGanz) {Display.setText(""); ZahlIstGanz = false;}
        Display.setText(Display.getText() + Integer.toString(clicked));
}

_________________
http://www.globalscaling.de/
http://www.globalscalingsoftware.de/
C/C++ Forum :: Java ::  BigDecimal / String nach BigDecimal konvertieren  
Gehen Sie zu Seite Zurück  1, 2
Auf Beitrag antworten

Zeige alle Beiträge auf einer Seite




Nächstes Thema anzeigen
Vorheriges Thema anzeigen
Sie können Beiträge in dieses Forum schreiben.
Sie können auf Beiträge in diesem Forum antworten.
Sie können Ihre Beiträge in diesem Forum nicht bearbeiten.
Sie können Ihre Beiträge in diesem Forum nicht löschen.
Sie können an Umfragen in diesem Forum nicht mitmachen.

Powered by phpBB © 2001, 2002 phpBB Group :: FI Theme

c++.de ist Teilnehmer des Partnerprogramms von Amazon Europe S.à.r.l. und Partner des Werbeprogramms, das zur Bereitstellung eines Mediums für Websites konzipiert wurde, mittels dessen durch die Platzierung von Werbeanzeigen und Links zu amazon.de Werbekostenerstattung verdient werden kann.

Die Vervielfältigung der auf den Seiten www.c-plusplus.de, www.c-plusplus.info, www.c-sar.de, www.c-plusplus.net und www.baeckmann.de enthaltenen Informationen ohne eine schriftliche Genehmigung des Seitenbetreibers ist untersagt (vgl. §4 Urheberrechtsgesetz). Die Nutzung und Änderung der vorgestellten Strukturen und Verfahren in privaten und kommerziellen Softwareanwendungen ist ausdrücklich erlaubt, soweit keine Rechte Dritter verletzt werden. Der Seitenbetreiber übernimmt keine Gewähr für die Funktion einzelner Beiträge oder Programmfragmente, insbesondere übernimmt er keine Haftung für eventuelle aus dem Gebrauch entstehenden Folgeschäden.