Package voxo.client.newviews.components

Source Code of voxo.client.newviews.components.NoticeView

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();
  }
}
TOP

Related Classes of voxo.client.newviews.components.NoticeView

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.