java.awt.IllegalComponentStateException#sun.util.logging.PlatformLogger源码实例Demo

下面列出了java.awt.IllegalComponentStateException#sun.util.logging.PlatformLogger 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: hottub   文件: XErrorHandlerUtil.java
/**
 * Should be called under LOCK.
 */
public static int SAVED_XERROR_HANDLER(long display, XErrorEvent error) {
    if (saved_error_handler != 0) {
        // Default XErrorHandler may just terminate the process. Don't call it.
        // return XlibWrapper.CallErrorHandler(saved_error_handler, display, error.pData);
    }
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        log.fine("Unhandled XErrorEvent: " +
            "id=" + error.get_resourceid() + ", " +
            "serial=" + error.get_serial() + ", " +
            "ec=" + error.get_error_code() + ", " +
            "rc=" + error.get_request_code() + ", " +
            "mc=" + error.get_minor_code());
    }
    return 0;
}
 
源代码2 项目: openjdk-jdk9   文件: WComponentPeer.java
/**
 * Applies the shape to the native component window.
 * @since 1.7
 */
@Override
public void applyShape(Region shape) {
    if (shapeLog.isLoggable(PlatformLogger.Level.FINER)) {
        shapeLog.finer("*** INFO: Setting shape: PEER: " + this
                        + "; TARGET: " + target
                        + "; SHAPE: " + shape);
    }

    if (shape != null) {
        AffineTransform tx = winGraphicsConfig.getDefaultTransform();
        double scaleX = tx.getScaleX();
        double scaleY = tx.getScaleY();
        if (scaleX != 1 || scaleY != 1) {
            shape = shape.getScaledRegion(scaleX, scaleY);
        }
        setRectangularShape(shape.getLoX(), shape.getLoY(), shape.getHiX(), shape.getHiY(),
                (shape.isRectangular() ? null : shape));
    } else {
        setRectangularShape(0, 0, 0, 0, null);
    }
}
 
源代码3 项目: openjdk-jdk8u   文件: XBaseMenuWindow.java
/**
 * Removes item at the specified index from items vector.
 * @param index the position of the item to be removed
 */
public void delItem(int index) {
    synchronized(getMenuTreeLock()) {
        if (selectedIndex == index) {
            selectItem(null, false);
        } else if (selectedIndex > index) {
            selectedIndex--;
        }
        if (index < items.size()) {
            items.remove(index);
        } else {
            if (log.isLoggable(PlatformLogger.Level.FINE)) {
                log.fine("WARNING: Attempt to remove non-existing menu item, index : " + index + ", item count : " + items.size());
            }
        }
    }
    updateSize();
}
 
源代码4 项目: openjdk-jdk9   文件: XEmbedClientHelper.java
void install() {
    if (xembedLog.isLoggable(PlatformLogger.Level.FINE)) {
        xembedLog.fine("Installing xembedder on " + embedded);
    }
    long[] info = new long[] { XEMBED_VERSION, XEMBED_MAPPED };
    long data = Native.card32ToData(info);
    try {
        XEmbedInfo.setAtomData(embedded.getWindow(), data, 2);
    } finally {
        unsafe.freeMemory(data);
    }
    // XEmbeddedFrame is initially created with a null parent..
    // Here it is reparented to the proper parent window.
    long parentWindow = embedded.getParentWindowHandle();
    if (parentWindow != 0) {
        XToolkit.awtLock();
        try {
            XlibWrapper.XReparentWindow(XToolkit.getDisplay(),
                                        embedded.getWindow(),
                                        parentWindow,
                                        0, 0);
        } finally {
            XToolkit.awtUnlock();
        }
    }
}
 
源代码5 项目: openjdk-8   文件: EventQueue.java
/**
 * Called from dispatchEvent() under a correct AccessControlContext
 */
private void dispatchEventImpl(final AWTEvent event, final Object src) {
    event.isPosted = true;
    if (event instanceof ActiveEvent) {
        // This could become the sole method of dispatching in time.
        setCurrentEventAndMostRecentTimeImpl(event);
        ((ActiveEvent)event).dispatch();
    } else if (src instanceof Component) {
        ((Component)src).dispatchEvent(event);
        event.dispatched();
    } else if (src instanceof MenuComponent) {
        ((MenuComponent)src).dispatchEvent(event);
    } else if (src instanceof TrayIcon) {
        ((TrayIcon)src).dispatchEvent(event);
    } else if (src instanceof AWTAutoShutdown) {
        if (noEvents()) {
            dispatchThread.stopDispatching();
        }
    } else {
        if (eventLog.isLoggable(PlatformLogger.Level.FINE)) {
            eventLog.fine("Unable to dispatch event: " + event);
        }
    }
}
 
源代码6 项目: openjdk-8-source   文件: XEmbedCanvasPeer.java
void unregisterAccelerator(final long accel_id) {
    postEvent(new InvocationEvent(target, new Runnable() {
            public void run() {
                AWTKeyStroke stroke = null;
                synchronized(ACCEL_LOCK) {
                    stroke = accelerators.get(accel_id);
                    if (stroke != null) {
                        if (xembedLog.isLoggable(PlatformLogger.Level.FINE)) {
                            xembedLog.fine("Unregistering accelerator: " + accel_id);
                        }
                        accelerators.remove(accel_id);
                        accel_lookup.remove(stroke); // FIXME: How about several accelerators with the same stroke?
                    }
                }
                propogateUnRegisterAccelerator(stroke);
            }
        }));
}
 
源代码7 项目: jdk8u-jdk   文件: XEmbedCanvasPeer.java
void unregisterAccelerator(final long accel_id) {
    postEvent(new InvocationEvent(target, new Runnable() {
            public void run() {
                AWTKeyStroke stroke = null;
                synchronized(ACCEL_LOCK) {
                    stroke = accelerators.get(accel_id);
                    if (stroke != null) {
                        if (xembedLog.isLoggable(PlatformLogger.Level.FINE)) {
                            xembedLog.fine("Unregistering accelerator: " + accel_id);
                        }
                        accelerators.remove(accel_id);
                        accel_lookup.remove(stroke); // FIXME: How about several accelerators with the same stroke?
                    }
                }
                propogateUnRegisterAccelerator(stroke);
            }
        }));
}
 
源代码8 项目: Bytecoder   文件: HttpsClient.java
/**
 *  Same as previous constructor except using a Proxy
 */
HttpsClient(SSLSocketFactory sf, URL url, Proxy proxy,
            int connectTimeout)
    throws IOException {
    PlatformLogger logger = HttpURLConnection.getHttpLogger();
    if (logger.isLoggable(PlatformLogger.Level.FINEST)) {
         logger.finest("Creating new HttpsClient with url:" + url + " and proxy:" + proxy +
         " with connect timeout:" + connectTimeout);
    }
    this.proxy = proxy;
    setSSLSocketFactory(sf);
    this.proxyDisabled = true;

    this.host = url.getHost();
    this.url = url;
    port = url.getPort();
    if (port == -1) {
        port = getDefaultPort();
    }
    setConnectTimeout(connectTimeout);
    openServer();
}
 
源代码9 项目: jdk8u60   文件: PlatformLoggerTest.java
private static void checkLoggerLevel(PlatformLogger logger, Level level) {
    PlatformLogger.Level plevel = PlatformLogger.Level.valueOf(level.getName());
    if (plevel != logger.level()) {
        throw new RuntimeException("Retrieved PlatformLogger level "
                + logger.level()
                + " is not the same as set level " + plevel);
    }

    // check the level set in java.util.logging.Logger
    Logger javaLogger = LogManager.getLogManager().getLogger(logger.getName());
    Level javaLevel = javaLogger.getLevel();
    if (javaLogger.getLevel() != level) {
        throw new RuntimeException("Retrieved backing java.util.logging.Logger level "
                + javaLevel + " is not the expected " + level);
    }
}
 
源代码10 项目: jdk8u-jdk   文件: SourceClassName.java
private static void writeLogRecords(PrintStream logps) throws Exception {
    PrintStream err = System.err;
    try {
        System.setErr(logps);

        Object[] params = new Object[] { new Long(1), "string"};
        PlatformLogger plog = PlatformLogger.getLogger("test.log.foo");
        plog.severe("Log message {0} {1}", (Object[]) params);

        // create a java.util.logging.Logger
        // now java.util.logging.Logger should be created for each platform logger
        Logger logger = Logger.getLogger("test.log.bar");
        logger.log(Level.SEVERE, "Log message {0} {1}", params);

        plog.severe("Log message {0} {1}", (Object[]) params);
    } finally {
        logps.flush();
        logps.close();
        System.setErr(err);
    }
}
 
源代码11 项目: hottub   文件: BufferStrategyPaintManager.java
/**
 * Cleans up and removes any references.
 */
public void dispose() {
    Container root = getRoot();
    if (LOGGER.isLoggable(PlatformLogger.Level.FINER)) {
        LOGGER.finer("disposed BufferInfo for: " + root);
    }
    if (root != null) {
        root.removeComponentListener(this);
        if (root instanceof Window) {
            ((Window)root).removeWindowListener(this);
        }
        BufferStrategy bs = getBufferStrategy(false);
        if (bs != null) {
            bs.dispose();
        }
    }
    this.root = null;
    weakBS = null;
}
 
源代码12 项目: TencentKona-8   文件: EventQueue.java
/**
 * Called from dispatchEvent() under a correct AccessControlContext
 */
private void dispatchEventImpl(final AWTEvent event, final Object src) {
    event.isPosted = true;
    if (event instanceof ActiveEvent) {
        // This could become the sole method of dispatching in time.
        setCurrentEventAndMostRecentTimeImpl(event);
        ((ActiveEvent)event).dispatch();
    } else if (src instanceof Component) {
        ((Component)src).dispatchEvent(event);
        event.dispatched();
    } else if (src instanceof MenuComponent) {
        ((MenuComponent)src).dispatchEvent(event);
    } else if (src instanceof TrayIcon) {
        ((TrayIcon)src).dispatchEvent(event);
    } else if (src instanceof AWTAutoShutdown) {
        if (noEvents()) {
            dispatchThread.stopDispatching();
        }
    } else {
        if (getEventLog().isLoggable(PlatformLogger.Level.FINE)) {
            getEventLog().fine("Unable to dispatch event: " + event);
        }
    }
}
 
源代码13 项目: openjdk-8   文件: WWindowPeer.java
public void propertyChange(PropertyChangeEvent e) {
    boolean isDisposed = (Boolean)e.getNewValue();
    if (isDisposed != true) {
        if (log.isLoggable(PlatformLogger.Level.FINE)) {
            log.fine(" Assertion (newValue != true) failed for AppContext.GUI_DISPOSED ");
        }
    }
    AppContext appContext = AppContext.getAppContext();
    synchronized (appContext) {
        appContext.remove(ACTIVE_WINDOWS_KEY);
        appContext.removePropertyChangeListener(AppContext.GUI_DISPOSED, this);

        KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
        kfm.removePropertyChangeListener("activeWindow", activeWindowListener);
    }
}
 
源代码14 项目: jdk8u-jdk   文件: ProxyClassesDumper.java
public void dumpClass(String className, final byte[] classBytes) {
    Path file;
    try {
        file = dumpDir.resolve(encodeForFilename(className) + ".class");
    } catch (InvalidPathException ex) {
        PlatformLogger.getLogger(ProxyClassesDumper.class.getName())
                      .warning("Invalid path for class " + className);
        return;
    }

    try {
        Path dir = file.getParent();
        Files.createDirectories(dir);
        Files.write(file, classBytes);
    } catch (Exception ignore) {
        PlatformLogger.getLogger(ProxyClassesDumper.class.getName())
                      .warning("Exception writing to path at " + file.toString());
        // simply don't care if this operation failed
    }
}
 
源代码15 项目: openjdk-8-source   文件: ScrollPaneWheelScroller.java
public static void handleWheelScrolling(ScrollPane sp, MouseWheelEvent e) {
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("x = " + e.getX() + ", y = " + e.getY() + ", src is " + e.getSource());
    }
    int increment = 0;

    if (sp != null && e.getScrollAmount() != 0) {
        Adjustable adj = getAdjustableToScroll(sp);
        if (adj != null) {
            increment = getIncrementFromAdjustable(adj, e);
            if (log.isLoggable(PlatformLogger.Level.FINER)) {
                log.finer("increment from adjustable(" + adj.getClass() + ") : " + increment);
            }
            scrollAdjustable(adj, increment);
        }
    }
}
 
源代码16 项目: hottub   文件: XDecoratedPeer.java
public void handleFocusEvent(XEvent xev) {
        super.handleFocusEvent(xev);
        XFocusChangeEvent xfe = xev.get_xfocus();

        // If we somehow received focus events forward it instead to proxy
        // FIXME: Shouldn't we instead check for inferrior?
        if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
            focusLog.finer("Received focus event on shell: " + xfe);
        }
//         focusProxy.xRequestFocus();
   }
 
源代码17 项目: jdk8u_jdk   文件: KeyboardFocusManagerPeerImpl.java
@Override
public void clearGlobalFocusOwner(Window activeWindow) {
    if (activeWindow != null) {
        Component focusOwner = activeWindow.getFocusOwner();
        if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
            focusLog.fine("Clearing global focus owner " + focusOwner);
        }
        if (focusOwner != null) {
            FocusEvent fl = new CausedFocusEvent(focusOwner, FocusEvent.FOCUS_LOST, false, null,
                                                 CausedFocusEvent.Cause.CLEAR_GLOBAL_FOCUS_OWNER);
            SunToolkit.postPriorityEvent(fl);
        }
    }
}
 
源代码18 项目: openjdk-jdk8u-backup   文件: XWINProtocol.java
void detect() {
    if (supportChecked) {
        return;
    }
    WinWindow = checkAnchor(XA_WIN_SUPPORTING_WM_CHECK, XAtom.XA_CARDINAL);
    supportChecked = true;
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        log.fine("### " + this + " is active: " + (WinWindow != 0));
    }
}
 
源代码19 项目: openjdk-jdk8u-backup   文件: XEmbeddedFramePeer.java
public void handleConfigureNotifyEvent(XEvent xev)
{
    assert (SunToolkit.isAWTLockHeldByCurrentThread());
    XConfigureEvent xe = xev.get_xconfigure();
    if (xembedLog.isLoggable(PlatformLogger.Level.FINE)) {
        xembedLog.fine(xe.toString());
    }

    // fix for 5063031
    // if we use super.handleConfigureNotifyEvent() we would get wrong
    // size and position because embedded frame really is NOT a decorated one
    checkIfOnNewScreen(toGlobal(new Rectangle(xe.get_x(),
            xe.get_y(),
            xe.get_width(),
            xe.get_height())));

    Rectangle oldBounds = getBounds();

    synchronized (getStateLock()) {
        x = xe.get_x();
        y = xe.get_y();
        width = xe.get_width();
        height = xe.get_height();

        dimensions.setClientSize(width, height);
        dimensions.setLocation(x, y);
    }

    if (!getLocation().equals(oldBounds.getLocation())) {
        handleMoved(dimensions);
    }
    reconfigureContentWindow(dimensions);
}
 
源代码20 项目: openjdk-jdk9   文件: XIconWindow.java
/**
 * @return array of XIconsSize structures, caller must free this array after use.
 */
private XIconSize[] getIconSizes() {
    XToolkit.awtLock();
    try {
        AwtGraphicsConfigData adata = parent.getGraphicsConfigurationData();
        final long screen = adata.get_awt_visInfo().get_screen();
        final long display = XToolkit.getDisplay();

        if (log.isLoggable(PlatformLogger.Level.FINEST)) {
            log.finest(adata.toString());
        }

        long status =
            XlibWrapper.XGetIconSizes(display, XToolkit.getDefaultRootWindow(),
                                      XlibWrapper.larg1, XlibWrapper.iarg1);
        if (status == 0) {
            return null;
        }
        int count = Native.getInt(XlibWrapper.iarg1);
        long sizes_ptr = Native.getLong(XlibWrapper.larg1); // XIconSize*
        if (log.isLoggable(PlatformLogger.Level.FINEST)) {
            log.finest("count = {1}, sizes_ptr = {0}", Long.valueOf(sizes_ptr), Integer.valueOf(count));
        }
        XIconSize[] res = new XIconSize[count];
        for (int i = 0; i < count; i++, sizes_ptr += XIconSize.getSize()) {
            res[i] = new XIconSize(sizes_ptr);
            if (log.isLoggable(PlatformLogger.Level.FINEST)) {
                log.finest("sizes_ptr[{1}] = {0}", res[i], Integer.valueOf(i));
            }
        }
        return res;
    } finally {
        XToolkit.awtUnlock();
    }
}
 
private void wakeupEDT() {
    if (log.isLoggable(PlatformLogger.Level.FINEST)) {
        log.finest("wakeupEDT(): EDT == " + dispatchThread);
    }
    EventQueue eq = dispatchThread.getEventQueue();
    eq.postEvent(new PeerEvent(this, wakingRunnable, PeerEvent.PRIORITY_EVENT));
}
 
源代码22 项目: openjdk-8   文件: XComponentPeer.java
public void destroyBuffers() {
    if (buffersLog.isLoggable(PlatformLogger.Level.FINE)) {
        buffersLog.fine("destroyBuffers()");
    }
    graphicsConfig.destroyBackBuffer(backBuffer);
    backBuffer = 0;
    xBackBuffer = null;
}
 
源代码23 项目: jdk8u-jdk   文件: SunDisplayChanger.java
public void notifyPaletteChanged() {
    if (log.isLoggable(PlatformLogger.Level.FINEST)) {
        log.finest("notifyPaletteChanged");
    }
// This method is implemented by making a clone of the set of listeners,
// and then iterating over the clone.  This is because during the course
// of responding to a display change, it may be appropriate for a
// DisplayChangedListener to add or remove itself from a SunDisplayChanger.
// If the set itself were iterated over, rather than a clone, it is
// trivial to get a ConcurrentModificationException by having a
// DisplayChangedListener remove itself from its list.
// Because all display change handling is done on the event thread,
// synchronization provides no protection against modifying the listener
// list while in the middle of iterating over it.  -bchristi 7/10/2001

    Set<DisplayChangedListener> cloneSet;

    synchronized (listeners) {
        cloneSet = new HashSet<DisplayChangedListener>(listeners.keySet());
    }
    Iterator<DisplayChangedListener> itr = cloneSet.iterator();
    while (itr.hasNext()) {
        DisplayChangedListener current = itr.next();
        try {
            if (log.isLoggable(PlatformLogger.Level.FINEST)) {
                log.finest("paletteChanged for listener: " + current);
            }
            current.paletteChanged();
        } catch (IllegalComponentStateException e) {
            // This DisplayChangeListener is no longer valid.  Most
            // likely, a top-level window was dispose()d, but its
            // Java objects have not yet been garbage collected.  In any
            // case, we no longer need to track this listener, though we
            // do need to remove it from the original list, not the clone.
            listeners.remove(current);
        }
    }
}
 
源代码24 项目: jdk8u-jdk   文件: XMenuPeer.java
public void addItem(MenuItem item) {
    XMenuWindow menuWindow = getMenuWindow();
    if (menuWindow != null) {
        menuWindow.addItem(item);
    } else {
        if (log.isLoggable(PlatformLogger.Level.FINE)) {
            log.fine("Attempt to use XMenuWindowPeer without window");
        }
    }
}
 
源代码25 项目: jdk8u-jdk   文件: ListHelper.java
int y2index(int y) {
    if (log.isLoggable(PlatformLogger.Level.FINE)) {
        log.fine("y=" + y +", firstIdx=" + firstDisplayedIndex() +", itemHeight=" + getItemHeight()
                 + ",item_margin=" + ITEM_MARGIN);
    }
    // See 6243382 for more information
    int newIdx = firstDisplayedIndex() + ((y - 2*ITEM_MARGIN) / (getItemHeight() + 2*ITEM_MARGIN));
    return newIdx;
}
 
源代码26 项目: jdk8u_jdk   文件: SortingFocusTraversalPolicy.java
private Component getComponentDownCycle(Component comp, int traversalDirection) {
    Component retComp = null;

    if (comp instanceof Container) {
        Container cont = (Container)comp;

        if (cont.isFocusCycleRoot()) {
            if (getImplicitDownCycleTraversal()) {
                retComp = cont.getFocusTraversalPolicy().getDefaultComponent(cont);

                if (retComp != null && log.isLoggable(PlatformLogger.Level.FINE)) {
                    log.fine("### Transfered focus down-cycle to " + retComp +
                             " in the focus cycle root " + cont);
                }
            } else {
                return null;
            }
        } else if (cont.isFocusTraversalPolicyProvider()) {
            retComp = (traversalDirection == FORWARD_TRAVERSAL ?
                       cont.getFocusTraversalPolicy().getDefaultComponent(cont) :
                       cont.getFocusTraversalPolicy().getLastComponent(cont));

            if (retComp != null && log.isLoggable(PlatformLogger.Level.FINE)) {
                log.fine("### Transfered focus to " + retComp + " in the FTP provider " + cont);
            }
        }
    }
    return retComp;
}
 
源代码27 项目: dragonwell8_jdk   文件: Win32ShellFolderManager2.java
static Win32ShellFolder2 getDesktop() {
    if (desktop == null) {
        try {
            desktop = new Win32ShellFolder2(DESKTOP);
        } catch (final SecurityException ignored) {
            // Ignore, the message may have sensitive information, not
            // accessible other ways
        } catch (IOException | InterruptedException e) {
            if (log.isLoggable(PlatformLogger.Level.WARNING)) {
                log.warning("Cannot access 'Desktop'", e);
            }
        }
    }
    return desktop;
}
 
源代码28 项目: jdk8u_jdk   文件: XComponentPeer.java
public Image getBackBuffer() {
    if (buffersLog.isLoggable(PlatformLogger.Level.FINE)) {
        buffersLog.fine("getBackBuffer()");
    }
    if (backBuffer == 0) {
        throw new IllegalStateException("Buffers have not been created");
    }
    return xBackBuffer;
}
 
源代码29 项目: jdk8u_jdk   文件: XEmbedServerTester.java
private int embed() {
    int res = getEventPos();
    XToolkit.awtLock();
    try {
        XCreateWindowParams params =
            new XCreateWindowParams(new Object[] {
                XBaseWindow.PARENT_WINDOW, Long.valueOf(reparent?XToolkit.getDefaultRootWindow():parent),
                XBaseWindow.BOUNDS, initialBounds,
                XBaseWindow.EMBEDDED, Boolean.TRUE,
                XBaseWindow.VISIBLE, Boolean.valueOf(mapped == XEmbedHelper.XEMBED_MAPPED),
                XBaseWindow.EVENT_MASK, Long.valueOf(VisibilityChangeMask | StructureNotifyMask |
                                                 SubstructureNotifyMask | KeyPressMask)});
        window = new XBaseWindow(params);

        if (xembedLog.isLoggable(PlatformLogger.Level.FINER)) {
            xembedLog.finer("Created tester window: " + window);
        }

        XToolkit.addEventDispatcher(window.getWindow(), this);
        updateEmbedInfo();
        if (reparent) {
            xembedLog.finer("Reparenting to embedder");
            XlibWrapper.XReparentWindow(XToolkit.getDisplay(), window.getWindow(), parent, 0, 0);
        }
    } finally {
        XToolkit.awtUnlock();
    }
    return res;
}
 
源代码30 项目: jdk8u-dev-jdk   文件: XScrollbar.java
public void setSize(int width, int height) {
    if (log.isLoggable(PlatformLogger.Level.FINER)) {
        log.finer("Setting scroll bar " + this + " size to " + width + "x" + height);
    }
    this.width = width;
    this.height = height;
}