Java Code Examples for sun.swing.SwingAccessor

The following examples show how to use sun.swing.SwingAccessor. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: dragonwell8_jdk   Source File: bug6456844.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    JEditorPane ep = new JEditorPane();
    ep.setContentType("text/html");
    ep.setText("<html><body>abc</body></html>");
    ep.setBorder(new EmptyBorder(20, 20, 20, 20));
    ep.setBounds(0, 0, 100, 100);

    JTextComponent.DropLocation location =
            (JTextComponent.DropLocation) SwingAccessor.getJTextComponentAccessor().dropLocationForPoint(ep,
                    new Point(0, 0));

    if (location.getBias() == null) {
        throw new RuntimeException("null bias");
    }
}
 
Example 2
Source Project: TencentKona-8   Source File: bug6456844.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    JEditorPane ep = new JEditorPane();
    ep.setContentType("text/html");
    ep.setText("<html><body>abc</body></html>");
    ep.setBorder(new EmptyBorder(20, 20, 20, 20));
    ep.setBounds(0, 0, 100, 100);

    JTextComponent.DropLocation location =
            (JTextComponent.DropLocation) SwingAccessor.getJTextComponentAccessor().dropLocationForPoint(ep,
                    new Point(0, 0));

    if (location.getBias() == null) {
        throw new RuntimeException("null bias");
    }
}
 
Example 3
Source Project: jdk8u60   Source File: bug6456844.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    JEditorPane ep = new JEditorPane();
    ep.setContentType("text/html");
    ep.setText("<html><body>abc</body></html>");
    ep.setBorder(new EmptyBorder(20, 20, 20, 20));
    ep.setBounds(0, 0, 100, 100);

    JTextComponent.DropLocation location =
            (JTextComponent.DropLocation) SwingAccessor.getJTextComponentAccessor().dropLocationForPoint(ep,
                    new Point(0, 0));

    if (location.getBias() == null) {
        throw new RuntimeException("null bias");
    }
}
 
Example 4
Source Project: openjdk-jdk8u   Source File: bug6456844.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    JEditorPane ep = new JEditorPane();
    ep.setContentType("text/html");
    ep.setText("<html><body>abc</body></html>");
    ep.setBorder(new EmptyBorder(20, 20, 20, 20));
    ep.setBounds(0, 0, 100, 100);

    JTextComponent.DropLocation location =
            (JTextComponent.DropLocation) SwingAccessor.getJTextComponentAccessor().dropLocationForPoint(ep,
                    new Point(0, 0));

    if (location.getBias() == null) {
        throw new RuntimeException("null bias");
    }
}
 
Example 5
public static void main(String[] args) {
    JEditorPane ep = new JEditorPane();
    ep.setContentType("text/html");
    ep.setText("<html><body>abc</body></html>");
    ep.setBorder(new EmptyBorder(20, 20, 20, 20));
    ep.setBounds(0, 0, 100, 100);

    JTextComponent.DropLocation location =
            (JTextComponent.DropLocation) SwingAccessor.getJTextComponentAccessor().dropLocationForPoint(ep,
                    new Point(0, 0));

    if (location.getBias() == null) {
        throw new RuntimeException("null bias");
    }
}
 
Example 6
Source Project: Bytecoder   Source File: AWTKeyStroke.java    License: Apache License 2.0 5 votes vote down vote up
private static synchronized AWTKeyStroke getCachedStroke
    (char keyChar, int keyCode, int modifiers, boolean onKeyRelease)
{
    @SuppressWarnings("unchecked")
    Map<AWTKeyStroke, AWTKeyStroke> cache = (Map)AppContext.getAppContext().get(APP_CONTEXT_CACHE_KEY);
    AWTKeyStroke cacheKey = (AWTKeyStroke)AppContext.getAppContext().get(APP_CONTEXT_KEYSTROKE_KEY);

    if (cache == null) {
        cache = new HashMap<>();
        AppContext.getAppContext().put(APP_CONTEXT_CACHE_KEY, cache);
    }

    if (cacheKey == null) {
        cacheKey = SwingAccessor.getKeyStrokeAccessor().create();
        AppContext.getAppContext().put(APP_CONTEXT_KEYSTROKE_KEY, cacheKey);
    }

    cacheKey.keyChar = keyChar;
    cacheKey.keyCode = keyCode;
    cacheKey.modifiers = mapNewModifiers(mapOldModifiers(modifiers));
    cacheKey.onKeyRelease = onKeyRelease;

    AWTKeyStroke stroke = cache.get(cacheKey);
    if (stroke == null) {
        stroke = cacheKey;
        cache.put(stroke, stroke);
        AppContext.getAppContext().remove(APP_CONTEXT_KEYSTROKE_KEY);
    }
    return stroke;
}
 
Example 7
Source Project: openjdk-jdk9   Source File: AWTKeyStroke.java    License: GNU General Public License v2.0 5 votes vote down vote up
private static synchronized AWTKeyStroke getCachedStroke
    (char keyChar, int keyCode, int modifiers, boolean onKeyRelease)
{
    @SuppressWarnings("unchecked")
    Map<AWTKeyStroke, AWTKeyStroke> cache = (Map)AppContext.getAppContext().get(APP_CONTEXT_CACHE_KEY);
    AWTKeyStroke cacheKey = (AWTKeyStroke)AppContext.getAppContext().get(APP_CONTEXT_KEYSTROKE_KEY);

    if (cache == null) {
        cache = new HashMap<>();
        AppContext.getAppContext().put(APP_CONTEXT_CACHE_KEY, cache);
    }

    if (cacheKey == null) {
        cacheKey = SwingAccessor.getKeyStrokeAccessor().create();
        AppContext.getAppContext().put(APP_CONTEXT_KEYSTROKE_KEY, cacheKey);
    }

    cacheKey.keyChar = keyChar;
    cacheKey.keyCode = keyCode;
    cacheKey.modifiers = mapNewModifiers(mapOldModifiers(modifiers));
    cacheKey.onKeyRelease = onKeyRelease;

    AWTKeyStroke stroke = cache.get(cacheKey);
    if (stroke == null) {
        stroke = cacheKey;
        cache.put(stroke, stroke);
        AppContext.getAppContext().remove(APP_CONTEXT_KEYSTROKE_KEY);
    }
    return stroke;
}
 
Example 8
public Popup getPopup(final Component comp, final Component invoker, final int x, final int y) {
    if (invoker == null) throw new IllegalArgumentException("Popup.getPopup must be passed non-null contents");

    final Popup popup;
    if (fIsActive) {
        popup = SwingAccessor.getPopupFactoryAccessor()
                .getHeavyWeightPopup(this, comp, invoker, x, y);
    } else {
        popup = super.getPopup(comp, invoker, x, y);
    }

    // Make the popup semi-translucent if it is a heavy weight
    // see <rdar://problem/3547670> JPopupMenus have incorrect background
    final Window w = getWindow(invoker);
    if (w == null) return popup;

    if (!(w instanceof RootPaneContainer)) return popup;
    final JRootPane popupRootPane = ((RootPaneContainer)w).getRootPane();

    // we need to set every time, because PopupFactory caches the heavy weight
    // TODO: CPlatformWindow constants?
    if (fIsActive) {
        popupRootPane.putClientProperty(CPlatformWindow.WINDOW_ALPHA, TRANSLUCENT);
        popupRootPane.putClientProperty(CPlatformWindow.WINDOW_SHADOW, Boolean.TRUE);
        popupRootPane.putClientProperty(CPlatformWindow.WINDOW_FADE_DELEGATE, invoker);

        w.setBackground(UIManager.getColor("PopupMenu.translucentBackground"));
        popupRootPane.putClientProperty(CPlatformWindow.WINDOW_DRAGGABLE_BACKGROUND, Boolean.FALSE);
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                popupRootPane.putClientProperty(CPlatformWindow.WINDOW_SHADOW_REVALIDATE_NOW, Double.valueOf(Math.random()));
            }
        });
    } else {
        popupRootPane.putClientProperty(CPlatformWindow.WINDOW_ALPHA, OPAQUE);
        popupRootPane.putClientProperty(CPlatformWindow.WINDOW_SHADOW, Boolean.FALSE);
    }

    return popup;
}
 
Example 9
Source Project: openjdk-jdk9   Source File: bug6456844.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    JEditorPane ep = new JEditorPane();
    ep.setContentType("text/html");
    ep.setText("<html><body>abc</body></html>");
    ep.setBorder(new EmptyBorder(20, 20, 20, 20));
    ep.setBounds(0, 0, 100, 100);

    JTextComponent.DropLocation location =
            (JTextComponent.DropLocation) SwingAccessor.getJTextComponentAccessor().dropLocationForPoint(ep,
                    new Point(0, 0));

    if (location.getBias() == null) {
        throw new RuntimeException("null bias");
    }
}
 
Example 10
Source Project: jdk8u-jdk   Source File: bug6456844.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    JEditorPane ep = new JEditorPane();
    ep.setContentType("text/html");
    ep.setText("<html><body>abc</body></html>");
    ep.setBorder(new EmptyBorder(20, 20, 20, 20));
    ep.setBounds(0, 0, 100, 100);

    JTextComponent.DropLocation location =
            (JTextComponent.DropLocation) SwingAccessor.getJTextComponentAccessor().dropLocationForPoint(ep,
                    new Point(0, 0));

    if (location.getBias() == null) {
        throw new RuntimeException("null bias");
    }
}
 
Example 11
Source Project: hottub   Source File: bug6456844.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    JEditorPane ep = new JEditorPane();
    ep.setContentType("text/html");
    ep.setText("<html><body>abc</body></html>");
    ep.setBorder(new EmptyBorder(20, 20, 20, 20));
    ep.setBounds(0, 0, 100, 100);

    JTextComponent.DropLocation location =
            (JTextComponent.DropLocation) SwingAccessor.getJTextComponentAccessor().dropLocationForPoint(ep,
                    new Point(0, 0));

    if (location.getBias() == null) {
        throw new RuntimeException("null bias");
    }
}
 
Example 12
Source Project: openjdk-8-source   Source File: bug6456844.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    JEditorPane ep = new JEditorPane();
    ep.setContentType("text/html");
    ep.setText("<html><body>abc</body></html>");
    ep.setBorder(new EmptyBorder(20, 20, 20, 20));
    ep.setBounds(0, 0, 100, 100);

    JTextComponent.DropLocation location =
            (JTextComponent.DropLocation) SwingAccessor.getJTextComponentAccessor().dropLocationForPoint(ep,
                    new Point(0, 0));

    if (location.getBias() == null) {
        throw new RuntimeException("null bias");
    }
}
 
Example 13
Source Project: openjdk-8   Source File: bug6456844.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    JEditorPane ep = new JEditorPane();
    ep.setContentType("text/html");
    ep.setText("<html><body>abc</body></html>");
    ep.setBorder(new EmptyBorder(20, 20, 20, 20));
    ep.setBounds(0, 0, 100, 100);

    JTextComponent.DropLocation location =
            (JTextComponent.DropLocation) SwingAccessor.getJTextComponentAccessor().dropLocationForPoint(ep,
                    new Point(0, 0));

    if (location.getBias() == null) {
        throw new RuntimeException("null bias");
    }
}
 
Example 14
Source Project: jdk8u_jdk   Source File: bug6456844.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    JEditorPane ep = new JEditorPane();
    ep.setContentType("text/html");
    ep.setText("<html><body>abc</body></html>");
    ep.setBorder(new EmptyBorder(20, 20, 20, 20));
    ep.setBounds(0, 0, 100, 100);

    JTextComponent.DropLocation location =
            (JTextComponent.DropLocation) SwingAccessor.getJTextComponentAccessor().dropLocationForPoint(ep,
                    new Point(0, 0));

    if (location.getBias() == null) {
        throw new RuntimeException("null bias");
    }
}
 
Example 15
Source Project: jdk8u-jdk   Source File: bug6456844.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    JEditorPane ep = new JEditorPane();
    ep.setContentType("text/html");
    ep.setText("<html><body>abc</body></html>");
    ep.setBorder(new EmptyBorder(20, 20, 20, 20));
    ep.setBounds(0, 0, 100, 100);

    JTextComponent.DropLocation location =
            (JTextComponent.DropLocation) SwingAccessor.getJTextComponentAccessor().dropLocationForPoint(ep,
                    new Point(0, 0));

    if (location.getBias() == null) {
        throw new RuntimeException("null bias");
    }
}
 
Example 16
Source Project: jdk8u-dev-jdk   Source File: bug6456844.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) {
    JEditorPane ep = new JEditorPane();
    ep.setContentType("text/html");
    ep.setText("<html><body>abc</body></html>");
    ep.setBorder(new EmptyBorder(20, 20, 20, 20));
    ep.setBounds(0, 0, 100, 100);

    JTextComponent.DropLocation location =
            (JTextComponent.DropLocation) SwingAccessor.getJTextComponentAccessor().dropLocationForPoint(ep,
                    new Point(0, 0));

    if (location.getBias() == null) {
        throw new RuntimeException("null bias");
    }
}
 
Example 17
@Override
public void updateCursorImmediately() {
    SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
}
 
Example 18
@Override
public void updateCursorImmediately() {
    SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
}
 
Example 19
@Override
public void updateCursorImmediately() {
    SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
}
 
Example 20
@Override
public void updateCursorImmediately() {
    SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
}
 
Example 21
@Override
public void updateCursorImmediately() {
    SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
}
 
Example 22
@Override
public void updateCursorImmediately() {
    SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
}
 
Example 23
@Override
public void updateCursorImmediately() {
    SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
}
 
Example 24
@Override
public void updateCursorImmediately() {
    SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
}
 
Example 25
@Override
public void updateCursorImmediately() {
    SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
}
 
Example 26
@Override
public void updateCursorImmediately() {
    SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
}
 
Example 27
@Override
public void updateCursorImmediately() {
    SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
}
 
Example 28
@Override
public void updateCursorImmediately() {
    SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
}
 
Example 29
@Override
public void updateCursorImmediately() {
    SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
}
 
Example 30
@Override
public void updateCursorImmediately() {
    SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
}