Search in sources :

Example 6 with JTextPane

use of javax.swing.JTextPane in project jdk8u_jdk by JetBrains.

the class DimensionEncapsulation method run.

@Override
public void run() {
    runTest(new Panel());
    runTest(new Button());
    runTest(new Checkbox());
    runTest(new Canvas());
    runTest(new Choice());
    runTest(new Label());
    runTest(new Scrollbar());
    runTest(new TextArea());
    runTest(new TextField());
    runTest(new Dialog(new JFrame()));
    runTest(new Frame());
    runTest(new Window(new JFrame()));
    runTest(new FileDialog(new JFrame()));
    runTest(new List());
    runTest(new ScrollPane());
    runTest(new JFrame());
    runTest(new JDialog(new JFrame()));
    runTest(new JWindow(new JFrame()));
    runTest(new JLabel("hi"));
    runTest(new JMenu());
    runTest(new JTree());
    runTest(new JTable());
    runTest(new JMenuItem());
    runTest(new JCheckBoxMenuItem());
    runTest(new JToggleButton());
    runTest(new JSpinner());
    runTest(new JSlider());
    runTest(Box.createVerticalBox());
    runTest(Box.createHorizontalBox());
    runTest(new JTextField());
    runTest(new JTextArea());
    runTest(new JTextPane());
    runTest(new JPasswordField());
    runTest(new JFormattedTextField());
    runTest(new JEditorPane());
    runTest(new JButton());
    runTest(new JColorChooser());
    runTest(new JFileChooser());
    runTest(new JCheckBox());
    runTest(new JInternalFrame());
    runTest(new JDesktopPane());
    runTest(new JTableHeader());
    runTest(new JLayeredPane());
    runTest(new JRootPane());
    runTest(new JMenuBar());
    runTest(new JOptionPane());
    runTest(new JRadioButton());
    runTest(new JRadioButtonMenuItem());
    runTest(new JPopupMenu());
    //runTest(new JScrollBar()); --> don't test defines max and min in
    // terms of preferred
    runTest(new JScrollPane());
    runTest(new JViewport());
    runTest(new JSplitPane());
    runTest(new JTabbedPane());
    runTest(new JToolBar());
    runTest(new JSeparator());
    runTest(new JProgressBar());
    if (!failures.isEmpty()) {
        System.out.println("These classes failed");
        for (final Component failure : failures) {
            System.out.println(failure.getClass());
        }
        throw new RuntimeException("Test failed");
    }
}
Also used : JDesktopPane(javax.swing.JDesktopPane) Choice(java.awt.Choice) JTextArea(javax.swing.JTextArea) TextArea(java.awt.TextArea) JTextArea(javax.swing.JTextArea) Label(java.awt.Label) JLabel(javax.swing.JLabel) JTableHeader(javax.swing.table.JTableHeader) JToggleButton(javax.swing.JToggleButton) JToggleButton(javax.swing.JToggleButton) Button(java.awt.Button) JRadioButton(javax.swing.JRadioButton) JButton(javax.swing.JButton) JFrame(javax.swing.JFrame) Checkbox(java.awt.Checkbox) JDialog(javax.swing.JDialog) FileDialog(java.awt.FileDialog) Dialog(java.awt.Dialog) JTextField(javax.swing.JTextField) TextField(java.awt.TextField) JFormattedTextField(javax.swing.JFormattedTextField) JSlider(javax.swing.JSlider) ArrayList(java.util.ArrayList) List(java.awt.List) Canvas(java.awt.Canvas) JWindow(javax.swing.JWindow) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem) JOptionPane(javax.swing.JOptionPane) JCheckBoxMenuItem(javax.swing.JCheckBoxMenuItem) JCheckBox(javax.swing.JCheckBox) JTree(javax.swing.JTree) JFileChooser(javax.swing.JFileChooser) JPasswordField(javax.swing.JPasswordField) ScrollPane(java.awt.ScrollPane) JScrollPane(javax.swing.JScrollPane) JTable(javax.swing.JTable) JSpinner(javax.swing.JSpinner) JSplitPane(javax.swing.JSplitPane) JColorChooser(javax.swing.JColorChooser) JInternalFrame(javax.swing.JInternalFrame) JDialog(javax.swing.JDialog) JFrame(javax.swing.JFrame) Frame(java.awt.Frame) JInternalFrame(javax.swing.JInternalFrame) JRadioButton(javax.swing.JRadioButton) JLayeredPane(javax.swing.JLayeredPane) JTabbedPane(javax.swing.JTabbedPane) JButton(javax.swing.JButton) JProgressBar(javax.swing.JProgressBar) JTextField(javax.swing.JTextField) JSeparator(javax.swing.JSeparator) JTextPane(javax.swing.JTextPane) JMenuItem(javax.swing.JMenuItem) Component(java.awt.Component) Scrollbar(java.awt.Scrollbar) Window(java.awt.Window) JWindow(javax.swing.JWindow) JScrollPane(javax.swing.JScrollPane) JViewport(javax.swing.JViewport) JFormattedTextField(javax.swing.JFormattedTextField) JLabel(javax.swing.JLabel) JToolBar(javax.swing.JToolBar) JPopupMenu(javax.swing.JPopupMenu) Panel(java.awt.Panel) JEditorPane(javax.swing.JEditorPane) JRootPane(javax.swing.JRootPane) FileDialog(java.awt.FileDialog) JMenu(javax.swing.JMenu) JMenuBar(javax.swing.JMenuBar)

Example 7 with JTextPane

use of javax.swing.JTextPane in project pcgen by PCGen.

the class NotesView method initComponents.

/**
	 *  This method is called from within the constructor to initialize the form.
	 *  WARNING: Do NOT modify this code. The content of this method is always
	 *  regenerated by the Form Editor.
	 */
private void initComponents() {
    //GEN-BEGIN:initComponents
    jSplitPane1 = new FlippingSplitPane();
    jScrollPane1 = new JScrollPane();
    notesTree = new JTree();
    jPanel1 = new JPanel();
    jScrollPane2 = new JScrollPane();
    editor = new JTextPane();
    jPanel2 = new JPanel();
    fileBar = new JToolBar();
    newButton = new JButton();
    saveButton = new JButton();
    exportButton = new JButton();
    revertButton = new JButton();
    deleteButton = new JButton();
    clipboardBar = new JToolBar();
    cutButton = new JButton();
    copyButton = new JButton();
    pasteButton = new JButton();
    formatBar = new JToolBar();
    sizeCB = new JComboBox();
    boldButton = new JButton();
    italicButton = new JButton();
    underlineButton = new JButton();
    colorButton = new JButton();
    bulletButton = new JButton();
    enumButton = new JButton();
    imageButton = new JButton();
    alignmentBar = new JToolBar();
    leftJustifyButton = new JButton();
    centerJustifyButton = new JButton();
    rightJustifyButton = new JButton();
    filePane = new JPanel();
    fileLeft = new JButton();
    fileRight = new JButton();
    filesBar = new JToolBar();
    setLayout(new java.awt.BorderLayout());
    jSplitPane1.setDividerLocation(175);
    jSplitPane1.setDividerSize(5);
    jScrollPane1.setViewportView(notesTree);
    jSplitPane1.setLeftComponent(jScrollPane1);
    jPanel1.setLayout(new java.awt.BorderLayout());
    editor.addCaretListener(this::editorCaretUpdate);
    jScrollPane2.setViewportView(editor);
    jPanel1.add(jScrollPane2, java.awt.BorderLayout.CENTER);
    jPanel2.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 0, 0));
    newButton.setIcon(Icons.stock_new.getImageIcon());
    newButton.setToolTipText("New Node");
    newButton.setBorder(new EtchedBorder());
    newButton.setEnabled(false);
    newButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            newButtonActionPerformed();
        }
    });
    fileBar.add(newButton);
    saveButton.setIcon(Icons.stock_save.getImageIcon());
    saveButton.setToolTipText("Save Node");
    saveButton.setBorder(new EtchedBorder());
    saveButton.setEnabled(false);
    saveButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            saveButtonActionPerformed();
        }
    });
    fileBar.add(saveButton);
    exportButton.setIcon(Icons.stock_export.getImageIcon());
    exportButton.setToolTipText("Export");
    exportButton.setBorder(new EtchedBorder());
    exportButton.setEnabled(false);
    exportButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            exportButtonActionPerformed();
        }
    });
    fileBar.add(exportButton);
    revertButton.setIcon(Icons.stock_revert.getImageIcon());
    revertButton.setToolTipText("Revert to Saved");
    revertButton.setBorder(new EtchedBorder());
    revertButton.setEnabled(false);
    revertButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            revertButtonActionPerformed();
        }
    });
    fileBar.add(revertButton);
    deleteButton.setIcon(Icons.stock_broken_image.getImageIcon());
    deleteButton.setToolTipText("Delete Node");
    deleteButton.setBorder(new EtchedBorder());
    deleteButton.setEnabled(false);
    deleteButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            deleteButtonActionPerformed();
        }
    });
    fileBar.add(deleteButton);
    jPanel2.add(fileBar);
    cutButton.setIcon(Icons.stock_cut.getImageIcon());
    cutButton.setToolTipText("Cut");
    cutButton.setBorder(new EtchedBorder());
    cutButton.addActionListener(this::cutButtonActionPerformed);
    clipboardBar.add(cutButton);
    copyButton.setIcon(Icons.stock_copy.getImageIcon());
    copyButton.setToolTipText("Copy");
    copyButton.setBorder(new EtchedBorder());
    copyButton.addActionListener(this::copyButtonActionPerformed);
    clipboardBar.add(copyButton);
    pasteButton.setIcon(Icons.stock_paste.getImageIcon());
    pasteButton.setToolTipText("Paste");
    pasteButton.setBorder(new EtchedBorder());
    pasteButton.addActionListener(this::pasteButtonActionPerformed);
    clipboardBar.add(pasteButton);
    jPanel2.add(clipboardBar);
    sizeCB.setToolTipText("Size");
    sizeCB.setBorder(new EtchedBorder());
    sizeCB.addActionListener(this::sizeCBActionPerformed);
    formatBar.add(sizeCB);
    boldButton.setIcon(Icons.stock_text_bold.getImageIcon());
    boldButton.setToolTipText("Bold");
    boldButton.setBorder(new EtchedBorder());
    boldButton.addActionListener(this::boldButtonActionPerformed);
    formatBar.add(boldButton);
    italicButton.setIcon(Icons.stock_text_italic.getImageIcon());
    italicButton.setToolTipText("Italic");
    italicButton.setBorder(new EtchedBorder());
    italicButton.addActionListener(this::italicButtonActionPerformed);
    formatBar.add(italicButton);
    underlineButton.setIcon(Icons.stock_text_underline.getImageIcon());
    underlineButton.setToolTipText("Underline");
    underlineButton.setBorder(new EtchedBorder());
    underlineButton.addActionListener(this::underlineButtonActionPerformed);
    formatBar.add(underlineButton);
    colorButton.setForeground(new java.awt.Color(0, 0, 0));
    colorButton.setIcon(Icons.createImageIcon("menu-mode-RGB-alt.png"));
    colorButton.setToolTipText("Color");
    colorButton.setBorder(new EtchedBorder());
    colorButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            colorButtonActionPerformed();
        }
    });
    formatBar.add(colorButton);
    bulletButton.setIcon(Icons.stock_list_bulet.getImageIcon());
    bulletButton.setToolTipText("Bulleted List");
    bulletButton.setAction(actionListUnordered);
    bulletButton.setBorder(new EtchedBorder());
    formatBar.add(bulletButton);
    enumButton.setIcon(Icons.stock_list_enum.getImageIcon());
    enumButton.setToolTipText("Numbered List");
    enumButton.setAction(actionListOrdered);
    enumButton.setBorder(new EtchedBorder());
    formatBar.add(enumButton);
    imageButton.setIcon(Icons.stock_insert_graphic.getImageIcon());
    imageButton.setBorder(new EtchedBorder());
    imageButton.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            imageButtonActionPerformed();
        }
    });
    formatBar.add(imageButton);
    jPanel2.add(formatBar);
    leftJustifyButton.setIcon(Icons.stock_text_align_left.getImageIcon());
    leftJustifyButton.setToolTipText("Left Justify");
    leftJustifyButton.setBorder(new EtchedBorder());
    leftJustifyButton.addActionListener(this::leftJustifyButtonActionPerformed);
    alignmentBar.add(leftJustifyButton);
    centerJustifyButton.setIcon(Icons.stock_text_align_center.getImageIcon());
    centerJustifyButton.setToolTipText("Center");
    centerJustifyButton.setBorder(new EtchedBorder());
    centerJustifyButton.addActionListener(this::centerJustifyButtonActionPerformed);
    alignmentBar.add(centerJustifyButton);
    rightJustifyButton.setIcon(Icons.stock_text_align_right.getImageIcon());
    rightJustifyButton.setToolTipText("Right Justify");
    rightJustifyButton.setBorder(new EtchedBorder());
    rightJustifyButton.addActionListener(this::rightJustifyButtonActionPerformed);
    alignmentBar.add(rightJustifyButton);
    jPanel2.add(alignmentBar);
    jPanel1.add(jPanel2, java.awt.BorderLayout.NORTH);
    filePane.setLayout(new BoxLayout(filePane, BoxLayout.X_AXIS));
    fileLeft.setText("<");
    fileLeft.setBorder(new EtchedBorder());
    fileLeft.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            fileLeftActionPerformed();
        }
    });
    filePane.add(fileLeft);
    fileRight.setText(">");
    fileRight.setBorder(new EtchedBorder());
    fileRight.addActionListener(new java.awt.event.ActionListener() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            fileRightActionPerformed();
        }
    });
    filePane.add(fileRight);
    filePane.add(filesBar);
    jPanel1.add(filePane, java.awt.BorderLayout.SOUTH);
    jSplitPane1.setRightComponent(jPanel1);
    add(jSplitPane1, java.awt.BorderLayout.CENTER);
}
Also used : JScrollPane(javax.swing.JScrollPane) Color(java.awt.Color) JPanel(javax.swing.JPanel) ActionListener(java.awt.event.ActionListener) JComboBox(javax.swing.JComboBox) BoxLayout(javax.swing.BoxLayout) JButton(javax.swing.JButton) JToolBar(javax.swing.JToolBar) FlippingSplitPane(gmgen.gui.FlippingSplitPane) ActionEvent(java.awt.event.ActionEvent) JTextPane(javax.swing.JTextPane) JTree(javax.swing.JTree) EtchedBorder(javax.swing.border.EtchedBorder)

Example 8 with JTextPane

use of javax.swing.JTextPane in project pcgen by PCGen.

the class NotesTreeNode method getTextPane.

/**
	 * Gets a JTextPane that contains the content of the "data.html" in this
	 * directory (or the modified document if it has been modified), or is empty
	 * if that file does not exist. This function caches the JTextPan so that the
	 * speed doesn't suck.
	 *
	 * @return The populated JTextPane
	 */
public JTextPane getTextPane() {
    boolean repopulate = false;
    cacheCounter = 10;
    if (pane == null) {
        pane = new JTextPane();
        repopulate = true;
        ExtendedHTMLEditorKit htmlKit = new ExtendedHTMLEditorKit();
        pane.setEditorKit(htmlKit);
        notesDoc = (ExtendedHTMLDocument) (htmlKit.createDefaultDocument());
        notesDoc.putProperty(DOCROOT, dir.getAbsolutePath() + File.separator + DATA_HTML);
    }
    pane.setDocument(notesDoc);
    if (repopulate) {
        File notes = new File(dir.getAbsolutePath() + File.separator + DATA_HTML);
        if (notes.exists()) {
            try {
                BufferedReader br = new BufferedReader(new FileReader(notes));
                StringBuilder sb = new StringBuilder();
                String newLine;
                do {
                    newLine = br.readLine();
                    if (newLine != null) {
                        sb.append(newLine).append(Constants.LINE_SEPARATOR);
                    }
                } while (newLine != null);
                br.close();
                pane.setText(sb.toString());
            } catch (Exception e) {
                Logging.errorPrint(e.getMessage(), e);
            }
        }
        pane.setCaretPosition(0);
        notesDoc.addDocumentListener(this);
    }
    return pane;
}
Also used : JTextPane(javax.swing.JTextPane) BufferedReader(java.io.BufferedReader) FileReader(java.io.FileReader) ExtendedHTMLEditorKit(gmgen.gui.ExtendedHTMLEditorKit) File(java.io.File) NoSuchElementException(java.util.NoSuchElementException)

Example 9 with JTextPane

use of javax.swing.JTextPane in project EnrichmentMapApp by BaderLab.

the class CreationParametersPanel method getInfoPane.

JTextPane getInfoPane() {
    if (infoPane == null) {
        infoPane = new JTextPane();
        infoPane.setEditable(false);
        infoPane.setContentType("text/html");
        ((HTMLDocument) infoPane.getDocument()).setPreservesUnknownTags(false);
        infoPane.setText(getInfoText());
        makeSmall(infoPane);
    }
    return infoPane;
}
Also used : JTextPane(javax.swing.JTextPane) HTMLDocument(javax.swing.text.html.HTMLDocument)

Example 10 with JTextPane

use of javax.swing.JTextPane in project jmeter by apache.

the class SamplerResultTab method createResponseMetadataPanel.

private Component createResponseMetadataPanel() {
    stats = new JTextPane();
    stats.setEditable(false);
    stats.setBackground(backGround);
    // Add styles to use for different types of status messages
    StyledDocument doc = (StyledDocument) stats.getDocument();
    Style style = doc.addStyle(STYLE_REDIRECT, null);
    StyleConstants.setForeground(style, REDIRECT_COLOR);
    style = doc.addStyle(STYLE_CLIENT_ERROR, null);
    StyleConstants.setForeground(style, CLIENT_ERROR_COLOR);
    style = doc.addStyle(STYLE_SERVER_ERROR, null);
    StyleConstants.setForeground(style, SERVER_ERROR_COLOR);
    paneRaw = GuiUtils.makeScrollPane(stats);
    paneRaw.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    // Set up the 1st table Result with empty headers
    tableResult = new JTable(resultModel);
    JMeterUtils.applyHiDPI(tableResult);
    // $NON-NLS-1$
    tableResult.setToolTipText(JMeterUtils.getResString("textbox_tooltip_cell"));
    tableResult.addMouseListener(new TextBoxDoubleClick(tableResult));
    setFirstColumnPreferredSize(tableResult);
    RendererUtils.applyRenderers(tableResult, RENDERERS_RESULT);
    // Set up the 2nd table 
    tableResHeaders = new JTable(resHeadersModel);
    JMeterUtils.applyHiDPI(tableResHeaders);
    // $NON-NLS-1$
    tableResHeaders.setToolTipText(JMeterUtils.getResString("textbox_tooltip_cell"));
    tableResHeaders.addMouseListener(new TextBoxDoubleClick(tableResHeaders));
    setFirstColumnPreferredSize(tableResHeaders);
    tableResHeaders.getTableHeader().setDefaultRenderer(new HeaderAsPropertyRenderer());
    RendererUtils.applyRenderers(tableResHeaders, RENDERERS_HEADERS);
    // Set up the 3rd table 
    tableResFields = new JTable(resFieldsModel);
    JMeterUtils.applyHiDPI(tableResFields);
    // $NON-NLS-1$
    tableResFields.setToolTipText(JMeterUtils.getResString("textbox_tooltip_cell"));
    tableResFields.addMouseListener(new TextBoxDoubleClick(tableResFields));
    setFirstColumnPreferredSize(tableResFields);
    tableResFields.getTableHeader().setDefaultRenderer(new HeaderAsPropertyRenderer());
    RendererUtils.applyRenderers(tableResFields, RENDERERS_FIELDS);
    // Prepare the Results tabbed pane
    tabbedResult = new JTabbedPane(SwingConstants.BOTTOM);
    // Create the split pane
    JSplitPane topSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, GuiUtils.makeScrollPane(tableResHeaders), GuiUtils.makeScrollPane(tableResFields));
    topSplit.setOneTouchExpandable(true);
    // set split ratio
    topSplit.setResizeWeight(0.80);
    // see bug jdk 4131528
    topSplit.setBorder(null);
    paneParsed = new JSplitPane(JSplitPane.VERTICAL_SPLIT, GuiUtils.makeScrollPane(tableResult), topSplit);
    paneParsed.setOneTouchExpandable(true);
    // set split ratio
    paneParsed.setResizeWeight(0.40);
    // see bug jdk 4131528
    paneParsed.setBorder(null);
    // setup bottom tabs, first Raw, second Parsed
    //$NON-NLS-1$
    tabbedResult.addTab(JMeterUtils.getResString("view_results_table_result_tab_raw"), paneRaw);
    //$NON-NLS-1$
    tabbedResult.addTab(JMeterUtils.getResString("view_results_table_result_tab_parsed"), paneParsed);
    // Hint to background color on bottom tabs (grey, not blue)
    JPanel panel = new JPanel(new BorderLayout());
    panel.add(tabbedResult);
    return panel;
}
Also used : JTextPane(javax.swing.JTextPane) JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) JTable(javax.swing.JTable) HeaderAsPropertyRenderer(org.apache.jmeter.gui.util.HeaderAsPropertyRenderer) JTabbedPane(javax.swing.JTabbedPane) StyledDocument(javax.swing.text.StyledDocument) Style(javax.swing.text.Style) TextBoxDoubleClick(org.apache.jmeter.gui.util.TextBoxDialoger.TextBoxDoubleClick) JSplitPane(javax.swing.JSplitPane)

Aggregations

JTextPane (javax.swing.JTextPane)32 JScrollPane (javax.swing.JScrollPane)13 JButton (javax.swing.JButton)9 JLabel (javax.swing.JLabel)9 JPanel (javax.swing.JPanel)8 Color (java.awt.Color)6 Dimension (java.awt.Dimension)6 JRadioButton (javax.swing.JRadioButton)6 JTextField (javax.swing.JTextField)6 Insets (java.awt.Insets)4 IOException (java.io.IOException)4 JCheckBox (javax.swing.JCheckBox)4 JPasswordField (javax.swing.JPasswordField)4 JTable (javax.swing.JTable)4 BorderLayout (java.awt.BorderLayout)3 Component (java.awt.Component)3 FlowLayout (java.awt.FlowLayout)3 Font (java.awt.Font)3 GridBagConstraints (java.awt.GridBagConstraints)3 GridBagLayout (java.awt.GridBagLayout)3