Results 1 to 3 of 3
  1. #1
    maaaaarco is offline Member
    Join Date
    Nov 2011
    Posts
    9
    Rep Power
    0

    Default How to have a text area that expands automatically

    hi all,
    forgive me now for my bad English XD, i have a little problem and i hope you could help me .

    This is my code
    Java Code:
    public class NuovoEvento {
        private JFrame frame;
        private JTextField nome_evento,nome_regione;
        private JTextArea descrizione_evento;
        private JButton bottone_avanti,bottone_indietro,bottone_esci;
        private JLabel lab_nome,lab_desc,lab_reg;
        private JPanel pannello;
    
        public NuovoEvento () {
            frame=new JFrame("Nuovo Evento");
            frame.setLayout(new GridLayout(0, 2));
            frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
            frame.setLocation(400, 300);
    
            lab_desc=new JLabel("Descrivi l' evento: ");
            lab_nome=new JLabel("Nome dell' evento: ");
            lab_reg=new JLabel("In che regione si tiene l' evento ? ");
    
            nome_evento=new JTextField();
            nome_regione=new JTextField();
            descrizione_evento=new JTextArea();
    
            bottone_avanti=new JButton("Avanti");
            bottone_indietro=new JButton("Indietro");
            bottone_esci=new JButton("Esci");
    
            pannello=new JPanel();
    
            pannello.add(bottone_avanti);
            pannello.add(bottone_indietro);
            pannello.add(bottone_esci);
    
            frame.add(lab_nome);
            frame.add(nome_evento);
            frame.add(lab_reg);
            frame.add(nome_regione);
            frame.add(lab_desc);
            frame.add(descrizione_evento);
            frame.add(pannello);
    
            frame.pack();
            frame.setVisible(true);
        }
    }
    The problem is this:
    I need that when i write in the JTextArea descrizione_evento a scroll-bar appear to let me see what i have written. I don't want that the frame expands too, only the TextArea.

    I hope i have explained myself correctly
    Thanking you in advance !
    Marco
    Last edited by maaaaarco; 11-06-2011 at 04:11 PM.

  2. #2
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,227
    Rep Power
    6

  3. #3
    maaaaarco is offline Member
    Join Date
    Nov 2011
    Posts
    9
    Rep Power
    0

    Default Re: How to have a text area that expands automatically

    Exactly what i wanted ! Thanks very much camickr !

Similar Threads

  1. Replies: 8
    Last Post: 07-17-2011, 02:38 PM
  2. Text Area
    By pabloma2002 in forum CLDC and MIDP
    Replies: 1
    Last Post: 02-11-2011, 04:56 PM
  3. Replies: 0
    Last Post: 12-09-2010, 05:56 PM
  4. Replies: 0
    Last Post: 09-28-2010, 09:52 AM
  5. eol in text area....
    By Nicholas Jordan in forum Networking
    Replies: 0
    Last Post: 09-14-2008, 10:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •