g.drawString(displayText, ta.getX() + x + style.getPadding(Component.LEFT),
ta.getY() + style.getPadding(Component.TOP));
String inputMode = ta.getInputMode();
int inputModeWidth = f.stringWidth(inputMode);
if (ta.handlesInput() && ta.getWidth() / 2 > inputModeWidth) {
int drawXPos = ta.getX() + style.getPadding(Component.LEFT);
if (xPos < ta.getWidth() / 2) {
// draw on the right side
drawXPos = drawXPos + ta.getWidth() - inputModeWidth - style.getPadding(Component.RIGHT) - style.getPadding(Component.LEFT);