Example usage for javax.swing JTextPane setEditable

List of usage examples for javax.swing JTextPane setEditable

Introduction

In this page you can find the example usage for javax.swing JTextPane setEditable.

Prototype

@BeanProperty(description = "specifies if the text can be edited")
public void setEditable(boolean b) 

Source Link

Document

Sets the specified boolean to indicate whether or not this TextComponent should be editable.

Usage

From source file:org.languagetool.gui.ResultArea.java

ResultArea(final ResourceBundle messages, final LanguageToolSupport ltSupport, final JTextPane statusPane) {
    this.messages = messages;
    this.ltSupport = ltSupport;
    this.statusPane = statusPane;
    statusPane.setContentType("text/html");
    statusPane.setText(Main.HTML_GREY_FONT_START + messages.getString("resultAreaText") + Main.HTML_FONT_END);
    statusPane.setEditable(false);
    statusPane.addHyperlinkListener(new MyHyperlinkListener());
    statusPane.setTransferHandler(new RetainLineBreakTransferHandler());
    ltSupport.addLanguageToolListener(new LanguageToolListener() {
        @Override//from  w w  w .  j a v  a2 s  . com
        public void languageToolEventOccurred(LanguageToolEvent event) {
            if (event.getType() == LanguageToolEvent.Type.CHECKING_STARTED) {
                final Language lang = ltSupport.getLanguage();
                final String langName;
                if (lang.isExternal()) {
                    langName = lang.getTranslatedName(messages) + Main.EXTERNAL_LANGUAGE_SUFFIX;
                } else {
                    langName = lang.getTranslatedName(messages);
                }
                final String startCheckText = Main.HTML_GREY_FONT_START
                        + Tools.makeTexti18n(messages, "startChecking", langName) + "..." + Main.HTML_FONT_END;
                statusPane.setText(startCheckText);
                setStartText(startCheckText);
                if (event.getCaller() == marker) {
                    statusPane.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                }
            } else if (event.getType() == LanguageToolEvent.Type.CHECKING_FINISHED) {
                inputText = event.getSource().getTextComponent().getText();
                setRuleMatches(event.getSource().getMatches());
                if (event.getCaller() == marker || event.getCaller() == null) {
                    displayResult();
                    if (event.getCaller() == marker) {
                        statusPane.setCursor(Cursor.getDefaultCursor());
                    }
                }
            } else if (event.getType() == LanguageToolEvent.Type.RULE_DISABLED
                    || event.getType() == LanguageToolEvent.Type.RULE_ENABLED) {
                inputText = event.getSource().getTextComponent().getText();
                setRuleMatches(event.getSource().getMatches());
                displayResult();
            }
        }
    });
}

From source file:org.languagetool.gui.ResultAreaHelper.java

private ResultAreaHelper(ResourceBundle messages, LanguageToolSupport ltSupport, JTextPane statusPane) {
    this.messages = messages;
    this.ltSupport = ltSupport;
    this.statusPane = statusPane;
    statusPane.setContentType("text/html");
    statusPane.setEditable(false);
    statusPane.setTransferHandler(new RetainLineBreakTransferHandler());
    enable();/*from w ww. j  a  v  a  2s  . c o  m*/
}

From source file:org.languagetool.gui.Tools.java

static void showRuleInfoDialog(Component parent, String title, String message, Rule rule, URL matchUrl,
        ResourceBundle messages, String lang) {
    int dialogWidth = 320;
    JTextPane textPane = new JTextPane();
    textPane.setEditable(false);
    textPane.setContentType("text/html");
    textPane.setBorder(BorderFactory.createEmptyBorder());
    textPane.setOpaque(false);//w  ww  . ja  v  a 2s.c  o  m
    textPane.setBackground(new Color(0, 0, 0, 0));
    Tools.addHyperlinkListener(textPane);
    textPane.setSize(dialogWidth, Short.MAX_VALUE);
    String messageWithBold = message.replaceAll("<suggestion>", "<b>").replaceAll("</suggestion>", "</b>");
    String exampleSentences = getExampleSentences(rule, messages);
    String url = "http://community.languagetool.org/rule/show/" + encodeUrl(rule) + "?lang=" + lang
            + "&amp;ref=standalone-gui";
    boolean isExternal = rule.getCategory().getLocation() == Category.Location.EXTERNAL;
    String ruleDetailLink = rule instanceof FalseFriendPatternRule || isExternal ? ""
            : "<a href='" + url + "'>" + messages.getString("ruleDetailsLink") + "</a>";
    textPane.setText("<html>" + messageWithBold + exampleSentences + formatURL(matchUrl) + "<br><br>"
            + ruleDetailLink + "</html>");
    JScrollPane scrollPane = new JScrollPane(textPane);
    scrollPane.setPreferredSize(new Dimension(dialogWidth, textPane.getPreferredSize().height));
    scrollPane.setBorder(BorderFactory.createEmptyBorder());

    String cleanTitle = title.replace("<suggestion>", "'").replace("</suggestion>", "'");
    JOptionPane.showMessageDialog(parent, scrollPane, cleanTitle, JOptionPane.INFORMATION_MESSAGE);
}

From source file:org.nebulaframework.ui.swing.node.NodeMainUI.java

/**
 * Setup General (Control Center) Tab/*  w  w  w.j  a va  2  s . co m*/
 * 
 * @return JPanel for Control Center
 */
private JPanel setupGeneral() {

    JPanel generalPanel = new JPanel();
    generalPanel.setLayout(new BorderLayout());

    /* -- Stats Panel -- */
    JPanel statsPanel = new JPanel();
    generalPanel.add(statsPanel, BorderLayout.NORTH);

    statsPanel.setLayout(new GridLayout(0, 2, 10, 10));

    JPanel eastPanel = new JPanel();
    statsPanel.add(eastPanel, BorderLayout.EAST);
    eastPanel.setLayout(new BorderLayout());

    JPanel westPanel = new JPanel();
    statsPanel.add(westPanel, BorderLayout.WEST);
    westPanel.setLayout(new BorderLayout());

    // Grid Information Panel
    JPanel gridInfoPanel = new JPanel();
    eastPanel.add(gridInfoPanel, BorderLayout.NORTH);

    gridInfoPanel.setBorder(BorderFactory.createTitledBorder("Grid Information"));
    gridInfoPanel.setLayout(new GridLayout(0, 2, 10, 10));

    JLabel nodeIdLabel = new JLabel("Node ID :");
    gridInfoPanel.add(nodeIdLabel);
    JLabel nodeId = new JLabel("#nodeid#");
    gridInfoPanel.add(nodeId);
    addUIElement("general.stats.nodeid", nodeId); // Add to components map

    JLabel nodeIpLabel = new JLabel("Node IP :");
    gridInfoPanel.add(nodeIpLabel);
    JLabel nodeIp = new JLabel("#nodeip#");
    gridInfoPanel.add(nodeIp);
    addUIElement("general.stats.nodeip", nodeIp); // Add to components map

    JLabel clusterIdLabel = new JLabel("Cluster ID :");
    gridInfoPanel.add(clusterIdLabel);
    JLabel clusterId = new JLabel("#clusterid#");
    gridInfoPanel.add(clusterId);
    addUIElement("general.stats.clusterid", clusterId); // Add to components map

    JLabel clusterServiceLabel = new JLabel("Cluster Service :");
    gridInfoPanel.add(clusterServiceLabel);
    JLabel clusterService = new JLabel("#clusterservice#");
    gridInfoPanel.add(clusterService);
    addUIElement("general.stats.clusterservice", clusterService); // Add to components map

    // Node Status Panel 
    JPanel nodeStatusPanel = new JPanel();
    eastPanel.add(nodeStatusPanel, BorderLayout.SOUTH);

    nodeStatusPanel.setBorder(BorderFactory.createTitledBorder("GridNode Status"));
    nodeStatusPanel.setLayout(new GridLayout(0, 2, 10, 10));

    JLabel statusLabel = new JLabel("Status :");
    nodeStatusPanel.add(statusLabel);
    JLabel status = new JLabel("#status#");
    nodeStatusPanel.add(status);
    addUIElement("general.stats.status", status); // Add to components map

    JLabel uptimeLabel = new JLabel("Node Up Time :");
    nodeStatusPanel.add(uptimeLabel);
    JLabel uptime = new JLabel("#uptime#");
    nodeStatusPanel.add(uptime);
    addUIElement("general.stats.uptime", uptime); // Add to components map

    JLabel execTimeLabel = new JLabel("Execution Time :");
    nodeStatusPanel.add(execTimeLabel);
    JLabel execTime = new JLabel("#exectime#");
    nodeStatusPanel.add(execTime);
    addUIElement("general.stats.exectime", execTime); // Add to components map

    // Execution Statistics Panel
    JPanel execStatsPanel = new JPanel();
    westPanel.add(execStatsPanel, BorderLayout.NORTH);

    execStatsPanel.setLayout(new GridLayout(0, 2, 10, 10));
    execStatsPanel.setBorder(BorderFactory.createTitledBorder("Execution Statistics"));

    JLabel totalJobsLabel = new JLabel("Total Jobs :");
    execStatsPanel.add(totalJobsLabel);
    JLabel totalJobs = new JLabel("0");
    execStatsPanel.add(totalJobs);
    addUIElement("general.stats.totaljobs", totalJobs); // Add to components map

    JLabel totalTasksLabel = new JLabel("Total Tasks :");
    execStatsPanel.add(totalTasksLabel);
    JLabel totalTasks = new JLabel("0");
    execStatsPanel.add(totalTasks);
    addUIElement("general.stats.totaltasks", totalTasks); // Add to components map

    JLabel totalBansLabel = new JLabel("Banments :");
    execStatsPanel.add(totalBansLabel);
    JLabel totalBans = new JLabel("0");
    execStatsPanel.add(totalBans);
    addUIElement("general.stats.totalbans", totalBans); // Add to components map

    // Execution Active Job Panel
    JPanel activeJobPanel = new JPanel();
    westPanel.add(activeJobPanel, BorderLayout.SOUTH);

    activeJobPanel.setLayout(new GridLayout(0, 2, 10, 10));
    activeJobPanel.setBorder(BorderFactory.createTitledBorder("Active Job"));

    JLabel jobNameLabel = new JLabel("GridJob Name :");
    activeJobPanel.add(jobNameLabel);
    JLabel jobName = new JLabel("#jobname#");
    activeJobPanel.add(jobName);
    addUIElement("general.stats.jobname", jobName); // Add to components map

    JLabel durationLabel = new JLabel("Duration :");
    activeJobPanel.add(durationLabel);
    JLabel duration = new JLabel("#duration#");
    activeJobPanel.add(duration);
    addUIElement("general.stats.duration", duration); // Add to components map

    JLabel tasksLabel = new JLabel("Tasks Executed :");
    activeJobPanel.add(tasksLabel);
    JLabel tasks = new JLabel("#xyz#");
    activeJobPanel.add(tasks);
    addUIElement("general.stats.tasks", tasks); // Add to components map

    JLabel failuresLabel = new JLabel("Failures :");
    activeJobPanel.add(failuresLabel);
    JLabel failures = new JLabel("#failures#");
    activeJobPanel.add(failures);
    addUIElement("general.stats.failures", failures); // Add to components map

    /* -- Log Panel -- */
    JPanel logPanel = new JPanel();
    generalPanel.add(logPanel, BorderLayout.CENTER);

    logPanel.setLayout(new BorderLayout());
    logPanel.setBorder(BorderFactory.createTitledBorder("Log Output"));
    JTextPane logTextPane = new JTextPane();
    logTextPane.setEditable(false);
    logTextPane.setBackground(Color.BLACK);
    logTextPane.setForeground(Color.WHITE);

    logPanel.add(new JScrollPane(logTextPane, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER);
    addUIElement("general.log", logTextPane); // Add to component map

    JPanel logOptionsPanel = new JPanel();
    logPanel.add(logOptionsPanel, BorderLayout.SOUTH);
    logOptionsPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));

    final JCheckBox logScrollCheckbox = new JCheckBox("Auto-Scroll Log");
    logScrollCheckbox.setSelected(true);
    logScrollCheckbox.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            JTextPaneAppender.setAutoScroll(logScrollCheckbox.isSelected());
        }

    });
    logOptionsPanel.add(logScrollCheckbox);

    // Enable Logging
    JTextPaneAppender.setTextPane(logTextPane);

    /* -- Buttons Panel -- */
    JPanel buttonsPanel = new JPanel();
    generalPanel.add(buttonsPanel, BorderLayout.SOUTH);

    buttonsPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));

    // Shutdown Button
    JButton shutdownButton = new JButton("Shutdown");
    buttonsPanel.add(shutdownButton);
    shutdownButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            doShutdownNode();
        }

    });

    // Start Up time Thread
    Thread t = new Thread(new Runnable() {
        public void run() {

            long start = System.currentTimeMillis();

            while (true) {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    log.warn("Interrupted Exception in Up Time Thread", e);
                }

                final String uptime = TimeUtils.timeDifference(start);

                SwingUtilities.invokeLater(new Runnable() {

                    public void run() {
                        JLabel upTime = getUIElement("general.stats.uptime");
                        upTime.setText(uptime);
                    }

                });
            }

        }
    });
    t.setDaemon(true);
    t.start();

    // Auto-Discovery Thread
    Thread autoDiscovery = new Thread(new Runnable() {
        public void run() {

            while (true) {
                try {

                    // Attempt every 30 seconds
                    Thread.sleep(30000);

                } catch (InterruptedException e) {
                    log.warn("Interrupted Exception in Up Time Thread", e);
                }

                if (autodiscover && (!Grid.isNode())) {
                    // 30 Second Intervals
                    doDiscover(true);
                }

            }
        }
    });
    autoDiscovery.setDaemon(true);
    autoDiscovery.start();

    return generalPanel;
}

From source file:org.openmicroscopy.shoola.util.ui.UIUtilities.java

/**
 * Formats the text and displays it in a {@link JTextPane}.
 * //from   www . j a  va  2  s  .c o m
 * @param text          The text to display.
 * @param foreground   The foreground color.
 * @return See above.
 */
public static JTextPane buildTextPane(String text, Color foreground) {
    if (text == null)
        text = "";
    StyleContext context = new StyleContext();
    StyledDocument document = new DefaultStyledDocument(context);

    Style style = context.getStyle(StyleContext.DEFAULT_STYLE);
    StyleConstants.setAlignment(style, StyleConstants.ALIGN_LEFT);
    if (foreground != null)
        StyleConstants.setForeground(style, foreground);
    try {
        document.insertString(document.getLength(), text, style);
    } catch (BadLocationException e) {
    }

    JTextPane textPane = new JTextPane(document);
    textPane.setOpaque(false);
    textPane.setEditable(false);
    textPane.setFocusable(false);
    return textPane;
}

From source file:org.openmicroscopy.shoola.util.ui.UIUtilities.java

/** Builds the UI component displaying the exception.*/
public static JTextPane buildExceptionArea() {
    StyleContext context = new StyleContext();
    StyledDocument document = new DefaultStyledDocument(context);

    JTextPane textPane = new JTextPane(document);
    textPane.setOpaque(false);//from www . j  av a 2s.c  om
    textPane.setEditable(false);

    // Create one of each type of tab stop
    List<TabStop> list = new ArrayList<TabStop>();

    // Create a left-aligned tab stop at 100 pixels from the left margin
    float pos = 15;
    int align = TabStop.ALIGN_LEFT;
    int leader = TabStop.LEAD_NONE;
    TabStop tstop = new TabStop(pos, align, leader);
    list.add(tstop);

    // Create a right-aligned tab stop at 200 pixels from the left margin
    pos = 15;
    align = TabStop.ALIGN_RIGHT;
    leader = TabStop.LEAD_NONE;
    tstop = new TabStop(pos, align, leader);
    list.add(tstop);

    // Create a center-aligned tab stop at 300 pixels from the left margin
    pos = 15;
    align = TabStop.ALIGN_CENTER;
    leader = TabStop.LEAD_NONE;
    tstop = new TabStop(pos, align, leader);
    list.add(tstop);

    // Create a decimal-aligned tab stop at 400 pixels from the left margin
    pos = 15;
    align = TabStop.ALIGN_DECIMAL;
    leader = TabStop.LEAD_NONE;
    tstop = new TabStop(pos, align, leader);
    list.add(tstop);

    // Create a tab set from the tab stops
    TabSet tabs = new TabSet(list.toArray(new TabStop[0]));

    // Add the tab set to the logical style;
    // the logical style is inherited by all paragraphs
    Style style = textPane.getLogicalStyle();
    StyleConstants.setTabSet(style, tabs);
    textPane.setLogicalStyle(style);
    Style debugStyle = document.addStyle("StyleName", null);
    StyleConstants.setForeground(debugStyle, Color.BLACK);
    StyleConstants.setFontFamily(debugStyle, "SansSerif");
    StyleConstants.setFontSize(debugStyle, 12);
    StyleConstants.setBold(debugStyle, false);
    return textPane;
}

From source file:org.optaplanner.benchmark.impl.aggregator.swingui.BenchmarkAggregatorFrame.java

private JComponent createNoPlannerFoundTextField() {
    String infoMessage = "No planner benchmarks have been found in the benchmarkDirectory ("
            + benchmarkAggregator.getBenchmarkDirectory() + ").";
    JTextPane textPane = new JTextPane();

    textPane.setEditable(false);
    textPane.setText(infoMessage);//from w ww  .j av  a  2 s  .com

    // center info message
    StyledDocument styledDocument = textPane.getStyledDocument();
    SimpleAttributeSet center = new SimpleAttributeSet();
    StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
    StyleConstants.setBold(center, true);
    styledDocument.setParagraphAttributes(0, styledDocument.getLength(), center, false);
    return textPane;
}

From source file:org.owasp.jbrofuzz.fuzz.ui.FuzzingPanel.java

private JTextPane createEditablePane() {

    JTextPane textPane = new JTextPane();

    // Get the preferences for wrapping lines of text
    final boolean wrapText = JBroFuzz.PREFS.getBoolean(JBroFuzzPrefs.FUZZING[2].getId(), false);

    if (wrapText) {
        textPane = new JTextPane();
    } else {/*from  ww  w  .  java 2  s .  c o  m*/
        textPane = new NonWrappingTextPane();
    }

    textPane.putClientProperty("charset", "UTF-8");
    textPane.setEditable(true);
    textPane.setVisible(true);
    textPane.setFont(new Font("Verdana", Font.PLAIN, 12));
    textPane.setMargin(new Insets(1, 1, 1, 1));
    textPane.setBackground(Color.WHITE);
    textPane.setForeground(Color.BLACK);

    // Set the editor kit responsible for highlighting
    textPane.setEditorKit(new StyledEditorKit() {

        private static final long serialVersionUID = -6085642347022880064L;

        public Document createDefaultDocument() {
            return new TextHighlighter();
        }

    });

    // Right click: Cut, Copy, Paste, Select All
    RightClickPopups.rightClickRequestTextComponent(this, textPane);

    return textPane;
}

From source file:org.processmining.analysis.performance.fsmevaluator.FSMEvaluationAnalysisUI.java

public JScrollPane getStringBuffer() {
    JTextPane myTextPane = new JTextPane();
    myTextPane.setContentType("text/html");
    myTextPane.setText(sb.toString());/*  w w  w  . ja  v  a  2  s  .  co  m*/
    myTextPane.setEditable(false);
    myTextPane.setCaretPosition(0);

    JScrollPane scrollPane = new JScrollPane(myTextPane);
    scrollPane.setBackground(colorBg);
    return scrollPane;
}

From source file:org.tinymediamanager.ui.movies.settings.MovieRenamerSettingsPanel.java

public MovieRenamerSettingsPanel() {
    setLayout(new FormLayout(
            new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("250dlu:grow"),
                    FormSpecs.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("fill:default"),
                    FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("fill:default:grow"),
                    FormSpecs.RELATED_GAP_ROWSPEC, }));
    // the panel renamer
    JPanel panelRenamer = new JPanel();
    panelRenamer.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.movie.renamer.title"), //$NON-NLS-1$
            TitledBorder.LEADING, TitledBorder.TOP, null, null));
    add(panelRenamer, "2, 2, fill, fill");
    panelRenamer.setLayout(new FormLayout(
            new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC,
                    FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("75dlu:grow"),
                    FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.UNRELATED_GAP_COLSPEC,
                    FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.UNRELATED_GAP_COLSPEC,
                    ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC,
                    ColumnSpec.decode("default:grow(3)"), FormSpecs.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC,
                    FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC,
                    FormSpecs.RELATED_GAP_ROWSPEC, }));

    chckbxSpaceSubstitution = new JCheckBox(BUNDLE.getString("Settings.movie.renamer.spacesubstitution")); //$NON-NLS-1$
    chckbxSpaceSubstitution.addActionListener(actionCreateRenamerExample);

    tfMoviePath = new JTextField();
    tfMoviePath.getDocument().addDocumentListener(new DocumentListener() {
        @Override//w w w  . j  ava 2 s.  co m
        public void removeUpdate(DocumentEvent arg0) {
            createRenamerExample();
        }

        @Override
        public void insertUpdate(DocumentEvent arg0) {
            createRenamerExample();
        }

        @Override
        public void changedUpdate(DocumentEvent arg0) {
            createRenamerExample();
        }
    });

    JLabel lblMoviePath = new JLabel(BUNDLE.getString("Settings.renamer.folder")); //$NON-NLS-1$
    panelRenamer.add(lblMoviePath, "2, 4, right, default");
    panelRenamer.add(tfMoviePath, "4, 4, fill, default");
    tfMoviePath.setColumns(10);
    panelRenamer.add(chckbxSpaceSubstitution, "8, 4");

    cbSeparator = new JComboBox(separators.toArray());
    panelRenamer.add(cbSeparator, "10, 4, fill, default");
    cbSeparator.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            checkChanges();
            createRenamerExample();
        }
    });

    lblDefault1T = new JLabel(BUNDLE.getString("Settings.default"));
    TmmFontHelper.changeFont(lblDefault1T, 0.833);
    panelRenamer.add(lblDefault1T, "2, 6, right, top");

    lblDefaultFolderPattern = new JLabel(MovieSettings.DEFAULT_RENAMER_FOLDER_PATTERN);
    TmmFontHelper.changeFont(lblDefaultFolderPattern, 0.833);
    panelRenamer.add(lblDefaultFolderPattern, "4, 6, default, top");

    chckbxMoviesetSingleMovie = new JCheckBox(BUNDLE.getString("Settings.renamer.moviesetsinglemovie")); //$NON-NLS-1$
    chckbxMoviesetSingleMovie.addActionListener(actionCreateRenamerExample);
    panelRenamer.add(chckbxMoviesetSingleMovie, "8, 6, 5, 1, fill, default");

    lblMMDWarning = new JLabel(BUNDLE.getString("Settings.renamer.folder.warning")); //$NON-NLS-1$
    panelRenamer.add(lblMMDWarning, "2, 8, 11, 1");

    JLabel lblMovieFilename = new JLabel(BUNDLE.getString("Settings.renamer.file")); //$NON-NLS-1$
    panelRenamer.add(lblMovieFilename, "2, 10, right, fill");

    tfMovieFilename = new JTextField();
    tfMovieFilename.getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void removeUpdate(DocumentEvent arg0) {
            createRenamerExample();
        }

        @Override
        public void insertUpdate(DocumentEvent arg0) {
            createRenamerExample();
        }

        @Override
        public void changedUpdate(DocumentEvent arg0) {
            createRenamerExample();
        }
    });
    panelRenamer.add(tfMovieFilename, "4, 10, fill, default");
    tfMovieFilename.setColumns(10);
    lblMovieFilename.setLabelFor(tfMovieFilename);

    chckbxAsciiReplacement = new JCheckBox(BUNDLE.getString("Settings.renamer.asciireplacement")); //$NON-NLS-1$
    chckbxAsciiReplacement.addActionListener(actionCreateRenamerExample);
    panelRenamer.add(chckbxAsciiReplacement, "8, 10, 5, 1");

    lblDefault2T = new JLabel(BUNDLE.getString("Settings.default"));
    TmmFontHelper.changeFont(lblDefault2T, 0.833);
    panelRenamer.add(lblDefault2T, "2, 12, right, top");

    lblDefaultFilePattern = new JLabel(MovieSettings.DEFAULT_RENAMER_FILE_PATTERN);
    TmmFontHelper.changeFont(lblDefaultFilePattern, 0.833);
    panelRenamer.add(lblDefaultFilePattern, "4, 12, default, top");

    JTextPane txtpntAsciiHint = new JTextPane();
    txtpntAsciiHint.setOpaque(false);
    txtpntAsciiHint.setEditable(false);
    txtpntAsciiHint.setText(BUNDLE.getString("Settings.renamer.asciireplacement.hint")); //$NON-NLS-1$
    TmmFontHelper.changeFont(txtpntAsciiHint, 0.833);
    txtpntAsciiHint.setBackground(UIManager.getColor("Panel.background"));
    panelRenamer.add(txtpntAsciiHint, "8, 12, 5, 1, fill, fill");

    JTextPane txtrChooseAFolder = new JTextPane();
    txtrChooseAFolder.setOpaque(false);
    txtrChooseAFolder.setEditable(false);
    TmmFontHelper.changeFont(txtrChooseAFolder, 0.833);
    txtrChooseAFolder.setText(BUNDLE.getString("Settings.movie.renamer.example")); //$NON-NLS-1$
    txtrChooseAFolder.setBackground(UIManager.getColor("Panel.background"));
    panelRenamer.add(txtrChooseAFolder, "2, 14, 3, 3, fill, top");

    chckbxRemoveOtherNfos = new JCheckBox(BUNDLE.getString("Settings.renamer.removenfo")); //$NON-NLS-1$
    panelRenamer.add(chckbxRemoveOtherNfos, "8, 14, 5, 1");

    lblSubtitleLanguage = new JLabel(BUNDLE.getString("Settings.renamer.language")); //$NON-NLS-1$
    panelRenamer.add(lblSubtitleLanguage, "8, 16, right, default");

    cbSubtitleLanguage = new JComboBox(LanguageStyle.values());
    panelRenamer.add(cbSubtitleLanguage, "10, 16, 3, 1, fill, default");

    exampleEventList = GlazedLists.threadSafeList(new ObservableElementList<>(
            new BasicEventList<MovieRenamerExample>(), GlazedLists.beanConnector(MovieRenamerExample.class)));
    DefaultEventTableModel<MovieRenamerExample> exampleTableModel = new DefaultEventTableModel<>(
            GlazedListsSwing.swingThreadProxyList(exampleEventList), new MovieRenamerExampleTableFormat());

    panelExample = new JPanel();
    panelExample.setBorder(new TitledBorder(null, BUNDLE.getString("Settings.example"), TitledBorder.LEADING, //$NON-NLS-1$
            TitledBorder.TOP, null, null));
    add(panelExample, "2, 4, fill, fill");
    panelExample.setLayout(new FormLayout(
            new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC,
                    FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"),
                    FormFactory.RELATED_GAP_COLSPEC, },
            new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("50dlu:grow"),
                    FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC,
                    FormFactory.RELATED_GAP_ROWSPEC, }));

    JLabel lblExampleT = new JLabel(BUNDLE.getString("tmm.movie")); //$NON-NLS-1$
    panelExample.add(lblExampleT, "2, 2");

    cbMovieForPreview = new JComboBox();
    panelExample.add(cbMovieForPreview, "4, 2");

    lblExample = new JLabel("");
    panelExample.add(lblExample, "2, 4, 3, 1");
    TmmFontHelper.changeFont(lblExample, 0.916, Font.BOLD);
    tableExamples = new ZebraJTable(exampleTableModel);
    scrollPane = ZebraJTable.createStripedJScrollPane(tableExamples);
    scrollPane.setViewportView(tableExamples);
    panelExample.add(scrollPane, "2, 6, 3, 1, fill, fill");

    JTextPane txtpntTitle = new JTextPane();
    txtpntTitle.setOpaque(false);
    panelExample.add(txtpntTitle, "2, 8, 3, 1");
    TmmFontHelper.changeFont(txtpntTitle, 0.833);
    txtpntTitle.setBackground(UIManager.getColor("Panel.background"));
    txtpntTitle.setText(BUNDLE.getString("Settings.movie.renamer.optional")); //$NON-NLS-1$
    txtpntTitle.setEditable(false);
    cbMovieForPreview.addActionListener(actionCreateRenamerExample);

    initDataBindings();

    // space separator
    String replacement = settings.getMovieRenamerSpaceReplacement();
    int index = separators.indexOf(replacement);
    if (index >= 0) {
        cbSeparator.setSelectedIndex(index);
    }

    // language style
    cbSubtitleLanguage.setSelectedItem(settings.getMovieRenamerLanguageStyle());

    // examples
    exampleEventList.add(new MovieRenamerExample("$T"));
    exampleEventList.add(new MovieRenamerExample("$O"));
    exampleEventList.add(new MovieRenamerExample("$1"));
    exampleEventList.add(new MovieRenamerExample("$E"));
    exampleEventList.add(new MovieRenamerExample("$2"));
    exampleEventList.add(new MovieRenamerExample("$Y"));
    exampleEventList.add(new MovieRenamerExample("$M"));
    exampleEventList.add(new MovieRenamerExample("$N"));
    exampleEventList.add(new MovieRenamerExample("$I"));
    exampleEventList.add(new MovieRenamerExample("$C"));
    exampleEventList.add(new MovieRenamerExample("$D"));
    exampleEventList.add(new MovieRenamerExample("$G"));
    exampleEventList.add(new MovieRenamerExample("$L"));
    exampleEventList.add(new MovieRenamerExample("$R"));
    exampleEventList.add(new MovieRenamerExample("$A"));
    exampleEventList.add(new MovieRenamerExample("$V"));
    exampleEventList.add(new MovieRenamerExample("$F"));
    exampleEventList.add(new MovieRenamerExample("$S"));
    exampleEventList.add(new MovieRenamerExample("$#"));
    exampleEventList.add(new MovieRenamerExample("$3"));
    exampleEventList.add(new MovieRenamerExample("$U"));
}