Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
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 (322)
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
⏎ ru/atomation/jbrowser/impl/JComponentFactory.java
package ru.atomation.jbrowser.impl;
import static org.mozilla.browser.MozillaExecutor.mozAsyncExec;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.lang.reflect.Constructor;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import ru.atomation.jbrowser.abstracts.AbstractComponentFactory;
import ru.atomation.jbrowser.interfaces.BrowserManager;
import ru.atomation.jbrowser.interfaces.ComponentFacotry;
/**
* Фактори создает браузер встроенный в canvas // Factory create browser embedded in canvas
* @author caiiiycuk
*/
public class JComponentFactory<T extends Component> extends AbstractComponentFactory<T> implements ComponentFacotry<T> {
private static Log logger = LogFactory.getLog(JBrowserCanvas.class);
protected final Class<? extends JBrowserComponent<? extends T>> prototype;
public JComponentFactory(Class<? extends JBrowserComponent<? extends T>> prototype) {
this(null, prototype);
}
public JComponentFactory(BrowserManager browserManager, Class<? extends JBrowserComponent<? extends T>> prototype) {
setBrowserManager(browserManager);
this.prototype = prototype;
}
@Override
public JBrowserComponent<? extends T> createBrowser(JBrowserComponent<?> parent, boolean attachOnCreation, final long flags, boolean displayable) {
final JBrowserComponent<? extends T> instance;
try {
Constructor<? extends JBrowserComponent<? extends T>> constructor = prototype.getConstructor(BrowserManager.class);
instance = constructor.newInstance(browserManager);
} catch (Throwable e) {
logger.error(e.getMessage(), e);
return null;
}
if (attachOnCreation) {
instance.onCreatePeer(new Runnable() {
@Override
public void run() {
if (browserManager.isInitialized()) {
Runnable r = new Runnable() {
@Override
public void run() {
browserManager.getWindowCreator().attachBrowser(instance, flags);
}
};
mozAsyncExec(r);
}
}
});
}
instance.onDestroyPeer(new Runnable() {
@Override
public void run() {
if (browserManager.isInitialized()) {
Runnable r = new Runnable() {
@Override
public void run() {
browserManager.getWindowCreator().detachBrowser(instance);
}
};
mozAsyncExec(r);
}
}
});
if (displayable) {
instance.getComponent().setSize(320, 240);
instance.getComponent().setVisible(true);
// if (instance.getComponent() instanceof Window) {
// ((Window) instance.getComponent()).setLocationRelativeTo(null);
// }
}
return instance;
}
protected Dimension getPrefferedSize() {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
return new Dimension(
(int) (screenSize.getWidth() * 0.75f),
(int) (screenSize.getHeight() * 0.75f));
}
}
⏎ ru/atomation/jbrowser/impl/JComponentFactory.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, ≈34🔥, 1💬
Popular Posts:
What Is mail.jar of JavaMail 1.4? I got the JAR file from javamail-1_4.zip. mail.jar in javamail-1_4...
JDK 17 jdk.xml.dom.jmod is the JMOD file for JDK 17 XML DOM module. JDK 17 XML DOM module compiled c...
If you are a Java developer, it is very often that you need to use some 3rd party libraries to perfo...
The JDT project provides the tool plug-ins that implement a Java IDE supporting the development of a...
The JDT project provides the tool plug-ins that implement a Java IDE supporting the development of a...