LanguageTextField Background scrambles when scrolling

Planned

This is main code:

@Override
public void componentResized(ComponentEvent componentEvent) {
EditorEx editor = (EditorEx) this.editorPane.getEditor();
if (editor != null) {
editor.setHorizontalScrollbarVisible(true);
editor.setVerticalScrollbarVisible(true);
EditorSettings editorSettings = editor.getSettings();
if (!editorSettings.isLineNumbersShown()) editorSettings.setLineNumbersShown(true);
if (!editorSettings.isFoldingOutlineShown()) editorSettings.setFoldingOutlineShown(true);
}
}

Normal background:

 

Unusual background:

Scrolling will trigger this exception

 

8 comments
Comment actions Permalink

Sorry, but I'm not sure what exactly your problem is.

0
Comment actions Permalink

@Jakub Chrzanowski 

Please pay attention to the background picture, the second screenshot is obviously messy

0
Comment actions Permalink

Is this custom background your plugin's implementation? Which class do you extend? Is there any parent methods that you may call in componentResized?

0
Comment actions Permalink

 

来自的背景图片:

My more code:

private JPanel templateDataPanel;
private LanguageTextField editorPane;
this.editorPane = new LanguageTextField(JsonLanguage.INSTANCE, project, "{}", false);
this.editorPane.addComponentListener(new EventHandler(this.editorPane));
this.templateDataPanel.add(this.editorPane);
static class EventHandler implements ComponentListener {
private LanguageTextField editorPane;

public EventHandler(LanguageTextField editorPane) {
this.editorPane = editorPane;
}

@Override
public void componentResized(ComponentEvent componentEvent) {
EditorEx editor = (EditorEx) this.editorPane.getEditor();
if (editor != null) {
editor.setHorizontalScrollbarVisible(true);
editor.setVerticalScrollbarVisible(true);
EditorSettings editorSettings = editor.getSettings();
if (!editorSettings.isLineNumbersShown()) editorSettings.setLineNumbersShown(true);
if (!editorSettings.isFoldingOutlineShown()) editorSettings.setFoldingOutlineShown(true);
}
}

@Override
public void componentMoved(ComponentEvent componentEvent) {

}

@Override
public void componentShown(ComponentEvent componentEvent) {


}

@Override
public void componentHidden(ComponentEvent componentEvent) {

}
}

 

0
Comment actions Permalink

Added: Only appear in independent window, it is normal to dock on the right.

0
Comment actions Permalink

Hello, official staff, do you guys deal with this problem now? Or I do n’t provide enough information, you did n’t locate the error, I ’m happy to add more details

0
Comment actions Permalink

Cannot reproduce the problem, it just works for me.

0

Please sign in to leave a comment.