Search in sources :

Example 6 with MouseInputAdapter

use of javax.swing.event.MouseInputAdapter in project android by JetBrains.

the class ChooseApiLevelDialog method createCenterPanel.

@Nullable
@Override
protected JComponent createCenterPanel() {
    myDistributionChart.registerDistributionSelectionChangedListener(this);
    myDistributionChart.init();
    myScrollPane.getViewport().setOpaque(false);
    myScrollPane.setOpaque(false);
    myScrollPane.setBorder(null);
    myDescriptionLeft.setForeground(JBColor.foreground());
    myDescriptionLeft.setBackground(JBColor.background());
    myDescriptionRight.setForeground(JBColor.foreground());
    myDescriptionRight.setBackground(JBColor.background());
    myLearnMoreLinkLabel.setForeground(JBColor.blue);
    myLearnMoreLinkLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    Map<TextAttribute, ?> attributes = ImmutableMap.of(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
    myLearnMoreLinkLabel.setFont(myLearnMoreLinkLabel.getFont().deriveFont(attributes));
    myLearnMoreLinkLabel.addMouseListener(new MouseInputAdapter() {

        @Override
        public void mouseClicked(MouseEvent e) {
            try {
                BrowserUtil.browse(new URL(myLearnMoreLinkLabel.getText()));
            } catch (MalformedURLException e1) {
            // Pass
            }
        }
    });
    if (mySelectedApiLevel >= 0) {
        myDistributionChart.selectDistributionApiLevel(mySelectedApiLevel);
    }
    return myPanel;
}
Also used : MalformedURLException(java.net.MalformedURLException) MouseEvent(java.awt.event.MouseEvent) TextAttribute(java.awt.font.TextAttribute) MouseInputAdapter(javax.swing.event.MouseInputAdapter) URL(java.net.URL) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

MouseInputAdapter (javax.swing.event.MouseInputAdapter)6 MouseEvent (java.awt.event.MouseEvent)5 BorderLayout (java.awt.BorderLayout)4 Point (java.awt.Point)3 ActionEvent (java.awt.event.ActionEvent)3 URL (java.net.URL)3 JFrame (javax.swing.JFrame)3 JLabel (javax.swing.JLabel)3 JPanel (javax.swing.JPanel)3 JSlider (javax.swing.JSlider)3 ChangeEvent (javax.swing.event.ChangeEvent)3 ChangeListener (javax.swing.event.ChangeListener)3 Dimension (java.awt.Dimension)2 GraphicsConfiguration (java.awt.GraphicsConfiguration)2 Image (java.awt.Image)2 Window (java.awt.Window)2 DataFlavor (java.awt.datatransfer.DataFlavor)2 Transferable (java.awt.datatransfer.Transferable)2 UnsupportedFlavorException (java.awt.datatransfer.UnsupportedFlavorException)2 ActionListener (java.awt.event.ActionListener)2