/*
* This file is part of WebLookAndFeel library.
*
* WebLookAndFeel library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* WebLookAndFeel library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WebLookAndFeel library. If not, see <http://www.gnu.org/licenses/>.
*/
package com.alee.examples.groups.notification;
import com.alee.examples.WebLookAndFeelDemo;
import com.alee.examples.content.DefaultExample;
import com.alee.extended.panel.GroupPanel;
import com.alee.laf.button.WebButton;
import com.alee.managers.notification.NotificationIcon;
import com.alee.managers.notification.NotificationManager;
import com.alee.managers.notification.NotificationOption;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Text notifications example.
*
* @author Mikle Garin
*/
public class TextNotificationsExample extends DefaultExample
{
/**
* {@inheritDoc}
*/
@Override
public String getTitle ()
{
return "Text notifications";
}
/**
* {@inheritDoc}
*/
@Override
public String getDescription ()
{
return "Web-styled text notifications";
}
/**
* {@inheritDoc}
*/
@Override
public Component getPreview ( final WebLookAndFeelDemo owner )
{
final WebButton notification1 = new WebButton ( "Simple text notification" );
notification1.addActionListener ( new ActionListener ()
{
@Override
public void actionPerformed ( final ActionEvent e )
{
NotificationManager.showNotification ( "Simple notification" );
}
} );
final WebButton notification2 = new WebButton ( "Notification with custom icon" );
notification2.addActionListener ( new ActionListener ()
{
@Override
public void actionPerformed ( final ActionEvent e )
{
NotificationManager.showNotification ( "Custom notification icon", NotificationIcon.tip.getIcon () );
}
} );
final WebButton notification3 = new WebButton ( "Notification with options" );
notification3.addActionListener ( new ActionListener ()
{
@Override
public void actionPerformed ( final ActionEvent e )
{
NotificationManager.showNotification ( "Choose one of available options...", NotificationIcon.database.getIcon (),
NotificationOption.apply, NotificationOption.discard );
}
} );
return new GroupPanel ( 4, false, notification1, notification2, notification3 );
}
}