use of org.freeplane.view.swing.features.filepreview.ScalableComponent in project freeplane by freeplane.
the class MapView method adjustBackgroundComponentScale.
private void adjustBackgroundComponentScale() {
if (backgroundComponent != null) {
if (fitToViewport) {
final JViewport vp = (JViewport) getParent();
final Dimension viewPortSize = vp.getVisibleRect().getSize();
((ScalableComponent) backgroundComponent).setFinalViewerSize(viewPortSize);
} else {
((ScalableComponent) backgroundComponent).setMaximumComponentSize(getPreferredSize());
((ScalableComponent) backgroundComponent).setFinalViewerSize(zoom);
}
}
}
use of org.freeplane.view.swing.features.filepreview.ScalableComponent in project freeplane by freeplane.
the class MapView method assignViewerToBackgroundComponent.
private void assignViewerToBackgroundComponent(final IViewerFactory factory, final URI uri) {
try {
if (fitToViewport) {
final JViewport vp = (JViewport) getParent();
if (vp != null) {
final Dimension viewPortSize = vp.getVisibleRect().getSize();
backgroundComponent = (JComponent) factory.createViewer(uri, viewPortSize);
} else
backgroundComponent = (JComponent) factory.createViewer(uri, new Dimension(1, 1));
} else
backgroundComponent = (JComponent) factory.createViewer(uri, zoom);
((ScalableComponent) backgroundComponent).setCenter(true);
((ScalableComponent) backgroundComponent).setImageLoadingListener(new ImageLoadingListener() {
public void imageLoaded() {
repaint();
}
});
} catch (final MalformedURLException e1) {
LogUtils.severe(e1);
} catch (final IOException e1) {
LogUtils.severe(e1);
}
}
Aggregations