sun.swing.SwingAccessor Java Examples

The following examples show how to use sun.swing.SwingAccessor. 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 File: bug6456844.java    From openjdk-jdk9 with 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 File: bug6456844.java    From TencentKona-8 with 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 File: bug6456844.java    From jdk8u-jdk with 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 File: bug6456844.java    From jdk8u60 with 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
Source File: bug6456844.java    From dragonwell8_jdk with 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 #6
Source File: bug6456844.java    From jdk8u-dev-jdk with 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 #7
Source File: bug6456844.java    From jdk8u_jdk with 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 #8
Source File: bug6456844.java    From openjdk-jdk8u with 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 #9
Source File: bug6456844.java    From openjdk-8 with 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 File: bug6456844.java    From openjdk-jdk8u-backup with 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 File: AWTKeyStroke.java    From Bytecoder with 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 #12
Source File: bug6456844.java    From openjdk-8-source with 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 File: AWTKeyStroke.java    From openjdk-jdk9 with 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 #14
Source File: bug6456844.java    From hottub with 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 File: bug6456844.java    From jdk8u-jdk with 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 File: ScreenPopupFactory.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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 #17
Source File: LWLightweightFramePeer.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void updateCursorImmediately() {
    SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
}
 
Example #18
Source File: WLightweightFramePeer.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void updateCursorImmediately() {
    SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
}
 
Example #19
Source File: LWLightweightFramePeer.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void updateCursorImmediately() {
    SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
}
 
Example #20
Source File: LWLightweightFramePeer.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void updateCursorImmediately() {
    SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
}
 
Example #21
Source File: XLightweightFramePeer.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void updateCursorImmediately() {
    SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
}
 
Example #22
Source File: WLightweightFramePeer.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void updateCursorImmediately() {
    SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
}
 
Example #23
Source File: XLightweightFramePeer.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void updateCursorImmediately() {
    SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
}
 
Example #24
Source File: WLightweightFramePeer.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void updateCursorImmediately() {
    SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
}
 
Example #25
Source File: LWLightweightFramePeer.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void updateCursorImmediately() {
    SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
}
 
Example #26
Source File: XLightweightFramePeer.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void updateCursorImmediately() {
    SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
}
 
Example #27
Source File: XLightweightFramePeer.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void updateCursorImmediately() {
    SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
}
 
Example #28
Source File: WLightweightFramePeer.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void updateCursorImmediately() {
    SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
}
 
Example #29
Source File: LWLightweightFramePeer.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void updateCursorImmediately() {
    SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
}
 
Example #30
Source File: XLightweightFramePeer.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void updateCursorImmediately() {
    SwingAccessor.getJLightweightFrameAccessor().updateCursor((JLightweightFrame)getLwTarget());
}