Então pessoal, não consigo de jeito algum, colocar o scroll no JTextArea, me ajudem por favor.
Abraço e segue meu code.
[code]import java.awt.Color;
import javax.swing.JButton;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
public class TestInterface {
private static JFrame frame;
private static JButton envia;
private static JTextArea box;
private static JTextArea outbox;
private static JScrollPane scrollpane;
private static JDesktopPane painel;
private static JPanel panel;
private static JLabel comandos;
private static JLabel msgprivate;
private static JLabel onlines;
private static JLabel help;
private static JLabel quit;
private static JLabel name;
public TestInterface(){
frame = new JFrame("Client");
frame.setSize(470,400);
//labels
comandos = new JLabel("Comandos:");
comandos.setBounds(315, 5, 100, 20);
comandos.setForeground(Color.GRAY);
msgprivate = new JLabel("/pvt *rementente* msg");
msgprivate.setBounds(320,28,170,20);
msgprivate.setForeground(Color.pink);
onlines = new JLabel("/ons");
onlines.setBounds(320,45,100,20);
onlines.setForeground(Color.pink);
help = new JLabel("/help");
help.setBounds(320,62,100,20);
help.setForeground(Color.pink);
quit = new JLabel("/quit");
quit.setBounds(320,79,100,20);
quit.setForeground(Color.pink);
name = new JLabel("/name *novonome*");
name.setBounds(320,96,150,20);
name.setForeground(Color.pink);
//caixas de texto
box = new JTextArea("Digite aqui, seu bobinho !");
box.setBounds(5, 295, 440, 60);
outbox = new JTextArea();
outbox.setBounds(20, 20, 300, 270);
outbox.setLineWrap(true);
scrollpane = new JScrollPane(outbox);
scrollpane.setViewportView(outbox);
scrollpane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
scrollpane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
scrollpane.setSize(100, 100);
scrollpane.setLocation(20, 20);
scrollpane.setVisible(true);
painel = new JDesktopPane();
painel.setBackground(Color.black);
painel.add(box);
painel.add(scrollpane);
painel.add(comandos);
painel.add(msgprivate);
painel.add(onlines);
painel.add(help);
painel.add(quit);
painel.add(name);
frame.setContentPane(painel);
frame.setResizable(false);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
public static void main(String[] args) {
TestInterface bla = new TestInterface();
}
}
[/code]