Paul Reiners
Paul Reiners

Reputation: 7894

Creating a Symbol palette in Swing

Suppose I want to create a control in Java that is like the Symbol control in Microsoft Word that allows you to choose and insert symbols from a grid into a text area. Are there any Swing controls that would get me half-way there? If not, any ideas on how to create one from scratch?

Upvotes: 2

Views: 379

Answers (1)

camickr
camickr

Reputation: 324167

Just create a JPanel with a GridLayout. Then you can add JButtons to the grid with the text of the button representing the symbol you want to add to the text area. You can then share a common ActionLIstener between all the buttons that simply takes the text of the button and inserts it into the text area.

Upvotes: 6

Related Questions