public void actionPerformed(ActionEvent e) {
        String command = e.getActionCommand();
        if ("openfile".equals(command)) {
            int rv = chooser.showOpenDialog(this);
            if (rv == JFileChooser.APPROVE_OPTION) {
                openFile(chooser.getSelectedFile());
            }
        } else if ("openurl".equals(command)) {
            Object rv = JOptionPane.showInputDialog(this, "Enter the URL of the resource to be parsed:", "Open URL", JOptionPane.PLAIN_MESSAGE, null, null, "");
            if (rv != null && rv
                    .toString()
                    .length() > 0) {
                try {
                    openURL(new URL(rv
                            .toString()
                            .trim()));
                } catch (MalformedURLException exception) {
                    JOptionPane.showMessageDialog(this, "The given string is not a valid URL", "Invalid URL", JOptionPane.ERROR_MESSAGE);
                }
            }
        } else if ("html".equals(command)) {
            layout.show(cards, command);
        } else if ("text".equals(command)) {
            layout.show(cards, command);
        } else if ("main".equals(command)) {
            layout.show(cards, command);
        } else if ("xhtml".equals(command)) {
            layout.show(cards, command);
        } else if ("metadata".equals(command)) {
            layout.show(cards, command);
        } else if ("json".equals(command)) {
            layout.show(cards, command);
        } else if ("about".equals(command)) {
            textDialog("About Apache Tika", TikaGUI.class.getResource("about.html"));
        } else if ("exit".equals(command)) {
            Toolkit
                    .getDefaultToolkit()
                    .getSystemEventQueue()
                    .postEvent(new WindowEvent(this, WindowEvent.WINDOW_CLOSING));
        }
    }
Main method. Sets the Swing look and feel to the operating system
settings, and starts the Tika GUI with an {@link AutoDetectParser}
instance as the default parser.

@param args ignored
@throws Exception if an error occurs
tika-app/src/main/java/org/apache/tika/gui/TikaGUI.java