Java JTextComponent Select isSelectionUpperCase(JTextComponent textPane)

Here you can find the source of isSelectionUpperCase(JTextComponent textPane)

Description

is Selection Upper Case

License

Apache License

Declaration

public static boolean isSelectionUpperCase(JTextComponent textPane) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import javax.swing.text.JTextComponent;

public class Main {
    public static boolean isSelectionUpperCase(JTextComponent textPane) {
        String text = textPane.getSelectedText();
        byte[] bytes = text.getBytes();

        for (int i = 0; i < bytes.length; i++) {
            if (Character.isLowerCase((char) bytes[i])) {
                return false;
            }//  ww w  . java  2 s .c o m
        }

        return true;
    }
}

Related

  1. addSelectAllTextOnFocus(final JTextComponent component)
  2. focusSelect(final JTextComponent tf)
  3. replaceSelectionAndSelect(JTextComponent component, String text)
  4. selectAll(final JTextComponent textComponent)
  5. selectAll(JTextComponent textComponent)
  6. selectAllOnFocus(JTextComponent textComponent)