Barra de rolagem

1 resposta
albjava

Tenho esse codigo e preciso que tenha barra de rolagem em minhas textareas...como faço?

Obrigado

package id.IGrafica;

import java.awt.*;
import javax.swing.JTextArea;
import java.awt.Rectangle;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import java.awt.Dimension;

public class IGrafica extends Frame {
    
    private ImageIcon gifEscalonador; 
    
    public IGrafica() {
        try {
            jbInit();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    private void jbInit() throws Exception {
        this.setLayout(gridBagLayout1);
        gifEscalonador = new ImageIcon("logo.gif");
        Logs.setText("Logs");
        jLabel1.setText("Fila de Prontos");
        jLabel2.setText("Fila de Bloqueados");
        this.setMinimumSize(new Dimension(700, 700));
        figura.setLayout(null);
        this.add(logs, new GridBagConstraints(0, 5, 2, 1, 1.0, 1.0
                                              , GridBagConstraints.CENTER,
                                              GridBagConstraints.BOTH,
                                              new Insets(8, 7, 3, 17), 376, 117));
        this.add(Logs, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0
                                              , GridBagConstraints.WEST,
                                              GridBagConstraints.NONE,
                                              new Insets(0, 23, 0, 127), 12, 0));
        this.add(figura, new GridBagConstraints(0, 3, 2, 1, 1.0, 1.0
                                                , GridBagConstraints.CENTER,
                                                GridBagConstraints.BOTH,
                                                new Insets(0, 7, 0, 17), 356,
                                                91));
        this.add(listaProcesso, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0
                , GridBagConstraints.CENTER, GridBagConstraints.BOTH,
                new Insets(6, 7, 0, 0), 174, 170));
        this.add(listaBloq, new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0
                , GridBagConstraints.CENTER, GridBagConstraints.BOTH,
                new Insets(0, 34, 0, 17), 161, 172));
        this.add(jLabel2, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0
                                                 , GridBagConstraints.WEST,
                                                 GridBagConstraints.NONE,
                                                 new Insets(20, 41, 0, 77), 4,
                                                 0));
        this.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
                                                 , GridBagConstraints.WEST,
                                                 GridBagConstraints.NONE,
                                                 new Insets(20, 14, 0, 76), 23,
                                                 0));
       

    }

    JTextArea listaProcesso = new JTextArea();
    JTextArea listaBloq = new JTextArea();
    JPanel figura = new JPanel();
    JTextArea logs = new JTextArea();
    JLabel Logs = new JLabel();
    JLabel jLabel1 = new JLabel();
    JLabel jLabel2 = new JLabel();
    GridBagLayout gridBagLayout1 = new GridBagLayout();
   ;
    
   

    /*public void insereFig(Graphics g)
    {
        gifEscalonador.paintIcon(this,g,180,0);
    }*/
    
    public void showLogsUser(String logs)
    {
        this.logs.setText(this.logs.getText() +"\n"+ logs);
        
    }
    
    public void showListaProntos(String processo)
    {
        this.listaProcesso.setText(this.listaProcesso.getText() +"\n"+ processo);
    }
    
    public void showListaBloq(String processo)
   {
       this.listaBloq.setText(this.listaBloq.getText() +"\n"+ processo);
   }



}

1 Resposta

cassio

algo do tipo:

JTextArea textArea = new JTextArea();
JScrollPane scrollPane = new JScrollPane(textArea);

O JScrollPane é um pane com barras de rolagem horizontal e vertical…

Abraço!

Criado 12 de setembro de 2006
Ultima resposta 12 de set. de 2006
Respostas 1
Participantes 2