use of y.view.DefaultBackgroundRenderer in project binnavi by google.
the class CLayoutFunctions method updateBackground.
/**
* Updates the background depending on the graph settings.
*
* @param graph The graph whose backround is updated.
*/
public static void updateBackground(final ZyGraph graph) {
Preconditions.checkNotNull(graph, "IE02126: Graph argument can not be null");
// TODO: Buffer and share the background gradient between views
final DefaultBackgroundRenderer dBGRender = new DefaultBackgroundRenderer(graph.getView());
if (graph.getSettings().getDisplaySettings().getGradientBackground()) {
dBGRender.setImage(new ImageIcon(CMain.class.getResource("data/gradientbackground2.jpg")).getImage());
dBGRender.setMode(DefaultBackgroundRenderer.FULLSCREEN);
} else {
dBGRender.setColor(new Color(250, 250, 250));
}
graph.getView().setBackgroundRenderer(dBGRender);
graph.updateViews();
}
use of y.view.DefaultBackgroundRenderer in project binnavi by google.
the class CRootNodeComponent method createGui.
/**
* Creates the GUI of this component.
*/
private void createGui() {
final Graph2DView view = new ZyGraph2DView(new Graph2D());
view.setScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
final DefaultBackgroundRenderer backgroundRenderer = new DefaultBackgroundRenderer(view);
backgroundRenderer.setImage(BACKGROUND_IMAGE);
backgroundRenderer.setMode(DefaultBackgroundRenderer.CENTERED);
backgroundRenderer.setColor(Color.white);
view.setBackgroundRenderer(backgroundRenderer);
add(view, BorderLayout.CENTER);
}
Aggregations