Examples of XHTMLPanel


Examples of org.xhtmlrenderer.simple.XHTMLPanel

        JScrollPane scrPane = new JScrollPane(codeEditor);
        split.setBottomComponent(scrPane);


        JTabbedPane tabs = new JTabbedPane();
        final XHTMLPanel xhtmlPanel = new XHTMLPanel();
        tabs.addTab("HTML", new FSScrollPane(xhtmlPanel));

        final FSPagePanel pdfPanel = new FSPagePanel();
        tabs.addTab("PDF", new JScrollPane(pdfPanel));
View Full Code Here

Examples of org.xhtmlrenderer.simple.XHTMLPanel

    private void run(final String uri) {
        frame = new JFrame("Show Sample DocBook XML Rendered with Pure CSS");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        final XHTMLPanel panel = new XHTMLPanel();
        setAntiAlias(panel);

        FSScrollPane fsp = new FSScrollPane(panel);
        frame.getContentPane().add(fsp, BorderLayout.CENTER);

        frame.pack();
        frame.setSize(1024, 768);
        frame.setVisible(true);

        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                URL url = ShowDocBookPage.class.getResource(uri);
                String urls = url.toExternalForm();
                XRLog.general("Loading URI: " + urls);
                panel.setDocument(urls);

                showAboutDialog();
            }
        });
    }
View Full Code Here

Examples of org.xhtmlrenderer.simple.XHTMLPanel

    private void showAboutDialog() {
        final JDialog aboutDlg = new JDialog(frame);
        aboutDlg.setSize(new Dimension(500, 450));

        XHTMLPanel panel = new XHTMLPanel();
        setAntiAlias(panel);
        panel.setOpaque(false);

        URL url = ShowDocBookPage.class.getResource("/docbook/xhtml/intro.xhtml");
        panel.setDocument(url.toExternalForm());

        JPanel outer = new JPanel(new BorderLayout());
        outer.add(panel, BorderLayout.CENTER);
        final JButton btn = new JButton(new AbstractAction("OK") {
            public void actionPerformed(ActionEvent e) {
View Full Code Here

Examples of org.xhtmlrenderer.simple.XHTMLPanel

        setLayout(new ProfileDisplayLayout());

        LinedBoxPanel buttonsPanel = new LinedBoxPanel(true).fullyPadded();
        launchButton = new JButton(_("launcher.launch"));
        editProfileButton = new JButton(_("launcher.editProfile"));
        XHTMLPanel view = new XHTMLPanel(new ResourceUserAgent());
        view.getSharedContext().getTextRenderer().setSmoothingThreshold(6f);

        Font font = launchButton.getFont().deriveFont(13f);
        launchButton.setFont(font);
        editProfileButton.setFont(font);

        buttonsPanel.setBorder(BorderFactory.createEmptyBorder());
        SwingHelper.removeOpaqueness(buttonsPanel);
        titleLabel.setFont(titleLabel.getFont().deriveFont(35f));

        buttonsPanel.addElement(launchButton);
        buttonsPanel.addElement(editProfileButton);

        add(titleLabel, ProfileDisplayLayout.TITLE);
        add(buttonsPanel, ProfileDisplayLayout.BUTTONS);
        add(view, BorderLayout.CENTER);

        view.setDocument("/resources/default.html");
        setDocumentStyle(view);
    }
View Full Code Here

Examples of org.xhtmlrenderer.simple.XHTMLPanel

     *
     * @param args PARAM
     */
    public HTMLTest(String[] args) {
        super(BASE_TITLE);
        panel = new XHTMLPanel();
        int width = 360;
        int height = 500;
        panel.setPreferredSize(new Dimension(width, height));
        JScrollPane scroll = new JScrollPane(panel);
        scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
View Full Code Here

Examples of org.xhtmlrenderer.simple.XHTMLPanel


        exportButton = new JButton();
        closeButton = new JButton();
        fSScrollPane1 = new FSScrollPane();
        xHTMLPanel1 = new XHTMLPanel();

        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        setTitle(NbBundle.getMessage(ReportViewFrame.class, "ReportViewDialog.title")); // NOI18N
        exportButton.setText(NbBundle.getMessage(ReportViewFrame.class, "ReportViewDialog.exportButton.text")); // NOI18N
        exportButton.addActionListener(new ActionListener() {
View Full Code Here

Examples of org.xhtmlrenderer.simple.XHTMLPanel

     *
     * @param args PARAM
     */
    public HTMLTest(String[] args) {
        super(BASE_TITLE);
        panel = new XHTMLPanel();
        int width = 360;
        int height = 500;
        panel.setPreferredSize(new Dimension(width, height));
        JScrollPane scroll = new JScrollPane(panel);
        scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
View Full Code Here

Examples of org.xhtmlrenderer.simple.XHTMLPanel

    private void showAboutDialog() {
        final JDialog aboutDlg = new JDialog(root.frame);
        aboutDlg.setSize(new Dimension(500, 450));

        PanelManager uac = new PanelManager();
        XHTMLPanel panel = new XHTMLPanel(uac);
        uac.setRepaintListener(panel);
        panel.setOpaque(false);

        panel.setDocument("demo:/demos/about.xhtml");

        JPanel outer = new JPanel(new BorderLayout());
        outer.add(panel, BorderLayout.CENTER);
        final JButton btn = new JButton(new AbstractAction("OK") {
            public void actionPerformed(ActionEvent e) {
View Full Code Here

Examples of org.xhtmlrenderer.simple.XHTMLPanel

    private void run(String[] args) {
        loadAndCheckArgs(args);

        // Create a JPanel subclass to render the page
        final XHTMLPanel panel = new XHTMLPanel();

        // Set the XHTML document to render. We use the simplest form
        // of the API call, which uses a File reference. There
        // are a variety of overloads for setDocument().
        try {
            panel.setDocument(new File(fileName));
        } catch (Exception e) {
            e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
        }

        // Put our panel in a scrolling pane. You can use
        // a regular JScrollPane here, or our FSScrollPane.
        // FSScrollPane is already set up to move the correct
        // amount when scrolling 1 line or 1 page
        FSScrollPane scroll = new FSScrollPane(panel);

        JFrame frame = new JFrame("Flying Saucer: " + panel.getDocumentTitle());
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().add(BorderLayout.CENTER, scroll);

        panel.setFontScalingFactor(1.15F);
        panel.setMinFontScale(0.01F);
        panel.setMaxFontScale(12F);
        JButton smaller = new JButton("F-");
        smaller.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
                panel.decrementFontSize();
                System.out.println("decremented");
            }
        });
        JButton def = new JButton("F0");
        def.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
                panel.resetFontSize();

                System.out.println("reset");
            }
        });
        JButton larger = new JButton("F+");
        larger.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
                panel.incrementFontSize();
                System.out.println("incremented");
            }
        });
        JPanel top = new JPanel(new FlowLayout());
        top.add(smaller);
View Full Code Here

Examples of org.xhtmlrenderer.simple.XHTMLPanel

        // That's the critical point of this sample code.
        content.setLayout(new FlowLayout());

        content.add(new JButton("Button 1"));

        final XHTMLPanel panel = new XHTMLPanel();
        content.add(panel);

        content.add(new JButton("Button 2"));
        content.add(new JButton("Button 3"));

        // Calling pack() will cause the frame and its components to be displayable (see javadoc for
        // Window.pack(); this is critical for the document layout routine, below, to have any effect
        // Note the frame doesn't need to be visible; e.g., we don't need to show the frame, layout the document,
        // then resize the window; it just needs to be displayable.
        f.pack();

        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                // Note that our document doesn't have any width constraints, but that there is very little text
                // involved, so the document width (calculated from the content) is something reasonable for this demo.
                panel.setDocumentFromString(
                        "<html style='position: absolute; background-color: red;'>" +
                                "    Several words that won't wrap" +
                                "</html>",
                        null,
                        new XhtmlNamespaceHandler());

                Dimension savedSize = panel.getSize();

                // Set the panel size to some artificially large size; the render engine will actually calculate
                // the actual (preferred) size based on the document content. Setting it to a large size here prevents
                // the document from being artificially constrained by the panel's width.
                // If the document had very long runs of text, and no width constraints, we'd want to set the width
                // to some smaller, reasonable value (800, 1024, etc.). Without that, in the absence of any other
                // information, the render engine would lay out the runs of text to as wide a space as needed to
                // accomodate the text without breaks.
                panel.setSize(10000, 10000);

                // now we lay the document out again
                panel.doDocumentLayout(panel.getGraphics());

                // and reset the size
                panel.setSize(savedSize);

                f.pack();
                f.setVisible(true);
            }
        });
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.