/**
*
*/
package voxo.client.views.components;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import voxo.client.listeners.ButtonConfirmFriendship;
import voxo.client.views.MainView;
import voxo.common.entities.User;
/**
* @author Thierry
*
*/
@SuppressWarnings("serial")
public class CustomRequest extends JPanel {
private JButton accept;
private JButton refuse;
public CustomRequest(MainView mainView, User u){
//setlayout
this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
//add user name
JLabel aUserName = new JLabel(u.getUsername());
aUserName.setIcon(new ImageIcon("resources/images/friend.png"));
this.add(aUserName);
this.add(new JPanel());
//add accept/refuse request
setAccept(new JButton());
getAccept().setIcon(new ImageIcon("resources/images/check.png"));
setRefuse(new JButton());
getRefuse().setIcon(new ImageIcon("resources/images/x.png"));
//implements listeners
getAccept().addActionListener(new ButtonConfirmFriendship(mainView,u, this));
getRefuse().addActionListener(new ButtonConfirmFriendship(mainView,u, this));
//add buttons to layout
this.add(getAccept());
this.add(getRefuse());
}
/**
* @return the accept
*/
public JButton getAccept() {
return accept;
}
/**
* @param accept the accept to set
*/
public void setAccept(JButton accept) {
this.accept = accept;
}
/**
* @return the refuse
*/
public JButton getRefuse() {
return refuse;
}
/**
* @param refuse the refuse to set
*/
public void setRefuse(JButton refuse) {
this.refuse = refuse;
}
}