new JButton("Hello<br>World");
解决方案 »
- java 接受手机客户端post数据不全的问题
- swt.win32.extension的问题,高手进
- 传递对象
- java制作可执行文件EXE和安装的另类方式
- 可以用两个JSplitPane把一个Jpanel分成三栏吗?我试了好多次都不可以,还有别的方法吗?知道的告诉下 谢谢了
- 类型转换问题
- 极简单!包里能不能用interface
- 如何用JAVA实现象OICQ中点击按钮就向上移动的效果?
- java中是否有split的功能?
- 以前没来过这里,要怎么样才能增加可用分呀?一天五分太少了。(内空)
- 请教java 能否调用com 组件 或者调用dll文件里的接口
- 一个网袋布局(GridBagLayout)的问题
It appears that my original answer to the multiline button question was not complete. When I wrote my original answer to the multiline button question I was using Java 1.1.7 and Swing 1.0.3, for which my answer remains valid. Many developers (myself included) are stuck using these older versions. However, it appears that newer versions of Swing do enable HTML rendering. Here are two suggestions sent in by two of JavaWorld's many astute readers:
Quite a few Swing components can render their contents with an HTML renderer. As a result, you can create a multiline button with the following code:
JButton b = new JButton("<html>Your<br>Name");-- Sebastian Fernandez
AND To solve the multiline button problem, simply write:
JButton myButton = new JButton("<html>Hello<p>World</html>");Be aware that all Swing components now support HTML. -- Tarek Hammoud