Example usage for javax.swing JTextArea getColumns

List of usage examples for javax.swing JTextArea getColumns

Introduction

In this page you can find the example usage for javax.swing JTextArea getColumns.

Prototype

public int getColumns() 

Source Link

Document

Returns the number of columns in the TextArea.

Usage

From source file:org.pentaho.reporting.engine.classic.core.modules.gui.base.parameters.TextAreaParameterComponentTest.java

@Before
public void setUp() {
    ParameterDefinitionEntry entry = mock(ParameterDefinitionEntry.class);
    ParameterContext parameterContext = mock(ParameterContext.class);
    updateContext = mock(ParameterUpdateContext.class);
    ResourceBundleFactory resourceBundleFactory = mock(ResourceBundleFactory.class);
    Locale locale = new Locale("test_test");

    doReturn(ENTRY_NAME).when(entry).getName();
    doReturn(Number.class).when(entry).getValueType();
    doReturn("#,###,##0.00").when(entry).getParameterAttribute(ParameterAttributeNames.Core.NAMESPACE,
            ParameterAttributeNames.Core.DATA_FORMAT, parameterContext);
    doReturn("#,###,##0.00").when(entry).getTranslatedParameterAttribute(ParameterAttributeNames.Core.NAMESPACE,
            ParameterAttributeNames.Core.DATA_FORMAT, parameterContext);
    doReturn("utc").when(entry).getParameterAttribute(ParameterAttributeNames.Core.NAMESPACE,
            ParameterAttributeNames.Core.TIMEZONE, parameterContext);

    doReturn(resourceBundleFactory).when(parameterContext).getResourceBundleFactory();
    doReturn(locale).when(resourceBundleFactory).getLocale();
    doReturn(TimeZone.getDefault()).when(resourceBundleFactory).getTimeZone();

    comp = new TextAreaParameterComponent(entry, parameterContext, updateContext);

    verify(updateContext).addChangeListener(any(ChangeListener.class));
    JTextArea textArea = findTextArea(comp);
    assertThat(textArea, is(notNullValue()));
    assertThat(textArea.getColumns(), is(equalTo(60)));
    assertThat(textArea.getRows(), is(equalTo(10)));
}