Rsyntax text area bug. #133

Closed
gabriel-laddel opened this Issue Apr 18, 2013 · 6 comments

Comments

Projects
None yet
3 participants
Owner

daveray commented Apr 18, 2013

That's fun. Wrapping it in (scrollable (text-area ...)) works around it. My guess is it's a RSyntax bug. I'll see if I can reproduce it in Java to be sure.

Owner

daveray commented Apr 18, 2013

Yep. This is an RSyntax bug. Here's a vey simple, pure Java example that reproduces it. Maybe report a bug to fifesoft?

package seesaw133;

import java.awt.BorderLayout;

import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;

import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;

public class Seesaw133 {

    public static void run() {
        final JPanel bp = new JPanel(new BorderLayout());
        final JPanel vp = new JPanel();
        vp.setLayout(new BoxLayout(vp, BoxLayout.Y_AXIS));

        vp.add(new JLabel("This is a label"));
        vp.add(new RSyntaxTextArea());

        bp.add(vp, BorderLayout.CENTER);
        final JFrame f = new JFrame("Seesaw133");
        f.setContentPane(bp);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setVisible(true);
    }

    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {

            @Override
            public void run() {
                Seesaw133.run();
            }
        });
    }
}
Owner

daveray commented Apr 19, 2013

Thanks.

For anyone who runs into this same issue, you can use a border-panel in place of the vertical-panel as a workaround.

Hi, I'm the maintainer of RSyntaxTextArea.

Just an FYI that this is not a bug, but rather a case of funky behavior with BoxLayout. The same behavior can be seen in your sample if you replace RSyntaxTextArea entirely with JTextArea.

I suggest putting the JLabel in a JPanel with BorderLayout, at BorderLayout.LINE_START, to force left-aligning of the label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment