control = new squidpony.squidgrid.gui.FontChoiceControlPanel(width, height);
frame.getContentPane().add(control, BorderLayout.NORTH);
textFactory = new TextCellFactory(control.getFontFace(), control.getCellWidth(), control.getCellHeight());
display = new SwingPane(width, height, textFactory, null);
back = new SwingPane(width, height, textFactory, null);
final JLayeredPane layers = new JLayeredPane();
layers.setLayer(display, JLayeredPane.PALETTE_LAYER);
layers.setLayer(back, JLayeredPane.DEFAULT_LAYER);
layers.add(display);
layers.add(back);
layers.setSize(display.getPreferredSize());
layers.setPreferredSize(display.getPreferredSize());
layers.setMinimumSize(display.getPreferredSize());
frame.add(layers, BorderLayout.SOUTH);
frame.getContentPane().setBackground(SColor.BLACK);
String text = "";
for (char c = 33; c <= 125; c++) {
text += c;
}
control.inputTextArea.setText(text);
control.updateButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae) {
control.validateInput();
layers.remove(display);
layers.remove(back);
textFactory = new TextCellFactory(control.getFontFace(), control.getCellWidth(), control.getCellHeight(),
control.antialiasBox.isSelected(), control.getTopPad(), control.getBottomPad(), control.getLeftPad(), control.getRightPad(),
control.inputTextArea.getText());
display = new SwingPane(width, height, textFactory, null);
back = new SwingPane(width, height, textFactory, null);
layers.setLayer(display, JLayeredPane.PALETTE_LAYER);
layers.setLayer(back, JLayeredPane.DEFAULT_LAYER);
layers.add(display);
layers.add(back);