1 /*
2 Copyright (c) 2013 Koanxd aka Snowblind
3 
4 Permission is hereby granted, free of charge, to any person obtaining a copy of
5 this software and associated documentation files (the "Software"), to deal in
6 the Software without restriction, including without limitation the rights to
7 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 of the Software, and to permit persons to whom the Software is furnished to do
9 so, subject to the following conditions:
10 
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13 
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 SOFTWARE.
21  */
22 
23 package com.corsixth.leveledit;
24 
25 import java.awt.event.FocusEvent;
26 import java.awt.event.FocusListener;
27 import javax.swing.JLabel;
28 import javax.swing.JScrollPane;
29 import javax.swing.JTextArea;
30 import javax.swing.JTextField;
31 import javax.swing.text.AbstractDocument;
32 import javax.swing.text.AttributeSet;
33 import javax.swing.text.BadLocationException;
34 import javax.swing.text.DocumentFilter;
35 
36 //creates the general panel
37 public class TabGeneral extends JScrollPane {
38 
39     private static final long serialVersionUID = -1025120107673788464L;
40 
41     // variables
42     static final String NAME = "Example Town";
43     static final String MAP_FILE = "Example.map";
44     static final String BRIEFING = "No briefing yet!";
45     static final int START_CASH = 40000;
46     static final double INTEREST = 1.0;
47     static final int DRUG_START_RATING = 100;
48     static final int DRUG_IMPROVE_RATE = 5;
49     static final int DRUG_START_COST = 100;
50     static final int DRUG_MIN_COST = 50;
51     static final int LAND_COST_PER_TILE = 25;
52     static final int AUTOPSY_RESEARCH_PERCENT = 33;
53     static final int AUTOPSY_REPHIT_PERCENT = 25;
54     static final int RESEARCH_UPGRADE_COST = 10;
55     static final int RESEARCH_UPGRADE_INCREMENT_COST = 10;
56     static final int STRENGTH_INCREMENT = 2;
57     static final int MAX_STRENGTH = 20;
58 
59     static String name = NAME;
60     static String mapFile = MAP_FILE;
61     static String briefing = BRIEFING;
62     static int startCash = START_CASH;
63     static double interest = INTEREST;
64     static int drugStartRating = DRUG_START_RATING;
65     static int drugImproveRate = DRUG_IMPROVE_RATE;
66     static int drugStartCost = DRUG_START_COST;
67     static int drugMinCost = DRUG_MIN_COST;
68     static int landCostPerTile = LAND_COST_PER_TILE;
69     static int autopsyResearchPercent = AUTOPSY_RESEARCH_PERCENT;
70     static int autopsyRepHitPercent = AUTOPSY_REPHIT_PERCENT;
71     static int researchUpgradeCost = RESEARCH_UPGRADE_COST;
72     static int researchUpgradeIncrementCost = RESEARCH_UPGRADE_INCREMENT_COST;
73     static int strengthIncrement = STRENGTH_INCREMENT;
74     static int maxStrength = MAX_STRENGTH;
75 
76     // components
77     GridPanel general = new GridPanel(2);
78     // JScrollPane scrollPane = new JScrollPane(general);
79 
80     JLabel nameLabel = new JLabel("Name:");
81     JLabel mapFileLabel = new JLabel("Map file:");
82     JLabel briefingLabel = new JLabel("Briefing:");
83     JLabel startCashLabel = new JLabel("Start cash:");
84     JLabel interestRateLabel = new JLabel("Interest in %:");
85     JLabel drugStartRatingLabel = new JLabel("Drug effectiveness:");
86     JLabel drugImproveRateLabel = new JLabel("Drug improve rate:");
87     JLabel drugStartCostLabel = new JLabel("Drug starting cost:");
88     JLabel drugMinCostLabel = new JLabel("Minimum drug cost:");
89     JLabel landCostPerTileLabel = new JLabel("Land cost per tile:");
90     JLabel autopsyResearchPercentLabel = new JLabel("Autopsy research:");
91     JLabel autopsyRepHitPercentLabel = new JLabel("Autopsy reputation hit:");
92     JLabel researchUpgradeCostLabel = new JLabel("Upgrade research required:");
93     JLabel researchUpgradeIncrementCostLabel = new JLabel(
94             "Upgrade research increment:");
95     JLabel strengthIncrementLabel = new JLabel("Strength Increment:");
96     JLabel maxStrengthLabel = new JLabel("Max Object Strength:");
97 
98     static JTextField nameTF = new JTextField(50);
99     static JTextField mapFileTF = new JTextField(50);
100     static JTextArea briefingTA = new JTextArea(3, 50);
101     static JTextField startCashTF = new JTextField(10);
102     static JTextField interestTF = new JTextField(10);
103     static JTextField drugStartRatingTF = new JTextField(10);
104     static JTextField drugStartCostTF = new JTextField(10);
105     static JTextField drugImproveRateTF = new JTextField(10);
106     static JTextField drugMinCostTF = new JTextField(10);
107     static JTextField landCostPerTileTF = new JTextField(10);
108     static JTextField autopsyResearchPercentTF = new JTextField(10);
109     static JTextField autopsyRepHitPercentTF = new JTextField(10);
110     static JTextField researchUpgradeCostTF = new JTextField(10);
111     static JTextField researchUpgradeIncrementCostTF = new JTextField(10);
112     static JTextField strengthIncrementTF = new JTextField(10);
113     static JTextField maxStrengthTF = new JTextField(10);
114 
TabGeneral()115     public TabGeneral() {
116 
117         // set scroll speed
118         getVerticalScrollBar().setUnitIncrement(20);
119         getHorizontalScrollBar().setUnitIncrement(20);
120 
121         setViewportView(general);
122         general.add(nameLabel);
123         general.add(nameTF);
124         nameLabel
125                 .setToolTipText("Name to be displayed on the town map or when choosing a level");
126 
127         // when the keyboard focus (the cursor) is put on the textfield or
128         // leaves the textfield,
129         // perform an action as specified in the TabItem class.
130         nameTF.addFocusListener(new FocusListener() {
131             @Override
132             public void focusGained(FocusEvent e) {
133                 ((JTextField) e.getComponent()).selectAll();
134             }
135 
136             @Override
137             public void focusLost(FocusEvent e) {
138                 name = nameTF.getText();
139             }
140         });
141 
142         general.add(mapFileLabel);
143         general.add(mapFileTF);
144         mapFileLabel
145                 .setToolTipText("Must be a .map file or one of the original levels (Level.L1 - Level.L44). "
146                         + "If a custom map is used, it must be in the levels directory of CorsixTH.");
147         mapFileTF.addFocusListener(new FocusListener() {
148             @Override
149             public void focusGained(FocusEvent e) {
150                 ((JTextField) e.getComponent()).selectAll();
151             }
152 
153             @Override
154             public void focusLost(FocusEvent e) {
155                 String input = mapFileTF.getText();
156                 // if the input is not a .map file or one of the original
157                 // levels (level.l1 - level.l44), append ".map" automatically.
158                 if ((input.toLowerCase().matches(".*\\.map")) == true
159                         || (input.toLowerCase()
160                                 .matches("(level\\.l[1-9])|(level\\.l[1-3]\\d)|(level\\.l4[0-4])")) == true) {
161                     mapFile = input;
162                 } else {
163                     mapFile = input + ".map";
164                     mapFileTF.setText(mapFile);
165                 }
166             }
167         });
168 
169         general.add(briefingLabel);
170         general.add(briefingTA);
171         briefingLabel
172                 .setToolTipText("The text to be displayed when starting a level");
173         briefingTA.setLineWrap(true);
174         briefingTA.setWrapStyleWord(true);
175         // the document filter restricts newline characters.
176         ((AbstractDocument) briefingTA.getDocument())
177                 .setDocumentFilter(new DocumentFilter() {
178                     @Override
179                     public void insertString(DocumentFilter.FilterBypass fb,
180                             int offset, String text, AttributeSet attr)
181                             throws BadLocationException {
182                         fb.insertString(offset, text.replaceAll("\n", ""), attr);
183                     }
184 
185                     @Override
186                     public void replace(DocumentFilter.FilterBypass fb,
187                             int offset, int length, String text,
188                             AttributeSet attr) throws BadLocationException {
189                         fb.replace(offset, length, text.replaceAll("\n", ""),
190                                 attr);
191                     }
192                 });
193         briefingTA.addFocusListener(new FocusListener() {
194             @Override
195             public void focusGained(FocusEvent e) {
196             }
197 
198             @Override
199             public void focusLost(FocusEvent e) {
200                 briefing = briefingTA.getText();
201             }
202         });
203 
204         general.add(startCashLabel);
205         general.add(startCashTF);
206         startCashLabel.setToolTipText("Cash at the start of the level");
207         startCashTF.addFocusListener(new FocusListener() {
208             @Override
209             public void focusGained(FocusEvent e) {
210                 ((JTextField) e.getComponent()).selectAll();
211                 Gui.tempValue = startCashTF.getText();
212             }
213 
214             @Override
215             public void focusLost(FocusEvent e) {
216                 try {
217                     int input = Integer.parseInt(startCashTF.getText());
218                     startCash = input;
219                 } catch (NumberFormatException nfe) {
220                     startCash = Integer.parseInt(Gui.tempValue);
221                     startCashTF.setText(Integer.toString(startCash));
222                 }
223             }
224         });
225 
226         general.add(interestRateLabel);
227         general.add(interestTF);
228         interestRateLabel.setToolTipText("Interest payment per year");
229         interestTF.addFocusListener(new FocusListener() {
230             @Override
231             public void focusGained(FocusEvent e) {
232                 ((JTextField) e.getComponent()).selectAll();
233                 Gui.tempValue = interestTF.getText();
234             }
235 
236             @Override
237             public void focusLost(FocusEvent e) {
238                 try {
239                     String inputString = interestTF.getText().replaceAll(",",
240                             ".");
241                     double inputInterest = Double.parseDouble(inputString);
242                     interestTF.setText(inputString);
243                     if (inputInterest < 0) {
244                         interest = 0;
245                         interestTF.setText(Double.toString(interest));
246                     } else if (inputInterest >= 100) {
247                         interest = 99.9;
248                         interestTF.setText(Double.toString(interest));
249                     } else
250                         interest = inputInterest;
251                 } catch (NumberFormatException nfe) {
252                     interest = Double.parseDouble(Gui.tempValue);
253                     interestTF.setText(Double.toString(interest));
254                 }
255             }
256         });
257 
258         general.add(drugStartRatingLabel);
259         general.add(drugStartRatingTF);
260         drugStartRatingLabel
261                 .setToolTipText("Drug effectiveness in % to start with");
262         drugStartRatingTF.addFocusListener(new FocusListener() {
263             @Override
264             public void focusGained(FocusEvent e) {
265                 ((JTextField) e.getComponent()).selectAll();
266                 Gui.tempValue = drugStartRatingTF.getText();
267             }
268 
269             @Override
270             public void focusLost(FocusEvent e) {
271                 try {
272                     int input = Integer.parseInt(drugStartRatingTF.getText());
273                     if (input <= 0) {
274                         drugStartRating = 1;
275                         drugStartRatingTF.setText(Integer
276                                 .toString(drugStartRating));
277                     } else if (input > 100) {
278                         drugStartRating = 100;
279                         drugStartRatingTF.setText(Integer
280                                 .toString(drugStartRating));
281                     } else
282                         drugStartRating = input;
283                 } catch (NumberFormatException nfe) {
284                     drugStartRating = Integer.parseInt(Gui.tempValue);
285                     drugStartRatingTF.setText(Integer.toString(drugStartRating));
286                 }
287             }
288         });
289 
290         general.add(drugImproveRateLabel);
291         general.add(drugImproveRateTF);
292         drugImproveRateLabel
293                 .setToolTipText("When a drug is improved by research, "
294                         + "increase its effectiveness by this amount");
295         drugImproveRateTF.addFocusListener(new FocusListener() {
296             @Override
297             public void focusGained(FocusEvent e) {
298                 ((JTextField) e.getComponent()).selectAll();
299                 Gui.tempValue = drugImproveRateTF.getText();
300             }
301 
302             @Override
303             public void focusLost(FocusEvent e) {
304                 try {
305                     int input = Integer.parseInt(drugImproveRateTF.getText());
306                     if (input <= 0) {
307                         drugImproveRate = 1;
308                         drugImproveRateTF.setText(Integer
309                                 .toString(drugImproveRate));
310                     } else if (input > 100) {
311                         drugImproveRate = 100;
312                         drugImproveRateTF.setText(Integer
313                                 .toString(drugImproveRate));
314                     } else
315                         drugImproveRate = input;
316                 } catch (NumberFormatException nfe) {
317                     drugImproveRate = Integer.parseInt(Gui.tempValue);
318                     drugImproveRateTF.setText(Integer.toString(drugImproveRate));
319                 }
320             }
321         });
322 
323         general.add(drugStartCostLabel);
324         general.add(drugStartCostTF);
325         drugStartCostLabel
326                 .setToolTipText("How much it costs each time a drug is used");
327         drugStartCostTF.addFocusListener(new FocusListener() {
328             @Override
329             public void focusGained(FocusEvent e) {
330                 ((JTextField) e.getComponent()).selectAll();
331                 Gui.tempValue = drugStartCostTF.getText();
332             }
333 
334             @Override
335             public void focusLost(FocusEvent e) {
336                 try {
337                     int input = Integer.parseInt(drugStartCostTF.getText());
338                     if (input < 0) {
339                         drugStartCost = 0;
340                         drugStartCostTF.setText(Integer.toString(drugStartCost));
341                     } else if (input > 10000) {
342                         drugStartCost = 10000;
343                         drugStartCostTF.setText(Integer.toString(drugStartCost));
344                     } else
345                         drugStartCost = input;
346                 } catch (NumberFormatException nfe) {
347                     drugStartCost = Integer.parseInt(Gui.tempValue);
348                     drugStartCostTF.setText(Integer.toString(drugStartCost));
349                 }
350                 if (drugMinCost > drugStartCost) {
351                     drugMinCost = drugStartCost;
352                     drugMinCostTF.setText(Integer.toString(drugMinCost));
353                 }
354             }
355         });
356 
357         general.add(drugMinCostLabel);
358         general.add(drugMinCostTF);
359         drugMinCostLabel
360                 .setToolTipText("The lowest drug cost you can get by researching");
361         drugMinCostTF.addFocusListener(new FocusListener() {
362             @Override
363             public void focusGained(FocusEvent e) {
364                 ((JTextField) e.getComponent()).selectAll();
365                 Gui.tempValue = drugMinCostTF.getText();
366             }
367 
368             @Override
369             public void focusLost(FocusEvent e) {
370                 try {
371                     int input = Integer.parseInt(drugMinCostTF.getText());
372                     if (input < 0) {
373                         drugMinCost = 0;
374                         drugMinCostTF.setText(Integer.toString(drugMinCost));
375                     } else
376                         drugMinCost = input;
377                 } catch (NumberFormatException nfe) {
378                     drugMinCost = Integer.parseInt(Gui.tempValue);
379                     drugMinCostTF.setText(Integer.toString(drugMinCost));
380                 }
381                 if (drugMinCost > drugStartCost) {
382                     drugMinCost = drugStartCost;
383                     drugMinCostTF.setText(Integer.toString(drugMinCost));
384                 }
385             }
386         });
387 
388         general.add(landCostPerTileLabel);
389         general.add(landCostPerTileTF);
390         landCostPerTileLabel
391                 .setToolTipText("Cost for purchasing a single square tile of land");
392         landCostPerTileTF.addFocusListener(new FocusListener() {
393             @Override
394             public void focusGained(FocusEvent e) {
395                 ((JTextField) e.getComponent()).selectAll();
396                 Gui.tempValue = landCostPerTileTF.getText();
397             }
398 
399             @Override
400             public void focusLost(FocusEvent e) {
401                 try {
402                     int input = Integer.parseInt(landCostPerTileTF.getText());
403                     if (input < 0) {
404                         landCostPerTile = 0;
405                         landCostPerTileTF.setText(Integer
406                                 .toString(landCostPerTile));
407                     } else if (input > 1000) {
408                         landCostPerTile = 1000;
409                         landCostPerTileTF.setText(Integer
410                                 .toString(landCostPerTile));
411                     } else
412                         landCostPerTile = input;
413                 } catch (NumberFormatException nfe) {
414                     landCostPerTile = Integer.parseInt(Gui.tempValue);
415                     landCostPerTileTF.setText(Integer.toString(landCostPerTile));
416                 }
417             }
418         });
419 
420         general.add(autopsyResearchPercentLabel);
421         general.add(autopsyResearchPercentTF);
422         autopsyResearchPercentLabel
423                 .setToolTipText("% of research completed for an autopsy");
424         autopsyResearchPercentTF.addFocusListener(new FocusListener() {
425             @Override
426             public void focusGained(FocusEvent e) {
427                 ((JTextField) e.getComponent()).selectAll();
428                 Gui.tempValue = autopsyResearchPercentTF.getText();
429             }
430 
431             @Override
432             public void focusLost(FocusEvent e) {
433                 try {
434                     int input = Integer.parseInt(autopsyResearchPercentTF
435                             .getText());
436                     if (input < 1) {
437                         autopsyResearchPercent = 1;
438                         autopsyResearchPercentTF.setText(Integer
439                                 .toString(autopsyResearchPercent));
440                     } else if (input > 100) {
441                         autopsyResearchPercent = 100;
442                         autopsyResearchPercentTF.setText(Integer
443                                 .toString(autopsyResearchPercent));
444                     } else
445                         autopsyResearchPercent = input;
446                 } catch (NumberFormatException nfe) {
447                     autopsyResearchPercent = Integer.parseInt(Gui.tempValue);
448                     autopsyResearchPercentTF.setText(Integer
449                             .toString(autopsyResearchPercent));
450                 }
451             }
452         });
453 
454         general.add(autopsyRepHitPercentLabel);
455         general.add(autopsyRepHitPercentTF);
456         autopsyRepHitPercentLabel
457                 .setToolTipText("% reputation hit for discovered autopsy");
458         autopsyRepHitPercentTF.addFocusListener(new FocusListener() {
459             @Override
460             public void focusGained(FocusEvent e) {
461                 ((JTextField) e.getComponent()).selectAll();
462                 Gui.tempValue = autopsyRepHitPercentTF.getText();
463             }
464 
465             @Override
466             public void focusLost(FocusEvent e) {
467                 try {
468                     int input = Integer.parseInt(autopsyRepHitPercentTF
469                             .getText());
470                     if (input < 0) {
471                         autopsyRepHitPercent = 0;
472                         autopsyRepHitPercentTF.setText(Integer
473                                 .toString(autopsyRepHitPercent));
474                     } else if (input > 99) {
475                         autopsyRepHitPercent = 99;
476                         autopsyRepHitPercentTF.setText(Integer
477                                 .toString(autopsyRepHitPercent));
478                     } else
479                         autopsyRepHitPercent = input;
480                 } catch (NumberFormatException nfe) {
481                     autopsyRepHitPercent = Integer.parseInt(Gui.tempValue);
482                     autopsyRepHitPercentTF.setText(Integer
483                             .toString(autopsyRepHitPercent));
484                 }
485             }
486         });
487 
488         general.add(researchUpgradeCostLabel);
489         general.add(researchUpgradeCostTF);
490         researchUpgradeCostLabel
491                 .setToolTipText("How many percent of the original research points of a machine are required to improve it.");
492         researchUpgradeCostTF.addFocusListener(new FocusListener() {
493             @Override
494             public void focusGained(FocusEvent e) {
495                 ((JTextField) e.getComponent()).selectAll();
496                 Gui.tempValue = researchUpgradeCostTF.getText();
497             }
498 
499             @Override
500             public void focusLost(FocusEvent e) {
501                 try {
502                     int input = Integer.parseInt(researchUpgradeCostTF
503                             .getText());
504                     if (input < 1) {
505                         researchUpgradeCost = 1;
506                         researchUpgradeCostTF.setText(Integer
507                                 .toString(researchUpgradeCost));
508                     } else if (input > 1000) {
509                         researchUpgradeCost = 1000;
510                         researchUpgradeCostTF.setText(Integer
511                                 .toString(researchUpgradeCost));
512                     } else
513                         researchUpgradeCost = input;
514                 } catch (NumberFormatException nfe) {
515                     researchUpgradeCost = Integer.parseInt(Gui.tempValue);
516                     researchUpgradeCostTF.setText(Integer
517                             .toString(researchUpgradeCost));
518                 }
519             }
520         });
521 
522         general.add(researchUpgradeIncrementCostLabel);
523         general.add(researchUpgradeIncrementCostTF);
524         researchUpgradeIncrementCostLabel
525                 .setToolTipText("How many additional percentage points are added to the above value for each upgrade.");
526         researchUpgradeIncrementCostTF.addFocusListener(new FocusListener() {
527             @Override
528             public void focusGained(FocusEvent e) {
529                 ((JTextField) e.getComponent()).selectAll();
530                 Gui.tempValue = researchUpgradeIncrementCostTF.getText();
531             }
532 
533             @Override
534             public void focusLost(FocusEvent e) {
535                 try {
536                     int input = Integer.parseInt(researchUpgradeIncrementCostTF
537                             .getText());
538                     if (input < 0) {
539                         researchUpgradeIncrementCost = 0;
540                         researchUpgradeIncrementCostTF.setText(Integer
541                                 .toString(researchUpgradeIncrementCost));
542                     } else if (input > 1000) {
543                         researchUpgradeIncrementCost = 1000;
544                         researchUpgradeIncrementCostTF.setText(Integer
545                                 .toString(researchUpgradeIncrementCost));
546                     } else
547                         researchUpgradeIncrementCost = input;
548                 } catch (NumberFormatException nfe) {
549                     researchUpgradeIncrementCost = Integer
550                             .parseInt(Gui.tempValue);
551                     researchUpgradeIncrementCostTF.setText(Integer
552                             .toString(researchUpgradeIncrementCost));
553                 }
554             }
555         });
556 
557         general.add(strengthIncrementLabel);
558         general.add(strengthIncrementTF);
559         strengthIncrementLabel
560                 .setToolTipText("Increase object strength by this amount when researching");
561         strengthIncrementTF.addFocusListener(new FocusListener() {
562             @Override
563             public void focusGained(FocusEvent e) {
564                 ((JTextField) e.getComponent()).selectAll();
565                 Gui.tempValue = strengthIncrementTF.getText();
566             }
567 
568             @Override
569             public void focusLost(FocusEvent e) {
570                 try {
571                     int input = Integer.parseInt(strengthIncrementTF.getText());
572                     if (input < 1) {
573                         strengthIncrement = 1;
574                         strengthIncrementTF.setText(Integer
575                                 .toString(strengthIncrement));
576                     } else if (input > 99) {
577                         strengthIncrement = 99;
578                         strengthIncrementTF.setText(Integer
579                                 .toString(strengthIncrement));
580                     } else
581                         strengthIncrement = input;
582                 } catch (NumberFormatException nfe) {
583                     strengthIncrement = Integer.parseInt(Gui.tempValue);
584                     strengthIncrementTF.setText(Integer
585                             .toString(strengthIncrement));
586                 }
587             }
588         });
589 
590         general.add(maxStrengthLabel);
591         general.add(maxStrengthTF);
592         maxStrengthLabel
593                 .setToolTipText("Maximum strength value an object can be improved to (by research)");
594         maxStrengthTF.addFocusListener(new FocusListener() {
595             @Override
596             public void focusGained(FocusEvent e) {
597                 ((JTextField) e.getComponent()).selectAll();
598                 Gui.tempValue = maxStrengthTF.getText();
599             }
600 
601             @Override
602             public void focusLost(FocusEvent e) {
603                 try {
604                     int input = Integer.parseInt(maxStrengthTF.getText());
605                     if (input < 1) {
606                         maxStrength = 1;
607                         maxStrengthTF.setText(Integer.toString(maxStrength));
608                     } else if (input > 99) {
609                         maxStrength = 99;
610                         maxStrengthTF.setText(Integer.toString(maxStrength));
611                     } else
612                         maxStrength = input;
613                 } catch (NumberFormatException nfe) {
614                     maxStrength = Integer.parseInt(Gui.tempValue);
615                     maxStrengthTF.setText(Integer.toString(maxStrength));
616                 }
617             }
618         });
619     }
620 
621 }
622