private void buildContent()

in jflex/src/main/java/jflex/gui/MainFrame.java [76:192]


  private void buildContent() {
    setBackground(SystemColor.control);

    generate = new Button("Generate");
    quit = new Button("Quit");
    Button options = new Button("Options");
    dirChoose = new Button("Browse");
    dir = new TextField(10);
    specChoose = new Button("Browse");
    spec = new TextField(10);
    messages = new TextArea(10, 80);

    messages.setEditable(false);
    Font font = messages.getFont();
    if (font != null) messages.setFont(new Font("Monospaced", font.getStyle(), font.getSize()));
    else messages.setFont(new Font("Monospaced", Font.PLAIN, 12));

    Out.setGUIMode(messages);

    generate.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            generate();
          }
        });

    options.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            showOptions();
          }
        });

    quit.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            quit();
          }
        });

    specChoose.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            specChoose();
          }
        });

    dirChoose.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            dirChoose();
          }
        });

    spec.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            fileName = spec.getText();
            generate();
          }
        });

    spec.addTextListener(
        new TextListener() {
          @Override
          public void textValueChanged(TextEvent e) {
            fileName = spec.getText();
          }
        });

    dir.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            dirName = dir.getText();
            generate();
          }
        });

    dir.addTextListener(
        new TextListener() {
          @Override
          public void textValueChanged(TextEvent e) {
            dirName = dir.getText();
          }
        });

    GridPanel north = new GridPanel(5, 4, 10, 10);
    north.setInsets(new Insets(10, 5, 5, 10));

    north.add(4, 0, quit);
    north.add(4, 1, generate);
    north.add(4, 2, options);

    north.add(0, 0, Handles.BOTTOM, new Label("Lexical specification:"));
    north.add(0, 1, 2, 1, spec);
    north.add(2, 1, specChoose);

    north.add(0, 2, Handles.BOTTOM, new Label("Output directory:"));
    north.add(0, 3, 2, 1, dir);
    north.add(2, 3, dirChoose);

    Panel center = new Panel(new BorderLayout());
    center.add("North", new Label("Messages:"));
    center.add("Center", messages);

    add("North", north);
    add("Center", center);

    setEnabledAll(false);
  }