| 240 | |
| 241 | |
| 242 | public void update() { |
| 243 | int fontSize = 0; |
| 244 | try { |
| 245 | fontSize = Integer.parseInt(sizeSelector.getText().trim()); |
| 246 | //System.out.println("'" + sizeSelector.getText() + "'"); |
| 247 | } catch (NumberFormatException ignored) { } |
| 248 | |
| 249 | // if a deselect occurred, selection will be -1 |
| 250 | if ((fontSize > 0) && (fontSize < 256) && (selection != -1)) { |
| 251 | //font = new Font(list[selection], Font.PLAIN, fontSize); |
| 252 | Font instance = nameToFont.get(fontNames[selection]); |
| 253 | // font = instance.deriveFont(Font.PLAIN, fontSize); |
| 254 | font = instance.deriveFont((float) fontSize); |
| 255 | //System.out.println("setting font to " + font); |
| 256 | sample.setFont(font); |
| 257 | |
| 258 | String filenameSuggestion = fontNames[selection].replace(' ', '_'); |
| 259 | filenameSuggestion += "-" + fontSize; |
| 260 | filenameField.setText(filenameSuggestion); |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | |
| 265 | public void build() { |