Search in sources :

Example 1 with Emoticon

use of org.jivesoftware.sparkimpl.plugin.emoticons.Emoticon in project Spark by igniterealtime.

the class ThemePanel method showSelectedEmoticon.

/**
 * Displays the active emoticon pack.
 */
protected void showSelectedEmoticon() {
    EmoticonManager emoticonManager = EmoticonManager.getInstance();
    int i = emoticonManager.getActiveEmoticonSet().size();
    if (i == 0) {
        emoticonspanel = new EmoticonPanel(1);
        JLabel label = new JLabel(SparkRes.getImageIcon(SparkRes.SMALL_DELETE));
        emoticonspanel.add(label);
    } else if (i < 25) {
        emoticonspanel = new EmoticonPanel(i);
    } else {
        emoticonspanel = new EmoticonPanel(10);
    }
    for (Emoticon emoticon : emoticonManager.getActiveEmoticonSet()) {
        ImageIcon ico = new ImageIcon(emoticonManager.getEmoticonURL(emoticon));
        JLabel label = new JLabel(ico);
        emoticonspanel.add(label);
    }
    int rows = Math.min(((EmoticonPanel) emoticonspanel).getNumRows() * 45, 300);
    emoticonscrollpane.setPreferredSize(new Dimension(300, rows));
    emoticonscrollpane.setViewportView(emoticonspanel);
    this.revalidate();
}
Also used : Emoticon(org.jivesoftware.sparkimpl.plugin.emoticons.Emoticon) EmoticonManager(org.jivesoftware.sparkimpl.plugin.emoticons.EmoticonManager)

Example 2 with Emoticon

use of org.jivesoftware.sparkimpl.plugin.emoticons.Emoticon in project Spark by igniterealtime.

the class ButtonFactory method createEmoticonButton.

public RolloverButton createEmoticonButton() {
    final EmoticonManager emoticonManager = EmoticonManager.getInstance();
    final String activeEmoticonSetName = emoticonManager.getActiveEmoticonSetName();
    final Emoticon smileEmoticon = emoticonManager.getEmoticon(activeEmoticonSetName, ":)");
    Emoticon firstEmoticon = (smileEmoticon == null) ? emoticonManager.getFirstEmotion(activeEmoticonSetName) : smileEmoticon;
    URL emotionURL = emoticonManager.getEmoticonURL(firstEmoticon);
    ImageIcon icon = new ImageIcon(emotionURL);
    return new RolloverButton(icon);
}
Also used : Emoticon(org.jivesoftware.sparkimpl.plugin.emoticons.Emoticon) ImageIcon(javax.swing.ImageIcon) EmoticonManager(org.jivesoftware.sparkimpl.plugin.emoticons.EmoticonManager) RolloverButton(org.jivesoftware.spark.component.RolloverButton) URL(java.net.URL)

Aggregations

Emoticon (org.jivesoftware.sparkimpl.plugin.emoticons.Emoticon)2 EmoticonManager (org.jivesoftware.sparkimpl.plugin.emoticons.EmoticonManager)2 URL (java.net.URL)1 ImageIcon (javax.swing.ImageIcon)1 RolloverButton (org.jivesoftware.spark.component.RolloverButton)1