Originariamente inviato da gyuseppe
ho provato a seguire il tuo consiglio...ma rimane cmq il problema che il testo rimane su un'unica riga e mi compare la scrollbar orizzontale se la finestra in larghezza è pià piccola della lunghezza del testo...cosa sbaglio?
Compila e prova:
codice:
import javax.swing.*;
public class TestFrame extends JFrame
{
public TestFrame ()
{
super ("Prova");
setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
setSize (300, 300);
JLabel label = new JLabel ("<html>Java is a programming language originally developed " +
"by Sun Microsystems and released in 1995. Java applications " +
"are typically compiled to bytecode, although compilation to " +
"native machine code is also possible. At runtime, bytecode is " +
"usually either interpreted or compiled to native code for " +
"execution, although direct hardware execution of bytecode by " +
"a Java processor is also possible.</html>");
label.setVerticalAlignment (JLabel.TOP);
add (label);
}
public static void main (String[] args)
{
SwingUtilities.invokeLater (new Runnable () {
public void run () {
TestFrame f = new TestFrame ();
f.setVisible (true);
}
});
}
}