Rectangle2D maxCharBoundsRec = metrics.getMaxCharBounds(g);
int newHeight = (int)maxCharBoundsRec.getHeight() + HEIGHT_MARGIN;
int newFrameHeight = newHeight +compositionWindow.getInsets().top
+compositionWindow.getInsets().bottom;
// If it's a passive client, set the width always to PASSIVE_WIDTH (480px)
InputMethodRequests req = handler.getClientInputMethodRequests();
int newWidth = (req==null) ? PASSIVE_WIDTH : (int)bounds.getWidth() + WIDTH_MARGIN;
int newFrameWidth = newWidth + compositionWindow.getInsets().left
+ compositionWindow.getInsets().right;
setPreferredSize(new Dimension(newWidth, newHeight));
compositionWindow.setSize(new Dimension(newFrameWidth, newFrameHeight));