Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for scrollbars in TextAreas #114

Closed
wants to merge 1 commit into from

Conversation

LauLauThom
Copy link

Add a new method signature addTextAreas(String text1, String text2, int rows, int columns, int scrollbars) to the GenericDialog class, which allows adding scrollbars to the TextAreas.

The former addTextAreas(String text1, String text2, int rows, int columns) will call the default NO_SCROLLBARS for backward compatibility.

I have some plugins with these kind of text area to paste a custom macro code, which can be a bit lengthy.
Currently browsing the code is via the up/down arrows only, this would add support for scrolling with the mouse.

Example in jython

from ij.gui import GenericDialog
from java.awt import TextArea

dialog = GenericDialog("Test") 
dialog.addTextAreas("Some input", "Test", 10, 20, TextArea.SCROLLBARS_VERTICAL_ONLY)
dialog.showDialog()

Huge image sorry..
image

@LauLauThom
Copy link
Author

Hello Wayne @rasband,
Any thoughts about this possible contribution ?

@rasband
Copy link
Member

rasband commented Apr 14, 2021

The ImageJ 1.53j21 daily build adds support for scrollbars in TextAreas. Append "SCROLLBARS_VERTICAL_ONLY" to the default text of the first TextArea to get vertical scrollbars and "SCROLLBARS_BOTH" to get both vertical and horizontal scrollbars. Here is a JavaScript example:

dialog = new GenericDialog("Test") 
text1 =  "Some input" + "SCROLLBARS_VERTICAL_ONLY"
text2 = "test"
dialog.addTextAreas(text1, text2, 10, 20)
dialog.showDialog()

@rasband rasband closed this Apr 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants