Java 6 - Table Filter Swing  XML
Índice dos Fóruns » Interface Gráfica
Autor Mensagem
marcioa1
Virtual Machine Man
[Avatar]

Membro desde: 29/11/2003 12:52:10
Mensagens: 736
Localização: Valinhos-SP
Offline

Olá,

Implantei o seguinte table Filter :


Ele tem dois problemas. Primeiro, ele é aplicado sobre toda a tabela, e gostaria que fosse aplicado somente a uma determinada coluna.
segundo, "m" é diferente de "M", e gostaria que não fosse.

Obrigado,

Márcio

SCJP 1.4,
[Email]
thingol
Moderador

Membro desde: 29/07/2004 16:10:13
Mensagens: 17543
Offline


public static <M,I> RowFilter<M,I> regexFilter(String regex,
int... indices)

Returns a RowFilter that uses a regular expression to determine which entries to include. Only entries with at least one matching value are included. For example, the following creates a RowFilter that includes entries with at least one value starting with "a":

RowFilter.regexFilter("^a";


The returned filter uses Matcher.find() to test for inclusion. To test for exact matches use the characters '^' and '$' to match the beginning and end of the string respectively. For example, "^foo$" includes only rows whose string is exactly "foo" and not, for example, "food". See Pattern for a complete description of the supported regular-expression constructs.

Parameters:
regex - the regular expression to filter on
indices - the indices of the values to check. If not supplied all values are evaluated


a) Ponha "(?i)" no começo de sua expressão regular para que ela ignore a diferença entre minúsculas e maiúsculas. Exemplo: "marcio" -> "(?i)marcio"

b) Você tem de incluir os índices dos valores a serem checados.
[WWW]
marcioa1
Virtual Machine Man
[Avatar]

Membro desde: 29/11/2003 12:52:10
Mensagens: 736
Localização: Valinhos-SP
Offline

thingol,

Valeu a resposta. Funcionou.

Obrigado

Márcio

SCJP 1.4,
[Email]
 
Índice dos Fóruns » Interface Gráfica
Ir para:   
Powered by JForum 2.1.8 © JForum Team