如何在按钮单击事件时为JTextPane设置背景图像? [英] How to set background image for a JTextPane on the event click of a button?
本文介绍了如何在按钮单击事件时为JTextPane设置背景图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个按钮和一个JTextPane.我想在单击按钮(使用ActionListener)时切换JTextPane的背景图像的显示.
在此先感谢您的帮助.
I have a button, and a JTextPane. I want to toggle the displaying of a background image for the JTextPane on click of the button(using ActionListener).
Thanks in advance for the help.
推荐答案
-分配一个ActionListener
http://docs.oracle.com/javase/tutorial/uiswing/events/actionlistener.html [^ ]
-在操作上将图像分配给GUI控件
http://docs.oracle.com/javase/tutorial/2d/images/index.html [^ ]
-不要忘记:更新GUI以使图像可见.
-assign an ActionListener
http://docs.oracle.com/javase/tutorial/uiswing/events/actionlistener.html[^]
- on the Action assign an Image to the GUI Control
http://docs.oracle.com/javase/tutorial/2d/images/index.html[^]
- not to forget: update the GUI to get the image visible.
这篇关于如何在按钮单击事件时为JTextPane设置背景图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文