如题,我用的是netbeans

解决方案 »

  1.   

    label
    swing控件可接受html,例如<html>第一行<br />第二行</html>
      

  2.   

    import javax.swing.JFrame;
    import javax.swing.JTextArea;
    import javax.swing.WindowConstants;public class Test extends JFrame {
    private JTextArea jTextArea1; public Test() {
    jTextArea1 = new JTextArea("asfsafsdfsdfsdfsdfsfsaf\nsdfsdfsdfasdfsf");//需要在换行的地方加入\n
    jTextArea1.setSize(100, 100);
    jTextArea1.setEnabled(false);
    setLayout(null);
    setBounds(400, 200, 400, 400);
    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    jTextArea1.setColumns(20);
    jTextArea1.setRows(5);
    add(jTextArea1);
    } public static void main(String args[]) {
    new Test().setVisible(true);
    }
    }
      

  3.   

    JLabel可以写内容。JTextArea也可以写内容。