一个label上面如何放几行字????也就是如何让字符串分行.label上 利用JTextArea来模拟实现(伪装)将JTextArea的背景设置成灰色,并且取消边框,禁止编辑等等.这样就可以得到一个可换行的JLabel 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用HTML标记。<html>first line<br>second line</html> new JLabel("<html> yourString<br>     yourString</html>" 楼主简直得急死我.../* * AfrLabel.java @SUN Microsystem j2sdk v1.3_1 * Afritxia 05.07.2003 * */import java.awt.*;import javax.swing.*;public class AfrLabel extends JEditorPane{ // 继承自JEditorPane,JEditorPane的编辑功能 // 要比JTextArea的编辑功能大的多 public AfrLabel(String label) { super(); setBackground(new Color(204, 204, 204)); // 设置和JLabel一样的背景色 setEditable(false); // 不可编辑,因为JLabel是不可编辑的 setText(label); } public static void main(String[] args) { JFrame frame=new JFrame(); frame.getContentPane().add(new AfrLabel("<h2>Hello, \nTest</h2>")); frame.setSize(480, 320); frame.show(); }} linux下部署多个tomcat问题 比对二个Vector找出对方没有的数据 考考你们 类加载的一个问题! 新手的迷茫``` 在Eclipse中配置Tomcat 请教下Iterator问题 最难还是包,包和路径之间的关系,高手阐述一下,最好举个例子,捆饶我一个月了5555 已经失望透顶了 怎样在applet里面嵌入frame? 用JScrollPane把JTextPane装进去后,大小老是不对。。 怎样再Jframe上加背景图片
<html>first line<br>second line</html>
* AfrLabel.java @SUN Microsystem j2sdk v1.3_1
* Afritxia 05.07.2003
*
*/import java.awt.*;
import javax.swing.*;public class AfrLabel extends JEditorPane
{
// 继承自JEditorPane,JEditorPane的编辑功能
// 要比JTextArea的编辑功能大的多 public AfrLabel(String label)
{
super();
setBackground(new Color(204, 204, 204)); // 设置和JLabel一样的背景色
setEditable(false); // 不可编辑,因为JLabel是不可编辑的
setText(label);
} public static void main(String[] args)
{
JFrame frame=new JFrame();
frame.getContentPane().add(new AfrLabel("<h2>Hello, \nTest</h2>"));
frame.setSize(480, 320); frame.show();
}
}