예제 #1
0
  // ----------------------------------------------------------------------------
  private JPanel createFontSelection() {
    JPanel panel = new JPanel(new GridLayout(1, 2, 10, 2));
    panel.setBorder(new TitledBorder(new EtchedBorder(), "Font"));

    FontLoader loader = FontLoader.getInstance();

    font_names_ = new OpenList(loader.getFontNames(), "Name:");
    panel.add(font_names_);

    font_sizes_ = new OpenList(sizes_, "Size:");
    panel.add(font_sizes_);

    ListSelectionListener lsel =
        new ListSelectionListener() {
          public void valueChanged(ListSelectionEvent e) {
            // System.out.println("MODIFICATION");
            updatePreview();
          }
        };

    font_sizes_.setSelected("24");
    font_names_.setSelected(loader.getFontNames()[0]);

    font_names_.addListSelectionListener(lsel);
    font_sizes_.addListSelectionListener(lsel);

    return panel;
  }
예제 #2
0
  // ----------------------------------------------------------------------------
  protected void updatePreview() {
    // FontContainer font = ((at.bestsolution.drawswf.fontdialog.FontContainer)
    // font_names_.getSelectedObject());

    // System.out.println("FONT:" + font_names_.getSelected() );

    String name = font_names_.getSelected();
    int size = font_sizes_.getSelectedInt();

    if (size > 0 && name != null) {
      Font real_font = FontLoader.getInstance().getFont(name, Font.PLAIN, size);
      text_field_.setFont(real_font);
      text_field_.repaint();
    }

    draw_font_ =
        new DrawSWFFont(
            text_field_.getFont(), effect_, text_field_.getText(), color_button_.getColor());
    fireStateChanged();
  }