Example usage for java.awt.event KeyAdapter KeyAdapter

List of usage examples for java.awt.event KeyAdapter KeyAdapter

Introduction

In this page you can find the example usage for java.awt.event KeyAdapter KeyAdapter.

Prototype

KeyAdapter

Source Link

Usage

From source file:de.codesourcery.jasm16.ide.ui.viewcontainers.EditorContainer.java

private JPanel createPanel() {
    final JPanel result = new JPanel();
    result.setLayout(new GridBagLayout());

    GridBagConstraints cnstrs = constraints(0, 0, true, true, GridBagConstraints.BOTH);

    setColors(result);/*from   w ww. j  av  a  2s.  c o m*/
    tabbedPane.setBackground(Color.WHITE);
    tabbedPane.setForeground(Color.black);
    result.add(tabbedPane, cnstrs);

    if (getViewContainer().getMenuManager() != null) {
        getViewContainer().getMenuManager().addEntry(saveCurrent);
    }

    tabbedPane.addChangeListener(changeListener);

    tabbedPane.addKeyListener(new KeyAdapter() {
        public void keyReleased(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_W && (e.getModifiersEx() & KeyEvent.CTRL_DOWN_MASK) != 0) {
                int idx = tabbedPane.getSelectedIndex();
                if (idx != -1) {
                    disposeView(getViewForTabIndex(idx));
                }
            }
        }
    });
    return result;
}

From source file:sturesy.core.ui.loaddialog.SubsettedJListPair.java

private void registerListeners() {
    _ui.getSourceList().addKeyListener(new KeyAdapter() {
        public void keyReleased(KeyEvent keyEvent) {
            subsetSourceListKeyEvent(keyEvent.getKeyCode());
        }/*from   w  w w  .  j a v a 2s .  c  om*/
    });
    _ui.getContentList().addKeyListener(new KeyAdapter() {
        public void keyReleased(KeyEvent keyEvent) {
            subsetContentListKeyEvent(keyEvent.getKeyCode());
        }
    });
    _ui.getSourceList().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent evnt) {
            informSourceListChanged(evnt.getValueIsAdjusting());
        }
    });
}

From source file:de.mprengemann.intellij.plugin.androidicons.forms.MaterialIconsImporter.java

public MaterialIconsImporter(@Nullable final Project project, Module module) {
    super(project, true);
    this.project = project;

    setTitle("Material Icons Importer");
    setResizable(false);/*from  w w  w  . jav  a  2s  . c  o  m*/

    AndroidResourcesHelper.initResourceBrowser(project, module, "Select res root", this.resRoot);
    assetRoot = SettingsHelper.getAssetPath(IconPack.MATERIAL_ICONS);

    getHelpAction().setEnabled(true);

    fillCategories();
    fillAssets();
    fillSizes();
    fillColors();

    categorySpinner.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            fillAssets();
            updateImage();
        }
    });
    AssetSpinnerRenderer renderer = new AssetSpinnerRenderer();
    //noinspection GtkPreferredJComboBoxRenderer
    assetSpinner.setRenderer(renderer);
    assetSpinner.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            fillSizes();
            updateImage();
        }
    });
    sizeSpinner.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            String size = (String) sizeSpinner.getSelectedItem();
            if (size != null) {
                lastSelectedSize = size;
            }
            fillColors();
            updateImage();
        }
    });
    colorSpinner.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            String color = (String) colorSpinner.getSelectedItem();
            if (color != null) {
                lastSelectedColor = color;
            }
            updateImage();
        }
    });

    resExportName.addKeyListener(new KeyAdapter() {
        @Override
        public void keyTyped(KeyEvent keyEvent) {
            super.keyTyped(keyEvent);
            if (!exportNameChanged && keyEvent != null && keyEvent.getKeyCode() > -1) {
                exportNameChanged = true;
            }
        }

        @Override
        public void keyPressed(KeyEvent keyEvent) {
            super.keyPressed(keyEvent);
        }

        @Override
        public void keyReleased(KeyEvent keyEvent) {
            super.keyReleased(keyEvent);
        }
    });
    imageContainer.addComponentListener(new ComponentAdapter() {
        @Override
        public void componentResized(ComponentEvent e) {
            super.componentResized(e);
            updateImage();
        }
    });

    init();
}

From source file:org.jannocessor.ui.RenderPreviewDialog.java

private void initialize() {
    logger.debug("Initializing UI...");
    DefaultSyntaxKit.initKit();/*from w  w  w. j  a va  2  s  .  c om*/

    JEditorPane.registerEditorKitForContentType("text/java_template", "org.jannocessor.syntax.JavaTemplateKit",
            getClass().getClassLoader());

    JEditorPane.registerEditorKitForContentType("text/java_output", "org.jannocessor.syntax.JavaOutputKit",
            getClass().getClassLoader());

    setTitle("JAnnocessor - Java Annotation Processor");
    setLayout(new BorderLayout(5, 5));

    listFiles();

    Toolkit tk = Toolkit.getDefaultToolkit();
    Dimension screenSize = tk.getScreenSize();
    double width = screenSize.getWidth() * 0.9;
    double height = screenSize.getHeight() * 0.8;

    // Font font = new Font("Courier New", Font.PLAIN, 14);

    input = createInput();
    JScrollPane scroll1 = new JScrollPane(input, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    input.setContentType("text/java_template");

    input.setText("");

    scroll1.setMinimumSize(new Dimension(200, 200));
    scroll1.setPreferredSize(new Dimension((int) (width * 0.5), (int) height));
    add(scroll1, BorderLayout.CENTER);

    output = Box.createVerticalBox();

    scroll2 = new JScrollPane(output, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scroll2.setMinimumSize(new Dimension(200, 200));
    scroll2.setPreferredSize(new Dimension((int) (width * 0.5), (int) height));
    add(scroll2, BorderLayout.EAST);

    combo = createCombo();

    combo.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            load((File) combo.getSelectedItem());
        }
    });

    add(combo, BorderLayout.NORTH);
    JLabel help = new JLabel(
            " Choose a template from the drop-down box to edit it. Navigation: Alt + Left & Alt + Right; Refresh = F5, Close = Esc",
            JLabel.CENTER);

    help.setForeground(Color.WHITE);
    help.setBackground(Color.BLACK);
    help.setOpaque(true);
    help.setFont(new Font("Courier New", Font.BOLD, 14));
    add(help, BorderLayout.SOUTH);

    keyListener = new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_F5) {
                e.consume();
                processElements();
                refresh();
            } else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
                e.consume();
                dispose();
            } else if (e.getKeyCode() == KeyEvent.VK_LEFT && e.isAltDown()) {
                e.consume();
                moveBackward();
            } else if (e.getKeyCode() == KeyEvent.VK_RIGHT && e.isAltDown()) {
                e.consume();
                moveForward();
            } else if (e.getKeyCode() == KeyEvent.VK_S && e.isControlDown()) {
                e.consume();
                save();
            } else if (e.getKeyCode() == KeyEvent.VK_I && e.isControlDown()) {
                e.consume();
                increase();
            } else if (e.getKeyCode() == KeyEvent.VK_D && e.isControlDown()) {
                e.consume();
                decrease();
            }
        }
    };

    input.addKeyListener(keyListener);
    combo.addKeyListener(keyListener);

    setActive(0);

    pack();
    setModal(true);
    setLocationRelativeTo(null);
    setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);

    input.requestFocus();
    logger.debug("Initialized UI.");
}

From source file:ru.codemine.pos.ui.salespanel.QuantitySetupWindow.java

public void setupActionListeners() {
    okButton.addActionListener(setQuantityListener);
    cancelButton.addActionListener(new ActionListener() {

        @Override//  w  ww  .  jav a  2s.c  om
        public void actionPerformed(ActionEvent e) {
            mainWindow.unblockBarcodeInput();
            setVisible(false);
        }
    });

    spinner.addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ENTER) {
                okButton.doClick();
            }
        }
    });
    actionListenersInit = true;
}

From source file:dataviewer.DataViewer.java

/**
 * Creates new form DataViewer/* www. j  a v  a  2s .  co  m*/
 */
public DataViewer() {
    try {
        for (Enum ee : THREAD.values()) {
            t[ee.ordinal()] = new Thread();
        }
        initComponents();
        DropTarget dropTarget = new DropTarget(tr_files, new DropTargetListenerImpl());
        TreeSelectionListener treeSelectionListener = new TreeSelectionListener() {

            @Override
            public void valueChanged(TreeSelectionEvent e) {
                javax.swing.JTree tree = (javax.swing.JTree) e.getSource();
                TreePath path = tree.getSelectionPath();
                Object[] pnode = (Object[]) path.getPath();
                String name = pnode[pnode.length - 1].toString();
                String ex = getExtension(name);
                if (ex.equals(".txt") || ex.equals(".dat") || ex.equals(".csv") || ex.equals(".tsv")) {
                    selected_file = name;
                } else {
                    selected_file = "";
                }
            }
        };
        tr_files.addTreeSelectionListener(treeSelectionListener);

        tr_files.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent evt) {
                if (evt.getClickCount() >= 2) {
                    if (!"".equals(selected_file)) {
                        //count_data();
                        read_data();
                    } else {
                        TreePath path = tr_files.getSelectionPath();
                        if (path.getLastPathComponent().toString().equals(cur_path)) {
                            cur_path = (new File(cur_path)).getParent();
                        } else {
                            cur_path = cur_path + File.separator + path.getLastPathComponent().toString();
                        }
                        fill_tree();
                    }
                }
            }
        });

        tr_files.addKeyListener(new KeyAdapter() {
            @Override
            public void keyPressed(KeyEvent evt) {
                if (evt.getKeyCode() == KeyEvent.VK_BACK_SPACE) {
                    cur_path = (new File(cur_path)).getParent();
                    fill_tree();
                } else if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
                    if (!"".equals(selected_file)) {
                        //count_data();
                        read_data();
                    } else {
                        TreePath path = tr_files.getSelectionPath();
                        if (path.getLastPathComponent().toString().equals(cur_path)) {
                            cur_path = (new File(cur_path)).getParent();
                        } else {
                            cur_path = cur_path + File.separator + path.getLastPathComponent().toString();
                        }
                        fill_tree();
                    }
                } else if (evt.getKeyCode() == KeyEvent.VK_DELETE) {

                    if (!"".equals(selected_file)) {
                        String name = cur_path + File.separator + selected_file;
                        if ((new File(name)).isFile()) {
                            int dialogResult = JOptionPane.showConfirmDialog(null,
                                    "Selected file [" + selected_file
                                            + "] will be removed and not recoverable.",
                                    "Are you sure?", JOptionPane.YES_NO_OPTION);
                            if (dialogResult == JOptionPane.YES_OPTION) {
                                (new File(name)).delete();
                                fill_tree();
                            }
                        }

                    } else {
                        JOptionPane.showMessageDialog(null,
                                "For safety concern, removing folder is not supported.", "Information",
                                JOptionPane.ERROR_MESSAGE);
                    }
                }
            }
        });

        tr_files.setCellRenderer(new MyTreeCellRenderer());
        p_count.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);

        //tp_menu.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ctrl1, "tab_read");
        //tp_menu.getActionMap().put("tab_read", (Action) new ActionListenerImpl());
        //tp_menu.setMnemonicAt(0, KeyEvent.VK_1);
        //tp_menu.setMnemonicAt(1, KeyEvent.VK_2);
        /*InputMap inputMap = tp_menu.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
         ActionMap actionMap = tp_menu.getActionMap();
                
         KeyStroke ctrl1 = KeyStroke.getKeyStroke("ctrl 1");
         inputMap.put(ctrl1, "tab_read");
         actionMap.put("tab_read", new AbstractAction() {
                
         @Override
         public void actionPerformed(ActionEvent arg0) {
         tp_menu.setSelectedIndex(0);
         }
         });
                
         KeyStroke ctrl2 = KeyStroke.getKeyStroke("ctrl 2");
         inputMap.put(ctrl2, "tab_analyze");
         actionMap.put("tab_analyze", new AbstractAction() {
                
         @Override
         public void actionPerformed(ActionEvent arg0) {
         tp_menu.setSelectedIndex(1);
         }
         });*/
        config();
    } catch (Exception e) {
        txt_count.setText(e.getMessage());
    }
}

From source file:net.sf.taverna.t2.workbench.ui.servicepanel.actions.AddServiceProviderAction.java

@Override
public void actionPerformed(ActionEvent e) {
    if (confProvider instanceof CustomizedConfigurePanelProvider) {
        final CustomizedConfigurePanelProvider provider = (CustomizedConfigurePanelProvider) confProvider;
        provider.createCustomizedConfigurePanel(new CustomizedConfigureCallBack() {
            @Override/*from w  w  w . jav  a  2  s  . co  m*/
            public Configuration getTemplateConfig() {
                return (Configuration) provider.getConfiguration().clone();
            }

            @Override
            public ServiceDescriptionRegistry getServiceDescriptionRegistry() {
                return AddServiceProviderAction.this.getServiceDescriptionRegistry();
            }

            @Override
            public void newProviderConfiguration(Configuration providerConfig) {
                addNewProvider(providerConfig);
            }
        });
        return;
    }

    Configuration configuration;
    try {
        configuration = (Configuration) confProvider.getConfiguration().clone();
    } catch (Exception ex) {
        throw new RuntimeException("Can't clone configuration bean", ex);
    }
    JPanel buildEditor = buildEditor(configuration);
    String title = "Add " + confProvider.getName();
    JDialog dialog = new HelpEnabledDialog(getMainWindow(), title, true, null);
    JPanel iconPanel = new JPanel();
    iconPanel.add(new JLabel(confProvider.getIcon()), NORTH);
    dialog.add(iconPanel, WEST);
    dialog.add(buildEditor, CENTER);
    JPanel buttonPanel = new JPanel(new BorderLayout());
    final AddProviderAction addProviderAction = new AddProviderAction(configuration, dialog);
    JButton addProviderButton = new JButton(addProviderAction);
    buttonPanel.add(addProviderButton, WEST);

    dialog.add(buttonPanel, SOUTH);
    // When user presses "Return" key fire the action on the "Add" button
    addProviderButton.addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent evt) {
            if (evt.getKeyCode() == VK_ENTER)
                addProviderAction.actionPerformed(null);
        }
    });
    dialog.getRootPane().setDefaultButton(addProviderButton);

    // dialog.setSize(buttonPanel.getPreferredSize());
    dialog.pack();
    dialog.setLocationRelativeTo(owner);
    //      dialog.setLocation(owner.getLocationOnScreen().x + owner.getWidth(),
    //            owner.getLocationOnScreen().y + owner.getHeight());
    dialog.setVisible(true);
}

From source file:org.openconcerto.erp.core.common.ui.DeviseField.java

@Override
public void init(String sqlName, Set<SQLField> fields) {
    this.field = CollectionUtils.getSole(fields);
    this.sqlName = sqlName;
    this.helper = new EmptyObjectHelper(this, new Predicate() {
        public boolean evaluate(Object object) {
            return object == null;

            // final String val = GestionDevise.currencyToString(((Long)
            // object).longValue());
        }/*  w  w w.  j  ava 2s  . co m*/
    });

    // TODO use JFormattedTextField => conflit getValue()
    // DefaultFormatterFactory NumberFormatter (getAllowsInvalid) NumberFormat

    addFilteringKeyListener(this);

    // select all on focus gained
    // except if the user is selecting with the mouse
    this.addFocusListener(new FocusAdapter() {
        public void focusGained(FocusEvent e) {
            DeviseField.this.gained = true;
            DeviseField.this.initialText = getText();
            if (!DeviseField.this.mousePressed) {
                selectAll();
            }
        }
    });
    this.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent e) {
            DeviseField.this.mousePressed = true;
        }

        public void mouseReleased(MouseEvent e) {
            // don't override the user selection
            if (DeviseField.this.gained && getSelectedText() == null) {
                selectAll();
            }
            // don't select all for each mouse released
            DeviseField.this.gained = false;
            DeviseField.this.mousePressed = false;
        }
    });
    this.addKeyListener(new KeyAdapter() {
        public void keyTyped(KeyEvent keyEvent) {
            // Sert a annuler une saisie
            if (keyEvent.getKeyChar() == KeyEvent.VK_ESCAPE) {
                DeviseField.this.setValue(DeviseField.this.initialText);
                selectAll();
            }
        }
    });
}

From source file:zxmax.tools.timerreview.gui.StartTimerWindow.java

private Component getPnlNewTimer() {
    setTitle(I18N.getLabel(getClass(), "window.title"));
    JPanel pnlNewTimer = new JPanel();
    LayoutManager layout = new MigLayout("flowy", "[328.00][grow,fill]", "[][][][][]");
    taFocusOn = new JTextArea();
    taFocusOn.setWrapStyleWord(true);//  w  w w.  j a va  2s .c  om
    JScrollPane spFocusOn = new JScrollPane();
    tfTitle = new JTextField(30);
    JButton btnStart = new JButton();

    pnlNewTimer.setLayout(layout);
    btnStart.setText(I18N.getLabel(this.getClass(), TAB_NEW_TIMER_BTN_START_LABEL));
    taFocusOn.setColumns(20);
    taFocusOn.setForeground(new Color(0, 153, 0));
    taFocusOn.setRows(5);
    taFocusOn.setTabSize(2);
    taFocusOn.setText(I18N.getLabel(this.getClass(), TAB_NEW_TIMER_FOCUS_ON_TEXT_AREA_TEXT));
    taFocusOn.setToolTipText(I18N.getLabel(this.getClass(), TAB_NEW_TIMER_FOCUS_ON_TEXT_AREA_TOOL_TIP));
    spFocusOn.setViewportView(taFocusOn);
    taFocusOn.getAccessibleContext().setAccessibleName("taFocusOn");

    btnStart.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent evt) {
            storeDataAndStartTimer();
        }
    });
    btnStart.addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent evt) {
            logger.debug(evt.getKeyCode() + ", " + evt.getKeyChar());
            if (KeyEvent.VK_ENTER == evt.getKeyCode()) {
                storeDataAndStartTimer();
            }
        }
    });

    JLabel lblTitle = new JLabel(I18N.getLabel(this.getClass(), TAB_NEW_TIMER_TITLE_LABEL));

    pnlNewTimer.add(lblTitle, "cell 0 0");
    pnlNewTimer.add(tfTitle, "cell 0 1 2 1,growx");
    JLabel lblFocusOn = new JLabel(I18N.getLabel(this.getClass(), TAB_NEW_TIMER_FOCUS_ON_LABEL));
    pnlNewTimer.add(lblFocusOn, "cell 0 2");
    pnlNewTimer.add(spFocusOn, "cell 0 3 2 1,growx");
    pnlNewTimer.add(btnStart, "cell 0 4 2 1,growx");

    Box horizontalBox = Box.createHorizontalBox();
    pnlNewTimer.add(horizontalBox, "flowx,cell 1 0");

    JLabel lblDurata = new JLabel(I18N.getLabel(this.getClass(), TAB_NEW_TIMER_DURATA_LABEL));
    lblDurata.setHorizontalAlignment(SwingConstants.RIGHT);
    pnlNewTimer.add(lblDurata, "cell 1 0,alignx right");
    lblDurata.setLabelFor(txtDurata);

    txtDurata = new JTextField("20");
    txtDurata.setToolTipText(I18N.getLabel(this.getClass(), TAB_NEW_TIMER_DURATA_TOOL_TIP));
    pnlNewTimer.add(txtDurata, "cell 1 0,alignx center");
    txtDurata.setColumns(2);

    return pnlNewTimer;
}

From source file:se.nawroth.asciidoc.browser.AsciidocBrowserApplication.java

public AsciidocBrowserApplication(final String[] args) {
    super("Asciidoc Browser");
    setIconImage(Icons.APPLICATION.image());

    setSize(1200, 1024);//from   ww  w  . j  ava  2s . c  o m

    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(final WindowEvent e) {
            actionExit();
        }
    });

    JPanel buttonPanel = new JPanel();
    backButton = new JButton("");
    backButton.setIcon(Icons.BACK.icon());
    backButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            actionBack();
        }
    });
    buttonPanel.setLayout(new MigLayout("", "[1px][][][][]", "[1px]"));

    JButton btnOptionsbutton = new JButton("");
    btnOptionsbutton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            settingsDialog.setVisible(true);
        }
    });
    btnOptionsbutton.setIcon(Icons.OPTIONS.icon());
    buttonPanel.add(btnOptionsbutton, "flowx,cell 0 0");
    backButton.setEnabled(false);
    buttonPanel.add(backButton, "cell 0 0,grow");
    forwardButton = new JButton("");
    forwardButton.setIcon(Icons.FORWARD.icon());
    forwardButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            actionForward();
        }
    });
    forwardButton.setEnabled(false);
    buttonPanel.add(forwardButton, "cell 0 0,grow");
    getContentPane().setLayout(new MigLayout("", "[793.00px,grow]", "[44px][930px]"));
    getContentPane().add(buttonPanel, "cell 0 0,growx,aligny top");
    locationTextField = new JTextField(65);
    locationTextField.setText("");
    locationTextField.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(final KeyEvent e) {
            int keyCode = e.getKeyCode();
            if (keyCode == KeyEvent.VK_ENTER || keyCode == KeyEvent.VK_TAB) {
                actionGo();
                refreshDocumentTree();
            }
        }
    });
    locationTextField.setTransferHandler(
            new TextFieldTransferHandler(locationTextField.getTransferHandler(), new Runnable() {
                @Override
                public void run() {
                    locationTextField.setText("");
                }
            }, new Runnable() {

                @Override
                public void run() {
                    actionGo();
                    refreshDocumentTree();
                }
            }));

    homebutton = new JButton("");
    homebutton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            locationTextField.setText(Settings.getHome());
            actionGo();
            refreshDocumentTree();
        }
    });

    refreshButton = new JButton("");
    refreshButton.setToolTipText("Refresh");
    refreshButton.setEnabled(false);
    refreshButton.setIcon(Icons.REFRESH.icon());
    refreshButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            actionGo();
            refreshPreview();
        }
    });
    buttonPanel.add(refreshButton, "cell 1 0");

    homebutton.setIcon(Icons.HOME.icon());
    buttonPanel.add(homebutton, "cell 2 0");
    buttonPanel.add(locationTextField, "cell 3 0,grow");

    treeSourceSplitPane = new JSplitPane();
    treeSourceSplitPane.setResizeWeight(0.3);
    getContentPane().add(treeSourceSplitPane, "cell 0 1,grow");

    treeScrollPane = new JScrollPane();
    treeScrollPane.setMinimumSize(new Dimension(200, 200));
    treeSourceSplitPane.setLeftComponent(treeScrollPane);

    documentTree = new DocumentTree(documentModel);
    documentTree.setCellRenderer(new TooltipsTreeCellRenderer());
    ToolTipManager.sharedInstance().registerComponent(documentTree);
    ToolTipManager.sharedInstance().setInitialDelay(INITIAL_TOOLTIP_DELAY);
    ToolTipManager.sharedInstance().setReshowDelay(0);
    documentTree.addTreeSelectionListener(new TreeSelectionListener() {
        @Override
        public void valueChanged(final TreeSelectionEvent tse) {
            TreePath newLeadSelectionPath = tse.getNewLeadSelectionPath();
            if (newLeadSelectionPath != null && !newLeadSelectionPath.equals(currentSelectionPath)) {
                DefaultMutableTreeNode node = (DefaultMutableTreeNode) newLeadSelectionPath
                        .getLastPathComponent();
                FileWrapper file = (FileWrapper) node.getUserObject();
                showFile(file, true);
                refreshPreview();
            }
        }
    });
    treeScrollPane.setViewportView(documentTree);

    sourceEditorPane = new JEditorPane();
    sourceEditorPane.setContentType("text/html");
    sourceEditorPane.setEditable(false);
    sourceEditorPane.addHyperlinkListener(new HandleHyperlinkUpdate());
    JScrollPane fileScrollPane = new JScrollPane(sourceEditorPane);
    fileScrollPane.setMinimumSize(new Dimension(600, 600));

    documentTabbedPane = new JTabbedPane(SwingConstants.BOTTOM);
    documentTabbedPane.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(final ChangeEvent ce) {
            refreshPreview();
        }
    });
    sourceLogSplitPane = new JSplitPane();
    sourceLogSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    treeSourceSplitPane.setRightComponent(sourceLogSplitPane);
    sourceLogSplitPane.setTopComponent(documentTabbedPane);
    documentTabbedPane.add(fileScrollPane);
    documentTabbedPane.setTitleAt(0, "Source");

    browserPane = new BrowserPane();

    previewScrollPane = new JScrollPane(browserPane);
    documentTabbedPane.addTab("Preview", null, previewScrollPane, null);

    console = new JConsole();
    System.setErr(console.getErr());
    System.setOut(console.getOut());
    sourceLogSplitPane.setBottomComponent(console);

    executor = new AsciidocExecutor();
}