Frame for selecting which characters will be included with the font.
| 475 | * Frame for selecting which characters will be included with the font. |
| 476 | */ |
| 477 | class CharacterSelector extends JFrame { |
| 478 | JRadioButton defaultCharsButton; |
| 479 | JRadioButton allCharsButton; |
| 480 | JRadioButton unicodeCharsButton; |
| 481 | JScrollPane unicodeBlockScroller; |
| 482 | JList<JCheckBox> charsetList; |
| 483 | |
| 484 | |
| 485 | public CharacterSelector() { |
| 486 | super(Language.text("create_font.character_selector")); |
| 487 | |
| 488 | charsetList = new CheckBoxList(); |
| 489 | DefaultListModel<JCheckBox> model = new DefaultListModel<JCheckBox>(); |
| 490 | charsetList.setModel(model); |
| 491 | for (String item : blockNames) { |
| 492 | model.addElement(new JCheckBox(item)); |
| 493 | } |
| 494 | |
| 495 | unicodeBlockScroller = |
| 496 | new JScrollPane(charsetList, |
| 497 | ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, |
| 498 | ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); |
| 499 | |
| 500 | Container outer = getContentPane(); |
| 501 | outer.setLayout(new BorderLayout()); |
| 502 | |
| 503 | JPanel pain = new JPanel(); |
| 504 | pain.setBorder(new EmptyBorder(13, 13, 13, 13)); |
| 505 | outer.add(pain, BorderLayout.CENTER); |
| 506 | |
| 507 | pain.setLayout(new BoxLayout(pain, BoxLayout.Y_AXIS)); |
| 508 | |
| 509 | String labelText = Language.text("create_font.character_selector.label"); |
| 510 | JTextArea textarea = new JTextArea(labelText); |
| 511 | textarea.setBorder(new EmptyBorder(13, 8, 13, 8)); |
| 512 | textarea.setBackground(null); |
| 513 | textarea.setEditable(false); |
| 514 | textarea.setHighlighter(null); |
| 515 | textarea.setFont(new Font("Dialog", Font.PLAIN, 12)); |
| 516 | pain.add(textarea); |
| 517 | |
| 518 | ActionListener listener = new ActionListener() { |
| 519 | public void actionPerformed(ActionEvent e) { |
| 520 | //System.out.println("action " + unicodeCharsButton.isSelected()); |
| 521 | //unicodeBlockScroller.setEnabled(unicodeCharsButton.isSelected()); |
| 522 | charsetList.setEnabled(unicodeCharsButton.isSelected()); |
| 523 | } |
| 524 | }; |
| 525 | defaultCharsButton = |
| 526 | new JRadioButton(Language.text("create_font.default_characters")); |
| 527 | allCharsButton = |
| 528 | new JRadioButton(Language.text("create_font.all_characters")); |
| 529 | unicodeCharsButton = |
| 530 | new JRadioButton(Language.text("create_font.specific_unicode")); |
| 531 | |
| 532 | defaultCharsButton.addActionListener(listener); |
| 533 | allCharsButton.addActionListener(listener); |
| 534 | unicodeCharsButton.addActionListener(listener); |