package GUI;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JPanel;
import javax.swing.JWindow;
import Control.Contact;
import Control.Settings;
import Control.Interfaces.ListElement;
/**
* Displays a menue able to make changes on the appearance of the {@link ContactList} and gives
* access to information on a single selected {@link Contact}.
*
* @author Sebastian
*
*/
public class ContactListMenue extends JWindow{
private JButton renameButton = new JButton("Umbenennen");
private JButton recordsButton = new JButton("Verlauf");
private JButton fileButton = new JButton("Dateien");
private JButton deleteButton = new JButton("L�schen");
private JComboBox showBox = new JComboBox();
private JComboBox groupBox = new JComboBox();
public ContactListMenue(final Settings einstellungen, final ListElement element) {
add(renameButton);
renameButton.setBounds(1,10,108,18);
add(deleteButton);
deleteButton.setBounds(1,30,108,18);
add(recordsButton);
recordsButton.setBounds(1,66,108,18);
add(fileButton);
fileButton.setBounds(1,48,108,18);
if(element == null){
renameButton.setEnabled(false);
deleteButton.setEnabled(false);
recordsButton.setEnabled(false);
fileButton.setEnabled(false);
}
add(showBox);
showBox.setBounds(1,100,108,20);
showBox.addItem("Kontakte");
showBox.addItem("Alle anzeigen");
showBox.addItem("Nur online");
add(groupBox);
groupBox.setBounds(1,120,108,20);
groupBox.addItem("Gruppen");
groupBox.addItem("Anzeigen");
groupBox.addItem("Ausblenden");
groupBox.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
if(groupBox.getSelectedObjects()[0].equals("Anzeigen")){
if(! einstellungen.showGroups){
einstellungen.showGroups = true;
einstellungen.save();
}
}
if(groupBox.getSelectedObjects()[0].equals("Ausblenden")){
if( einstellungen.showGroups){
einstellungen.showGroups = false;
einstellungen.save();
}
}
groupBox.removeItem("Gruppen");
}});
showBox.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
if(showBox.getSelectedObjects()[0].equals("Nur online")){
if(einstellungen.showOfflineContacts){
einstellungen.showOfflineContacts = false;
einstellungen.save();
}
}else if(showBox.getSelectedObjects()[0].equals("Alle anzeigen")){
if(!einstellungen.showOfflineContacts){
einstellungen.showOfflineContacts = true;
einstellungen.save();
}
}
showBox.removeItem("Kontakte");
}});
int hoehe = 147;
int breite = 110;
setLocation(300,300);
setLayout(null);
BufferedImage bi = new BufferedImage(breite, hoehe, BufferedImage.TYPE_INT_RGB);
Graphics g = bi.getGraphics();
g.setColor(Color.white);
g.fillRect(0, 0, breite, hoehe);
g.setColor(Color.blue);
g.drawRoundRect(0, 0, breite - 1, hoehe - 1, 20, 20);
JPanel mainPanel = new GUI.Services.ImagePanel(bi);
mainPanel.setSize(breite, hoehe);
mainPanel.setDoubleBuffered(false);
mainPanel.setOpaque(false);
mainPanel.setLocation(0,0);
add(mainPanel);
com.sun.awt.AWTUtilities.setWindowOpaque(this,
false);
setSize(breite, hoehe);
}
}