Search in sources :

Example 1 with SparkToaster

use of org.jivesoftware.spark.roar.gui.SparkToaster in project Spark by igniterealtime.

the class SparkToasterHandler method messageReceived.

@Override
public void messageReceived(ChatRoom room, Message message, PropertyBundle property) {
    SparkToaster toaster = new SparkToaster();
    toaster.setDisplayTime(property.duration);
    toaster.setBorder(BorderFactory.createBevelBorder(0));
    toaster.setTitle(room.getTabTitle());
    toaster.setCustomAction(new AbstractAction() {

        private static final long serialVersionUID = 8327372636443172019L;

        @Override
        public void actionPerformed(ActionEvent e) {
            ChatFrame chatFrame = SparkManager.getChatManager().getChatContainer().getChatFrame();
            chatFrame.setState(Frame.NORMAL);
            chatFrame.setVisible(true);
        }
    });
    toaster.showToaster(room.getTabIcon(), message.getBody());
}
Also used : SparkToaster(org.jivesoftware.spark.roar.gui.SparkToaster) ChatFrame(org.jivesoftware.spark.ui.ChatFrame) ActionEvent(java.awt.event.ActionEvent) AbstractAction(javax.swing.AbstractAction)

Aggregations

ActionEvent (java.awt.event.ActionEvent)1 AbstractAction (javax.swing.AbstractAction)1 SparkToaster (org.jivesoftware.spark.roar.gui.SparkToaster)1 ChatFrame (org.jivesoftware.spark.ui.ChatFrame)1