Example usage for javax.swing JScrollPane setVerticalScrollBarPolicy

List of usage examples for javax.swing JScrollPane setVerticalScrollBarPolicy

Introduction

In this page you can find the example usage for javax.swing JScrollPane setVerticalScrollBarPolicy.

Prototype

@BeanProperty(preferred = true, enumerationValues = { "ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED",
        "ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER",
        "ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS" }, description = "The scrollpane vertical scrollbar policy")
public void setVerticalScrollBarPolicy(int policy) 

Source Link

Document

Determines when the vertical scrollbar appears in the scrollpane.

Usage

From source file:components.TextSamplerDemo.java

public TextSamplerDemo() {
    setLayout(new BorderLayout());

    //Create a regular text field.
    JTextField textField = new JTextField(10);
    textField.setActionCommand(textFieldString);
    textField.addActionListener(this);

    //Create a password field.
    JPasswordField passwordField = new JPasswordField(10);
    passwordField.setActionCommand(passwordFieldString);
    passwordField.addActionListener(this);

    //Create a formatted text field.
    JFormattedTextField ftf = new JFormattedTextField(java.util.Calendar.getInstance().getTime());
    ftf.setActionCommand(textFieldString);
    ftf.addActionListener(this);

    //Create some labels for the fields.
    JLabel textFieldLabel = new JLabel(textFieldString + ": ");
    textFieldLabel.setLabelFor(textField);
    JLabel passwordFieldLabel = new JLabel(passwordFieldString + ": ");
    passwordFieldLabel.setLabelFor(passwordField);
    JLabel ftfLabel = new JLabel(ftfString + ": ");
    ftfLabel.setLabelFor(ftf);/*  ww w .  jav a 2s . c  o m*/

    //Create a label to put messages during an action event.
    actionLabel = new JLabel("Type text in a field and press Enter.");
    actionLabel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));

    //Lay out the text controls and the labels.
    JPanel textControlsPane = new JPanel();
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();

    textControlsPane.setLayout(gridbag);

    JLabel[] labels = { textFieldLabel, passwordFieldLabel, ftfLabel };
    JTextField[] textFields = { textField, passwordField, ftf };
    addLabelTextRows(labels, textFields, gridbag, textControlsPane);

    c.gridwidth = GridBagConstraints.REMAINDER; //last
    c.anchor = GridBagConstraints.WEST;
    c.weightx = 1.0;
    textControlsPane.add(actionLabel, c);
    textControlsPane.setBorder(BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder("Text Fields"), BorderFactory.createEmptyBorder(5, 5, 5, 5)));

    //Create a text area.
    JTextArea textArea = new JTextArea("This is an editable JTextArea. "
            + "A text area is a \"plain\" text component, " + "which means that although it can display text "
            + "in any font, all of the text is in the same font.");
    textArea.setFont(new Font("Serif", Font.ITALIC, 16));
    textArea.setLineWrap(true);
    textArea.setWrapStyleWord(true);
    JScrollPane areaScrollPane = new JScrollPane(textArea);
    areaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    areaScrollPane.setPreferredSize(new Dimension(250, 250));
    areaScrollPane.setBorder(BorderFactory.createCompoundBorder(
            BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Plain Text"),
                    BorderFactory.createEmptyBorder(5, 5, 5, 5)),
            areaScrollPane.getBorder()));

    //Create an editor pane.
    JEditorPane editorPane = createEditorPane();
    JScrollPane editorScrollPane = new JScrollPane(editorPane);
    editorScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    editorScrollPane.setPreferredSize(new Dimension(250, 145));
    editorScrollPane.setMinimumSize(new Dimension(10, 10));

    //Create a text pane.
    JTextPane textPane = createTextPane();
    JScrollPane paneScrollPane = new JScrollPane(textPane);
    paneScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    paneScrollPane.setPreferredSize(new Dimension(250, 155));
    paneScrollPane.setMinimumSize(new Dimension(10, 10));

    //Put the editor pane and the text pane in a split pane.
    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, editorScrollPane, paneScrollPane);
    splitPane.setOneTouchExpandable(true);
    splitPane.setResizeWeight(0.5);
    JPanel rightPane = new JPanel(new GridLayout(1, 0));
    rightPane.add(splitPane);
    rightPane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Styled Text"),
            BorderFactory.createEmptyBorder(5, 5, 5, 5)));

    //Put everything together.
    JPanel leftPane = new JPanel(new BorderLayout());
    leftPane.add(textControlsPane, BorderLayout.PAGE_START);
    leftPane.add(areaScrollPane, BorderLayout.CENTER);

    add(leftPane, BorderLayout.LINE_START);
    add(rightPane, BorderLayout.LINE_END);
}

From source file:com.clank.launcher.swing.MessageLog.java

private void initComponents() {
    if (colorEnabled) {
        JTextPane text = new JTextPane() {
            @Override/*ww  w  .j a v a  2s  . c o  m*/
            public boolean getScrollableTracksViewportWidth() {
                return true;
            }
        };
        this.textComponent = text;
    } else {
        JTextArea text = new JTextArea();
        this.textComponent = text;
        text.setLineWrap(true);
        text.setWrapStyleWord(true);
    }

    textComponent.setFont(new JLabel().getFont());
    textComponent.setEditable(false);
    textComponent.setComponentPopupMenu(TextFieldPopupMenu.INSTANCE);
    DefaultCaret caret = (DefaultCaret) textComponent.getCaret();
    caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
    document = textComponent.getDocument();
    document.addDocumentListener(new LimitLinesDocumentListener(numLines, true));

    JScrollPane scrollText = new JScrollPane(textComponent);
    scrollText.setBorder(null);
    scrollText.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    scrollText.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

    add(scrollText, BorderLayout.CENTER);
}

From source file:org.kepler.plotting.Plot.java

public void setScrolling(boolean scrolling) {

    GridBagConstraints constraints = new GridBagConstraints();
    constraints.gridx = 1;//w  w  w  .ja va  2s.c  o  m
    constraints.gridy = 1;

    if (panel == null) {
        // initialize panel
        panel = new JPanel(new GridBagLayout());
    } else {
        panel.removeAll();
    }
    // Now we have an empty panel

    Component graphComponent;
    chartPanel = new ChartPanel(chart);
    // System.out.println("Chart panel has been set: " + System.identityHashCode(chartPanel));
    if (scrolling) {
        JScrollPane scrollPane = new JScrollPane(chartPanel);
        scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
        scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
        graphComponent = scrollPane;
    } else {
        graphComponent = chartPanel;
    }

    panel.add(graphComponent, constraints);
}

From source file:fungus.MycoNodeFrame.java

public MycoNodeFrame(MycoNode node) {
    this.node = node;
    this.setTitle("Node " + node.getID());

    graph = JungGraphObserver.getGraph();

    Container contentPane = getContentPane();
    contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.PAGE_AXIS));
    JPanel labelPane = new JPanel();
    labelPane.setLayout(new GridLayout(7, 2));
    JPanel neighborPane = new JPanel();
    neighborPane.setLayout(new BoxLayout(neighborPane, BoxLayout.PAGE_AXIS));
    JPanel logPane = new JPanel();
    logPane.setLayout(new BoxLayout(logPane, BoxLayout.PAGE_AXIS));
    JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));

    loggingTextArea = new JTextArea("", 25, 100);
    loggingTextArea.setLineWrap(true);/*from  w  w w . ja  va  2s .c o m*/
    loggingTextArea.setEditable(false);
    handler = new MycoNodeLogHandler(node, loggingTextArea);
    handler.addChangeListener(this);
    JScrollPane logScrollPane = new JScrollPane(loggingTextArea);
    logScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    logPane.add(logScrollPane);

    contentPane.add(labelPane);
    //contentPane.add(Box.createRigidArea(new Dimension(0,5)));
    contentPane.add(neighborPane);
    //contentPane.add(Box.createRigidArea(new Dimension(0,5)));
    contentPane.add(logPane);
    contentPane.add(buttonPane);

    data = node.getHyphaData();
    link = node.getHyphaLink();
    mycocast = node.getMycoCast();

    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

    stateLabel = new JLabel();
    typeLabel = new JLabel();
    queueLengthLabel = new JLabel();
    sameLabel = new JLabel();
    differentLabel = new JLabel();
    maxCapacityLabel = new JLabel();
    idealImmobileLabel = new JLabel();
    idealHyphaeLabel = new JLabel();
    idealBiomassLabel = new JLabel();
    degreeLabel = new JLabel();
    hyphaDegreeLabel = new JLabel();
    biomassDegreeLabel = new JLabel();
    hyphaUtilizationLabel = new JLabel();
    biomassUtilizationLabel = new JLabel();
    capacityUtilizationLabel = new JLabel();

    labelPane.add(new JLabel("state"));
    labelPane.add(stateLabel);
    labelPane.add(new JLabel("type"));
    labelPane.add(typeLabel);
    labelPane.add(new JLabel("queue"));
    labelPane.add(queueLengthLabel);
    labelPane.add(new JLabel(""));
    labelPane.add(new JLabel(""));
    labelPane.add(new JLabel("same"));
    labelPane.add(sameLabel);
    labelPane.add(new JLabel("different"));
    labelPane.add(differentLabel);
    //labelPane.add(new JLabel("immobile"));
    //labelPane.add(idealImmobileLabel);
    labelPane.add(new JLabel(""));
    labelPane.add(new JLabel("actual"));
    labelPane.add(new JLabel("ideal"));
    labelPane.add(new JLabel("utilization"));
    labelPane.add(new JLabel("hyphae"));
    labelPane.add(hyphaDegreeLabel);
    labelPane.add(idealHyphaeLabel);
    labelPane.add(hyphaUtilizationLabel);
    labelPane.add(new JLabel("biomass"));
    labelPane.add(biomassDegreeLabel);
    labelPane.add(idealBiomassLabel);
    labelPane.add(biomassUtilizationLabel);
    labelPane.add(new JLabel("capacity"));
    labelPane.add(degreeLabel);
    labelPane.add(maxCapacityLabel);
    labelPane.add(capacityUtilizationLabel);

    neighborListControl = new JList();
    neighborListControl.setLayoutOrientation(JList.VERTICAL_WRAP);
    neighborListControl.setVisibleRowCount(-1);

    neighborListScroller = new JScrollPane(neighborListControl);
    neighborListScroller.setPreferredSize(new Dimension(250, 150));
    neighborListScroller.setMinimumSize(new Dimension(250, 150));

    neighborPane.add(neighborListScroller);

    JButton updateButton = new JButton("Refresh");
    ActionListener updater = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            refreshData();
        }
    };
    updateButton.addActionListener(updater);

    JButton closeButton = new JButton("Close");
    ActionListener closer = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            closeFrame();
        }
    };
    closeButton.addActionListener(closer);

    buttonPane.add(Box.createHorizontalGlue());
    buttonPane.add(updateButton);
    buttonPane.add(Box.createRigidArea(new Dimension(5, 0)));
    buttonPane.add(closeButton);

    refreshData();

    JungGraphObserver.addChangeListener(this);

    this.pack();
    this.setVisible(true);
}

From source file:my.jabbr.app.ftpclient.ui.install.ProductLicenseInstallationPanel.java

private void initComponents() {
    try {// w ww. j a  va  2s  .co m
        String licenseStr = FileUtils.readFileToString(new File(ConfigManager.GPL_LICENSE_FILE));
        licenseText = new JTextArea(licenseStr);
        licenseText.setColumns(20);
        licenseText.setRows(15);
        licenseText.setBorder(BorderFactory.createLineBorder(UIAccessories.BORDER_GRAY));
        licenseText.setBackground(UIAccessories.WHITE);
        licenseText.setEditable(false);

        JScrollPane scrollPane = new JScrollPane(licenseText);
        scrollPane.setBorder(null);
        scrollPane.setOpaque(false);
        scrollPane.getViewport().setOpaque(false);
        scrollPane.getViewport().setBorder(null);
        scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

        setLayout(new BorderLayout(20, 20));
        add(createTransparentFillerPanel(), BorderLayout.NORTH);
        add(scrollPane, BorderLayout.CENTER);
    } catch (IOException e) {
        e.printStackTrace();
    }

    this.setOpaque(false);
}

From source file:corina.cross.AllScoresView.java

/**
   Create a new view of all of a crossdate's scores.
        /*  www  .  ja  va2 s.c o  m*/
   @param the crossdate to view initially
*/
public AllScoresView(Cross crossdate) {
    this.crossdate = crossdate;

    initTable();

    JScrollPane scroll = new JScrollPane(table);
    scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);

    setLayout(new BorderLayout());
    add(scroll);
}

From source file:TextSamplerDemo.java

public TextSamplerDemo() {
    setLayout(new BorderLayout());

    //Create a regular text field.
    JTextField textField = new JTextField(10);
    textField.setActionCommand(textFieldString);
    textField.addActionListener(this);

    //Create a password field.
    JPasswordField passwordField = new JPasswordField(10);
    passwordField.setActionCommand(passwordFieldString);
    passwordField.addActionListener(this);

    //Create a formatted text field.
    JFormattedTextField ftf = new JFormattedTextField(java.util.Calendar.getInstance().getTime());
    ftf.setActionCommand(textFieldString);
    ftf.addActionListener(this);

    //Create some labels for the fields.
    JLabel textFieldLabel = new JLabel(textFieldString + ": ");
    textFieldLabel.setLabelFor(textField);
    JLabel passwordFieldLabel = new JLabel(passwordFieldString + ": ");
    passwordFieldLabel.setLabelFor(passwordField);
    JLabel ftfLabel = new JLabel(ftfString + ": ");
    ftfLabel.setLabelFor(ftf);/*from w ww. ja  v a2 s.  co  m*/

    //Create a label to put messages during an action event.
    actionLabel = new JLabel("Type text and then Enter in a field.");
    actionLabel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));

    //Lay out the text controls and the labels.
    JPanel textControlsPane = new JPanel();
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();

    textControlsPane.setLayout(gridbag);

    JLabel[] labels = { textFieldLabel, passwordFieldLabel, ftfLabel };
    JTextField[] textFields = { textField, passwordField, ftf };
    addLabelTextRows(labels, textFields, gridbag, textControlsPane);

    c.gridwidth = GridBagConstraints.REMAINDER; //last
    c.anchor = GridBagConstraints.WEST;
    c.weightx = 1.0;
    textControlsPane.add(actionLabel, c);
    textControlsPane.setBorder(BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder("Text Fields"), BorderFactory.createEmptyBorder(5, 5, 5, 5)));

    //Create a text area.
    JTextArea textArea = new JTextArea("This is an editable JTextArea. "
            + "A text area is a \"plain\" text component, " + "which means that although it can display text "
            + "in any font, all of the text is in the same font.");
    textArea.setFont(new Font("Serif", Font.ITALIC, 16));
    textArea.setLineWrap(true);
    textArea.setWrapStyleWord(true);
    JScrollPane areaScrollPane = new JScrollPane(textArea);
    areaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    areaScrollPane.setPreferredSize(new Dimension(250, 250));
    areaScrollPane.setBorder(BorderFactory.createCompoundBorder(
            BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Plain Text"),
                    BorderFactory.createEmptyBorder(5, 5, 5, 5)),
            areaScrollPane.getBorder()));

    //Create an editor pane.
    JEditorPane editorPane = createEditorPane();
    JScrollPane editorScrollPane = new JScrollPane(editorPane);
    editorScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    editorScrollPane.setPreferredSize(new Dimension(250, 145));
    editorScrollPane.setMinimumSize(new Dimension(10, 10));

    //Create a text pane.
    JTextPane textPane = createTextPane();
    JScrollPane paneScrollPane = new JScrollPane(textPane);
    paneScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    paneScrollPane.setPreferredSize(new Dimension(250, 155));
    paneScrollPane.setMinimumSize(new Dimension(10, 10));

    //Put the editor pane and the text pane in a split pane.
    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, editorScrollPane, paneScrollPane);
    splitPane.setOneTouchExpandable(true);
    splitPane.setResizeWeight(0.5);
    JPanel rightPane = new JPanel(new GridLayout(1, 0));
    rightPane.add(splitPane);
    rightPane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Styled Text"),
            BorderFactory.createEmptyBorder(5, 5, 5, 5)));

    //Put everything together.
    JPanel leftPane = new JPanel(new BorderLayout());
    leftPane.add(textControlsPane, BorderLayout.PAGE_START);
    leftPane.add(areaScrollPane, BorderLayout.CENTER);

    add(leftPane, BorderLayout.LINE_START);
    add(rightPane, BorderLayout.LINE_END);
}

From source file:com.k42b3.sacmis.Sacmis.java

public Sacmis(String path, String file, int exitCode, boolean writerStdIn) throws Exception {
    this.path = path;
    this.file = file;
    this.exitCode = exitCode;
    this.writerStdIn = writerStdIn;

    this.setTitle("sacmis (version: " + ver + ")");

    this.setLocation(100, 100);

    this.setSize(600, 500);

    this.setMinimumSize(this.getSize());

    // arguments//www  .ja va  2 s .com
    JPanel panelArgs = new JPanel();

    panelArgs.setLayout(new BorderLayout());

    panelArgs.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

    this.args = new Args();

    this.args.setText(file);

    panelArgs.add(this.args, BorderLayout.CENTER);

    this.add(panelArgs, BorderLayout.NORTH);

    // main panel
    JSplitPane sp = new JSplitPane(JSplitPane.VERTICAL_SPLIT);

    this.in = new In();

    JScrollPane scrIn = new JScrollPane(this.in);

    scrIn.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

    scrIn.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

    scrIn.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);

    sp.add(scrIn);

    this.out = new Out();

    JScrollPane scrOut = new JScrollPane(this.out);

    scrOut.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

    scrOut.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

    scrOut.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);

    sp.add(scrOut);

    this.add(sp, BorderLayout.CENTER);

    // toolbar
    this.toolbar = new Toolbar();

    this.toolbar.getRun().addActionListener(new runHandler());
    this.toolbar.getReset().addActionListener(new resetHandler());
    this.toolbar.getAbout().addActionListener(new aboutHandler());
    this.toolbar.getExit().addActionListener(new exitHandler());

    this.getContentPane().add(this.toolbar, BorderLayout.SOUTH);

    this.setVisible(true);

    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    this.loadFile();
}

From source file:eu.europeana.sip.gui.SipCreatorGUI.java

private JComponent createList() {
    dataSetList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    dataSetList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override//from www.ja va2 s. co m
        public void valueChanged(ListSelectionEvent event) {
            if (event.getValueIsAdjusting())
                return;
            int selected = dataSetList.getSelectedIndex();
            DataSetListModel.Entry selectedEntry = selected >= 0 ? dataSetListModel.getEntry(selected) : null;
            dataSetActions.setEntry(selectedEntry);
        }
    });
    dataSetList.setCellRenderer(new DataSetListModel.Cell());
    dataSetList.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    dataSetList.setBackground(getBackground());
    JScrollPane scroll = new JScrollPane(dataSetList);
    scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    return scroll;
}

From source file:com.ficeto.esp.EspExceptionDecoder.java

private void createAndUpload() {
    if (!PreferencesData.get("target_platform").contentEquals("esp8266")
            && !PreferencesData.get("target_platform").contentEquals("esp32")
            && !PreferencesData.get("target_platform").contentEquals("ESP31B")) {
        System.err.println();/*  ww w.ja v  a 2  s.c o m*/
        editor.statusError("Not Supported on " + PreferencesData.get("target_platform"));
        return;
    }

    String tc = "esp32";
    if (PreferencesData.get("target_platform").contentEquals("esp8266")) {
        tc = "lx106";
    }

    TargetPlatform platform = BaseNoGui.getTargetPlatform();

    String gccPath = PreferencesData.get("runtime.tools.xtensa-" + tc + "-elf-gcc.path");
    if (gccPath == null) {
        gccPath = platform.getFolder() + "/tools/xtensa-" + tc + "-elf";
    }

    String addr2line;
    if (PreferencesData.get("runtime.os").contentEquals("windows"))
        addr2line = "xtensa-" + tc + "-elf-addr2line.exe";
    else
        addr2line = "xtensa-" + tc + "-elf-addr2line";

    tool = new File(gccPath + "/bin", addr2line);
    if (!tool.exists() || !tool.isFile()) {
        System.err.println();
        editor.statusError("ERROR: " + addr2line + " not found!");
        return;
    }

    elf = new File(getBuildFolderPath(editor.getSketch()), editor.getSketch().getName() + ".ino.elf");
    if (!elf.exists() || !elf.isFile()) {
        elf = new File(getBuildFolderPath(editor.getSketch()), editor.getSketch().getName() + ".cpp.elf");
        if (!elf.exists() || !elf.isFile()) {
            //lets give the user a chance to select the elf
            final JFileChooser fc = new JFileChooser();
            fc.addChoosableFileFilter(new ElfFilter());
            fc.setAcceptAllFileFilterUsed(false);
            int returnVal = fc.showDialog(editor, "Select ELF");
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                elf = fc.getSelectedFile();
            } else {
                editor.statusError("ERROR: elf was not found!");
                System.err.println("Open command cancelled by user.");
                return;
            }
        }
    }

    JFrame.setDefaultLookAndFeelDecorated(true);
    frame = new JFrame("Exception Decoder");
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

    inputArea = new JTextArea("Paste your stack trace here", 16, 60);
    inputArea.setLineWrap(true);
    inputArea.setWrapStyleWord(true);
    inputArea.getInputMap().put(KeyStroke.getKeyStroke("ENTER"), "commit");
    inputArea.getActionMap().put("commit", new CommitAction());
    inputArea.getDocument().addDocumentListener(this);
    frame.getContentPane().add(new JScrollPane(inputArea), BorderLayout.PAGE_START);

    outputText = "";
    outputArea = new JTextPane();
    outputArea.setContentType("text/html");
    outputArea.setEditable(false);
    outputArea.setBackground(null);
    outputArea.setBorder(null);
    outputArea.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, true);
    outputArea.setText(outputText);

    JScrollPane outputScrollPane = new JScrollPane(outputArea);
    outputScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    outputScrollPane.setPreferredSize(new Dimension(640, 200));
    outputScrollPane.setMinimumSize(new Dimension(10, 10));
    frame.getContentPane().add(outputScrollPane, BorderLayout.CENTER);

    frame.pack();
    frame.setVisible(true);
}