bf = new BindingFactory(10, 10, 10, 10, 10, 10);
dim = Toolkit.getDefaultToolkit().getScreenSize();
}
public void initializeLayout() {
Binding leftEdge = bf.leftEdge();
Binding topEdge = bf.topEdge();
Binding aboveInputField = bf.above(inputField);
// PAINT CANVAS
// paintCanvas properties
paintCanvas.setBorder(BorderFactory.createLineBorder(new Color(161,
112, 23), 3));
paintCanvas.setSize(200, 500);
paintCanvas.setBackground(new Color(204, 204, 204));
// paintCanvas.setCursor(Cursor.getPredefinedCursor(Cursor.));
Toolkit toolkit = Toolkit.getDefaultToolkit();
Image image = toolkit.getImage("images/Brush.png");
Cursor c = toolkit.createCustomCursor(image,
new Point(paintCanvas.getX(), paintCanvas.getY()), "img");
paintCanvas.setCursor(c);
paintCanvas.addMouseMotionListener(new MouseMotionListener() {
@Override
public void mouseMoved(MouseEvent arg0) {
}
@Override
public void mouseDragged(MouseEvent e) {
x2 = e.getX();
y2 = e.getY();
try {
serverObj.setPoints(roomNo, x1, y1, x2, y2);
} catch (RemoteException e1) {
e1.printStackTrace();
}
x1 = e.getX();
y1 = e.getY();
}
});
paintCanvas.addMouseListener(new MouseListener() {
@Override
public void mouseReleased(MouseEvent e) {
}
@Override
public void mousePressed(MouseEvent e) {
x1 = e.getX();
y1 = e.getY();
}
@Override
public void mouseExited(MouseEvent e) {
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseClicked(MouseEvent e) {
}
});
Binding leftOfUserList = bf.leftOf(userList);
paintCanvasConstraints = new RelativeConstraints(leftEdge,
leftOfUserList, topEdge, aboveInputField);
// User List
userList.setBackground(new Color(102, 255, 153));
userList.setPreferredSize(new Dimension(200, userList.getHeight()));
users.setEditable(false);
Binding rightEdge = bf.rightEdge();
userListConstraints = new RelativeConstraints(topEdge, rightEdge,
aboveInputField);
// Input Field
inputField.setEnabled(true);
inputField.setVisible(true);
inputField.setPreferredSize(new Dimension(700, 30));
Binding bottomEdge = bf.bottomEdge();
Binding leftOfSendButton = bf.leftOf(sendButton);
Binding aboveChatPane = bf.above(chatPane);
inputFieldConstraints = new RelativeConstraints(leftEdge,
aboveChatPane, leftOfSendButton);
// Send Button
sendButton.setEnabled(true);
sendButton.addActionListener(this);
sendButton.setPreferredSize(new Dimension(150, 30));
Binding ver = bf.verticallyCenterAlignedWith(inputField);
sendButtonConstrains = new RelativeConstraints(rightEdge, ver);
chatPane.setBackground(new Color(255, 255, 153));
chatPane.setPreferredSize(new Dimension(1000, 100));
chatPaneConstraints = new RelativeConstraints(leftEdge, bottomEdge,
rightEdge);