package GUI;
import java.awt.Component;
import java.awt.Image;
import java.awt.Rectangle;
import javax.swing.JWindow;
import Communication.Status;
import GUI.Interfaces.Background;
import GUI.Interfaces.ImageBarListener;
/**
* Provides the possibility to choose between three statuses. Displays an {@link ImageBar} that
* makes that possible. For reasons of appearance the windows can't be resized or repositioned by
* the user. It is displayed with an opaqueness of 75%.
*
* @author Sebastian
*/
public class StatusChangeWindow extends JWindow implements ImageBarListener{
private ImageBar statusBar;
private MainWindow mainWindow;
public StatusChangeWindow(MainWindow mainWindow, Image[] symbols, int x, int y, int width, int height)
{
this.mainWindow = mainWindow;
setSize(width, height);
setLayout(null);
setLocation(x, y);
statusBar = new ImageBar(40, 100, 3, symbols, 35, 6, 25, 1, false);
add(statusBar);
statusBar.setBounds(10,10,40,100);
statusBar.addImageBarListener(this);
Background background = new StandardBackground(false, new Rectangle(x, y, width, height), -1);
add((Component) background);
background.setBounds(0, 0, width, height);
setVisible(true);
com.sun.awt.AWTUtilities.setWindowOpacity(this, 0.75f);
}
public void buttonClicked(int buttonIndex, int buttonCount) {
// TODO Auto-generated method stub
if(buttonIndex == 0){
mainWindow.statusChanged(Status.Online);
}else if(buttonIndex == 1){
mainWindow.statusChanged(Status.NotAvailable);
}else if(buttonIndex == 2){
mainWindow.statusChanged(Status.Invisible);
}
}
}