Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/08/2011, 11:55
DIABRA
 
Fecha de Ingreso: marzo-2008
Mensajes: 2
Antigüedad: 16 años, 1 mes
Puntos: 0
JEditorPane Swing

Necesito que al ingresar un texto en un JEditorPane este "crezca" horizontalmente con el contenido incluso si llega al limite de la caja de texto, la cosa es que el jeditorpane esta dentro de un cuadro que tiene barras de desplazamiento, pero la horizontal esta de adorno. Es muy importante que crezca horizontalmente. Aqui les dejo el codigo de ejemplo para que puedan utilizarlo. Cuidense

Código:
/**
 *
 * @author bacata
 */
public class ProblemJEditorPane extends javax.swing.JFrame {
    private javax.swing.JEditorPane jEditorPane1;
    private javax.swing.JScrollPane jScrollPane1;

    public ProblemJEditorPane() {
        initComponents();
    }

    private void initComponents() {
        jScrollPane1 = new javax.swing.JScrollPane();
        jEditorPane1 = new javax.swing.JEditorPane();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setLayout(null);

        jScrollPane1.setViewportView(jEditorPane1);

        getContentPane().add(jScrollPane1);
        jScrollPane1.setBounds(20, 20, 120, 70);

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-175)/2, (screenSize.height-135)/2, 175, 135);
    }

    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new ProblemJEditorPane().setVisible(true);
            }
        });
    }

}