# RAD Chat Room - Part 2

DevFeed: [RAD Chat Room - Part 2](<https://devfeed.tech/articles/rad-chat-room-part-2-19487.md>)

Original publisher: [Read original article](<https://www.codenameone.com/blog/rad-chatroom-part-2/>)

Author: Steve Hannah

Published: 2020-05-07T00:00:00Z

Content type: tutorial

Language: en

Sources: [CodeName One](<https://devfeed.tech/sources/codename-one.md>)

Topics: [Tutorial](<https://devfeed.tech/topics/tutorial.md>), [App](<https://devfeed.tech/topics/app.md>), [ui](<https://devfeed.tech/topics/ui.md>)

Tags: [app](<https://devfeed.tech/tags/app.md>), [chat](<https://devfeed.tech/tags/chat.md>), [component](<https://devfeed.tech/tags/component.md>), [event](<https://devfeed.tech/tags/event.md>), [handler](<https://devfeed.tech/tags/handler.md>), [mobile](<https://devfeed.tech/tags/mobile.md>), [simulator](<https://devfeed.tech/tags/simulator.md>), [tutorial](<https://devfeed.tech/tags/tutorial.md>), [ui](<https://devfeed.tech/tags/ui.md>)

## AI overview

Part 2 of a RAD Chatroom tutorial explains how to add a Send button, register its action with ChatRoomView, handle the resulting event, and update the chat state when a message is sent.

## Source excerpt

This is part 2 of the RAD Chatroom tutorial. You can find part 1 here. Adding a "Send" Button A "Send" button is a pretty important part of any chat application. We'll add a send button to our app by defining an action in our controller, and passing it to the ChatRoomView as follows. First we'll define the action in our ChatFormController class: // We're going to use a lot of static functions from the UI class for creating // UI elements like actions declaratively, so we'll do a static import here. import static com.codename1.rad.ui.UI.*; // ... public class ChatFormController extends FormController { // Define the "SEND" action for the chat room public static final ActionNode send = action(icon(FontImage.MATERIAL_SEND)); Then we'll create a ViewNode to pass to the ChatRoomView constructor. This can contain properties that the chat room uses to render itself, including which actions it should "embed" and where.