PageRenderTime 109ms CodeModel.GetById 41ms app.highlight 2ms RepoModel.GetById 58ms app.codeStats 7ms

/src/org/bitbucket/connectors/jetbrains/ui/HtmlPanel.java

https://bitbucket.org/atlassian/jetbrains-bitbucket-connector/
Java | 37 lines | 25 code | 7 blank | 5 comment | 2 complexity | 273c31a5d576429f70f26792ef5d5176 MD5 | raw file
 1package org.bitbucket.connectors.jetbrains.ui;
 2
 3import com.intellij.ide.BrowserUtil;
 4
 5import javax.swing.*;
 6import javax.swing.event.HyperlinkEvent;
 7import javax.swing.event.HyperlinkListener;
 8
 9/**
10 * User: leha
11 * Date: 5/11/11
12 * Time: 6:05 PM
13 */
14public class HtmlPanel {
15    private JPanel myPane;
16    private JTextPane myTextPane;
17
18    public HtmlPanel() {
19        myTextPane.setBackground(myPane.getBackground());
20        myTextPane.addHyperlinkListener(new HyperlinkListener() {
21            public void hyperlinkUpdate(HyperlinkEvent e) {
22                if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
23                    BrowserUtil.launchBrowser(e.getURL().toExternalForm());
24                }
25            }
26        });
27
28    }
29
30    public void setText(String text) {
31        myTextPane.setText("<html>" + text + "</html>");
32    }
33
34    public JPanel getPanel() {
35        return myPane;
36    }
37}