Here you can find the source of formatToolBarDisplay(String text, int size)
public static String formatToolBarDisplay(String text, int size)
//package com.java2s; //License from project: Apache License public class Main { public static String formatToolBarDisplay(String text, int size) { if (text.equals("-1")) { text = "Mixed"; }//from w w w . ja v a 2 s. c o m int textSize = text.length(); int rem = size - textSize; if (rem > 0) { int newSize = rem / 2; for (int i = 0; i < newSize; i++) { text = text + " "; } text = " " + text; } return text; } }