package voxo.client.newviews.components;
import java.awt.Dimension;
import java.awt.GraphicsEnvironment;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JWindow;
import javax.swing.SwingConstants;
import javax.swing.Timer;
public class NoticeView extends JWindow implements ActionListener {
private static final long serialVersionUID = 7125782553222257225L;
public NoticeView(String msg) {
GraphicsEnvironment e = GraphicsEnvironment.getLocalGraphicsEnvironment();
setLayout(null);
setSize(new Dimension(250, 120));
setPreferredSize(new Dimension(250, 120));
setAlwaysOnTop(true);
setLocation((e.getMaximumWindowBounds().width-250), (e.getMaximumWindowBounds().height-120));
JButton btnX = new JButton("X");
btnX.setBounds(205, 0, 45, 45);
btnX.addActionListener(this);
add(btnX);
JLabel lblNotice = new JLabel(msg);
lblNotice.setHorizontalAlignment(SwingConstants.CENTER);
lblNotice.setBounds(10, 25, 230, 84);
add(lblNotice);
setVisible(true);
new Timer(5000, this).start();
}
@Override
public void actionPerformed(ActionEvent e) {
this.dispose();
}
}