public DrawingToolbar(WhiteboardClientModel model) {
        this.model = model;
        this.setFloatable(false);

        ButtonGroup toolButtons = new ButtonGroup();
        boolean first = true;
        for (Class<? extends DrawingTool> toolClass : new Class[] { Pen.class, Eraser.class }) {
            ToolSelectionButton button = new ToolSelectionButton(toolClass);
            toolButtons.add(button);
            this.add(button);

            // the first tool in the list is the one selected by default
            if (first) {
                button.doClick();
                first = false;
            }
        }

        this.addSeparator();

        this.add(new JLabel("Current color: "));
        colorPickerButton = new JButton("             "); // makes it bigger
        colorPickerButton.setBackground(this.model.getColor());

        colorPickerButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                Color color = JColorChooser.showDialog(DrawingToolbar.this, "Pick color",
                        DrawingToolbar.this.model.getColor());
                if (color != null) {
                    colorPickerButton.setBackground(color);
                    DrawingToolbar.this.model.setColor(color);
                }
            }
        });
        this.add(colorPickerButton);

        this.addSeparator();

        this.add(new JLabel("Pen width: "));
        JSlider brushWidthSlider = new JSlider(1, 20, 5);
        brushWidthSlider.addChangeListener(new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent e) {
                DrawingToolbar.this.model.setBrushWidth(((JSlider) (e.getSource())).getValue());
            }
        });
        this.add(brushWidthSlider);

        this.addSeparator(new Dimension(40, 1));

        JButton changeUsernameButton = new JButton("Change username...");
        changeUsernameButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                String username = JOptionPane.showInputDialog(DrawingToolbar.this, "Change username to",
                        DrawingToolbar.this.model.getUsername());
                if (username == null)
                    return;
                username = WhiteboardClientModel.sanitizeString(username);
                DrawingToolbar.this.model.setUsername(username);
            }
        });
        this.add(changeUsernameButton);

        JButton switchWhiteboardButton = new JButton("Switch whiteboard...");
        switchWhiteboardButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                String whiteboardID = JOptionPane.showInputDialog(DrawingToolbar.this,
                        "Switch to whiteboard: (leave blank for a new randomly-named board)",
                        DrawingToolbar.this.model.whiteboard == null ? ""
                                : DrawingToolbar.this.model.whiteboard.whiteboardID);
                if (whiteboardID == null)
                    return;
                whiteboardID = WhiteboardClientModel.sanitizeString(whiteboardID);
                DrawingToolbar.this.model.switchWhiteboard(whiteboardID);
            }
        });
        this.add(switchWhiteboardButton);
    }