Here you can find the source of isSelectionUpperCase(JTextComponent textPane)
public static boolean isSelectionUpperCase(JTextComponent textPane)
//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; } }