Project

General

Profile

Actions

Bug #5587

closed

long parameter values get replaced with scrollbar

Added by Daniel Crawl over 12 years ago. Updated over 12 years ago.

Status:
Resolved
Priority:
Normal
Category:
interface
Target version:
Start date:
04/16/2012
Due date:
% Done:

0%

Estimated time:
Bugzilla-Id:
5587

Description

In the actor parameters dialog, if a parameter value has more characters than can fit in the text box, the text box is replaced with a scrollbar.


Files

scrollbar.png (41.5 KB) scrollbar.png Daniel Crawl, 06/11/2012 10:38 AM
Actions #1

Updated by Christopher Brooks over 12 years ago

I'm not sure what the bug is here, could you post a screenshot and/or a detailed description of how to replicate the issue?

Actions #2

Updated by Daniel Crawl over 12 years ago

To reproduce:

1. add actor to canvas
2. double click on actor to open actor parameters dialog
3. in one of the parameter value text boxes, insert characters until there's too many to fit in the box

Actions #4

Updated by Daniel Crawl over 12 years ago

I just checked, and this is still a problem. I added a screen shot.

Actions #5

Updated by Daniel Crawl over 12 years ago

Patricia fixed in r63735.

Actions #6

Updated by Daniel Crawl over 12 years ago

I'm reopening since this is occurring again. The steps in comment 2 will demonstrate the problem. I verified again that r63735 fixed the problem, so the regression has happened since then.

Actions #7

Updated by Christopher Brooks over 12 years ago

The problem is that JTextArea should not be used when there is just a single
line and no scroll bar.

http://docs.oracle.com/javase/tutorial/uiswing/components/textarea.html
says:
"If you need to obtain only one line of input from the user, you should use a text field."

It seems like part of the problem is that the JTextArea gets a scrollbar and wants more screen real estate, but the GridBagLayout in ptolemy.gui.Query
is not giving it space.

I'll look into this, but I'm not confident.

Actions #8

Updated by Christopher Brooks over 12 years ago

This is fixed.
I added code to Query:

protected static void _textAreaSetRowsAndRepackParent(JTextArea textArea,
int minimumNumberOfRows) {
// This method is based on code by Patricia Derler that was
// originally in PtolemyQuery.
// One test for this is to drag in a StringConst and type in              
// lots of characters. You should get a scrollbar. See
// http://bugzilla.ecoinformatics.org/show_bug.cgi?id=5587
if (textArea.getRows() < minimumNumberOfRows) {
textArea.setRows(textArea.getRows() + 1);
textArea.revalidate();
Component parent = textArea.getParent();
while ((parent != null) && !(parent instanceof ComponentDialog)) {
parent = parent.getParent();
}
if (parent instanceof ComponentDialog) {
ComponentDialog dialog = (ComponentDialog) parent;
dialog.doLayout();
dialog.pack();
}
}
}

This is based on code by Patricia that was in PtolemyQuery.
Now PtolemyQuery calls this method as well.

Actions #9

Updated by Redmine Admin almost 12 years ago

Original Bugzilla ID was 5587

Actions

Also available in: Atom PDF