开发者

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 i开发者_Python百科nsert 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜