Merge remote-tracking branch

'origin/GT-3606_dragonmacher_PR-1541_rickyz_any-font-size'

Fixes #1541 Fixes #160
This commit is contained in:
ghidorahrex 2020-03-18 09:36:50 -04:00
commit e4084b40ee
2 changed files with 10 additions and 13 deletions

View file

@ -22,6 +22,7 @@ import java.beans.PropertyEditorSupport;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.IntStream;
import javax.swing.*;
@ -103,7 +104,7 @@ public class FontPropertyEditor extends PropertyEditorSupport {
JLabel fontLabel, sizeLabel, styleLabel;
JLabel fontStringLabel;
JComboBox<FontWrapper> fonts;
JComboBox<String> sizes;
JComboBox<Integer> sizes;
JComboBox<String> styles;
int styleChoice;
int sizeChoice;
@ -170,12 +171,11 @@ public class FontPropertyEditor extends PropertyEditorSupport {
fontPanel.add(fonts);
fonts.setSelectedItem(fontWrapper);
sizes = new GComboBox<>(
new String[] { "8", "10", "12", "14", "16", "18", "24", "28", "32" });
sizes = new GComboBox<>(IntStream.rangeClosed(1, 72).boxed().toArray(Integer[]::new));
sizes.setMaximumRowCount(9);
sizePanel.add(sizes);
sizeChoice = font.getSize();
sizes.setSelectedItem("" + sizeChoice);
sizes.setSelectedItem(sizeChoice);
sizes.setMaximumRowCount(9);
styles = new GComboBox<>(new String[] { "PLAIN", "BOLD", "ITALIC", "BOLD & ITALIC" });
@ -203,8 +203,7 @@ public class FontPropertyEditor extends PropertyEditorSupport {
styleChoice = styles.getSelectedIndex();
}
else {
String sizeStr = (String) sizes.getSelectedItem();
sizeChoice = Integer.parseInt(sizeStr);
sizeChoice = (Integer) sizes.getSelectedItem();
}
font = new Font(fontNameChoice, styleChoice, sizeChoice);