Package java.awt.im

Examples of java.awt.im.InputMethodRequests


                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));
View Full Code Here


     * Positions the composition window near (usually below) the
     * insertion point in the client component if the client
     * component is an active client (below-the-spot input).
     */
    void updateWindowLocation() {
        InputMethodRequests req = handler.getClientInputMethodRequests();
        if (req == null) {
            // not an active client
            return;
        }

        Point windowLocation = new Point();

        Rectangle caretRect = req.getTextLocation(null);
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension windowSize = compositionWindow.getSize();
        final int SPACING = 2;

        if (caretRect.x + windowSize.width > screenSize.width) {
View Full Code Here

                compositionArea.setHandlerInfo(compositionAreaOwner, inputMethodContext);
            }
            // If the client component is an active client using below-the-spot style, then
            // make the composition window undecorated without a title bar.
            if(clientComponent!=null){
                InputMethodRequests req = clientComponent.getInputMethodRequests();
                if (req != null && inputMethodContext.useBelowTheSpotInput()) {
                    setCompositionAreaUndecorated(true);
                }
            }
        }
View Full Code Here

                return compositionArea.getTextLocation(offset);
            } else if (composedText != null) {
                // there's composed text, but it's not displayed, so fake a rectangle
                return new Rectangle(0, 0, 0, 10);
            } else {
                InputMethodRequests requests = getClientInputMethodRequests();
                if (requests != null) {
                    return requests.getTextLocation(offset);
                } else {
                    // passive client, no composed text, so fake a rectangle
                    return new Rectangle(0, 0, 0, 10);
                }
            }
View Full Code Here

            }
        }
    }

    public int getInsertPositionOffset() {
        InputMethodRequests req = getClientInputMethodRequests();
        if (req != null) {
            return req.getInsertPositionOffset();
        }

        // we don't have access to the client component's text.
        return 0;
    }
View Full Code Here

            (new AttributedString("")).getIterator();

    public AttributedCharacterIterator getCommittedText(int beginIndex,
                                                       int endIndex,
                                                       Attribute[] attributes) {
        InputMethodRequests req = getClientInputMethodRequests();
        if(req != null) {
            return req.getCommittedText(beginIndex, endIndex, attributes);
        }

        // we don't have access to the client component's text.
        return EMPTY_TEXT;
    }
View Full Code Here

        // we don't have access to the client component's text.
        return EMPTY_TEXT;
    }

    public int getCommittedTextLength() {
        InputMethodRequests req = getClientInputMethodRequests();
        if(req != null) {
            return req.getCommittedTextLength();
        }

        // we don't have access to the client component's text.
        return 0;
    }
View Full Code Here

        return 0;
    }


    public AttributedCharacterIterator cancelLatestCommittedText(Attribute[] attributes) {
        InputMethodRequests req = getClientInputMethodRequests();
        if(req != null) {
            return req.cancelLatestCommittedText(attributes);
        }

        // we don't have access to the client component's text.
        return null;
    }
View Full Code Here

        // we don't have access to the client component's text.
        return null;
    }

    public AttributedCharacterIterator getSelectedText(Attribute[] attributes) {
        InputMethodRequests req = getClientInputMethodRequests();
        if(req != null) {
            return req.getSelectedText(attributes);
        }

        // we don't have access to the client component's text.
        return EMPTY_TEXT;
    }
View Full Code Here

                // If the client component is an active client with the below-the-spot
                // input style, then make the composition window undecorated without a title bar.
                InputMethodContext inputContext = ((InputMethodContext)this);
                if (!inputContext.isCompositionAreaVisible()) {
                      InputMethodRequests req = source.getInputMethodRequests();
                      if (req != null && inputContext.useBelowTheSpotInput()) {
                          inputContext.setCompositionAreaUndecorated(true);
                      } else {
                          inputContext.setCompositionAreaUndecorated(false);
                      }
View Full Code Here

TOP

Related Classes of java.awt.im.InputMethodRequests

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.