Hi I am creating a simple Java-Server chat and I simply cannot get swing to play nice with long strings.
.
I don't want the horizontal scroll bar and I want the word to break when needed and flow to another line.
The code I have used to create the JTextPane is:
super("Message Server");
userText = new JTextField();
userText.setEditable(false);
userText.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event){
sendMessage(event.getActionCommand());
userText.setText("");
}
}
);
getContentPane().add(userText, BorderLayout.SOUTH);
chatWindow = new JTextPane();
JScrollPane scrollPane = new JScrollPane(chatWindow);
getContentPane().add(scrollPane);
setSize(300, 450); //Sets the window size
setVisible(true);
chatWindow.setEditable(false);