Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
JBrowser Source Code Files
JBrowser Source Code Files are provided in the source package file.
You can download JBrowser source package as described in the previous tutorial and go to the "src" sub-folder to view Source Code files.
You can also browse JBrowser Source Code files below:
✍: FYIcenter
⏎ org/mozilla/browser/impl/FocusWatcher.java
package org.mozilla.browser.impl; import static java.awt.event.FocusEvent.FOCUS_GAINED; import static org.mozilla.browser.MozillaExecutor.swingAsyncExec; import java.awt.AWTEvent; import java.awt.Component; import java.awt.Toolkit; import java.awt.Window; import java.awt.event.AWTEventListener; import java.awt.event.FocusEvent; import java.awt.event.WindowEvent; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import javax.swing.SwingUtilities; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import ru.atomation.jbrowser.impl.JBrowserCanvas; public class FocusWatcher { static Log log = LogFactory.getLog(FocusWatcher.class); private static Map<Window, List<JBrowserCanvas>> xx = new HashMap<Window, List<JBrowserCanvas>>(); public static void register(final JBrowserCanvas c) { swingAsyncExec(new Runnable() { public void run() { Window win = SwingUtilities.getWindowAncestor(c); assert win!=null; boolean wasEmpty = xx.isEmpty(); List<JBrowserCanvas> cs = xx.get(win); if (cs==null) { cs = new LinkedList<JBrowserCanvas>(); xx.put(win, cs); } cs.add(c); if (wasEmpty) { Toolkit.getDefaultToolkit(). addAWTEventListener(gfl, FocusEvent.FOCUS_EVENT_MASK | WindowEvent.WINDOW_FOCUS_EVENT_MASK); } }}); } public static void unregister(final JBrowserCanvas c) { swingAsyncExec(new Runnable() { public void run() { //search window the canvas was registered in for (Window win : xx.keySet()) { List<JBrowserCanvas> cs = xx.get(win); assert cs!=null; if (cs.remove(c)) { if (cs.isEmpty()) { xx.remove(win); } break; } } if (xx.isEmpty()) { Toolkit.getDefaultToolkit(). removeAWTEventListener(gfl); } }}); } private static GlobalFocusListener gfl = new GlobalFocusListener(); static class GlobalFocusListener implements AWTEventListener { public void eventDispatched(AWTEvent ev) { log.debug(ev.getSource().getClass().getSimpleName()+ " "+ev); //$NON-NLS-1$ if (!(ev instanceof FocusEvent)) return; FocusEvent fev = (FocusEvent) ev; if (fev.getID()==FOCUS_GAINED && (ev.getSource() instanceof Component)) { Component cmp = (Component) ev.getSource(); if (cmp instanceof JBrowserCanvas) { JBrowserCanvas c = (JBrowserCanvas) cmp; c.onFocusMovedTo(cmp); } else { //notify one of the canvas in window //to deactivate gecko Window win = SwingUtilities.getWindowAncestor(cmp); if (win!=null) { List<JBrowserCanvas> cs = xx.get(win); if (cs!=null && !cs.isEmpty()) { JBrowserCanvas c = (JBrowserCanvas) cs.get(0); c.onFocusMovedTo(cmp); } } } } } } }
⏎ org/mozilla/browser/impl/FocusWatcher.java
Or download all of them as a single archive file:
File name: jbrowser-1.9-fyi.zip File size: 625318 bytes Release date: 2022-11-10 Download
⇐ Download and Install JBrowser Source Package
2017-07-17, 9302👍, 1💬
Popular Posts:
JLayer is a library that decodes/plays/converts MPEG 1/2/2.5 Layer 1/2/3 (i.e. MP3) in real time for...
Oracle Business Intelligence (BI) Beans enables developers to productively build business intelligen...
What Is js.jar in Rhino JavaScript 1.7R5? js.jar in Rhino JavaScript 1.7R5 is the JAR file for Rhino...
Jackson is "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java"....
XStream is a simple library to serialize objects to XML and back again. JAR File Size and Download L...