Niestety, ale ani setBounds(), ani setSize() nie ustawia rozmiaru komponentu jTextPane. Dostosowuje się on do treści, co robię nie tak?
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.*;
public class SPanel extends JPanel {
JTextPane textPane;
public SPanel( ) {
super();
setBounds(0, 0, 550, 420);
setBackground(Color.red);
setBorder(BorderFactory.createLineBorder(new java.awt.Color(153, 153, 153)));
textPane = new JTextPane();
textPane.setContentType("text/html");
textPane.setBackground(Color.white);
textPane.setEditable(false);
textPane.setDisabledTextColor(new java.awt.Color(0, 0, 0));
textPane.setEnabled(false);
textPane.setText("To ilosc tekstu decyduje o rozmiarze jTextPane");
//PONIŻSZE DWA SPOSOBY NIE DZIAŁAJĄ!
//textPane.setSize(300, 400);
//textPane.setBounds(10,10,300,400);
add(textPane);
}
public void paintComponent(Graphics g) {
super.paintComponent(g);
}
}