painting issue fix

This commit is contained in:
bancika
2011-01-03 13:26:20 +00:00
parent 2f87896523
commit cb56375de9
2 changed files with 18 additions and 4 deletions
@@ -63,10 +63,11 @@ public class MainFrame extends JFrame implements IView {
presenter.installPlugin(new HelpManager());
presenter.installPlugin(new StatusBar());
presenter.installPlugin(new CanvasPlugin());
CanvasPlugin canvasPlugin = new CanvasPlugin();
presenter.installPlugin(canvasPlugin);
Project project = new Project();
// project.getComponents().add(new MockComponentInstance());
// project.getComponents().add(new MockComponentInstance());
presenter.loadProject(project, true);
addWindowListener(new WindowAdapter() {
@@ -81,7 +82,9 @@ public class MainFrame extends JFrame implements IView {
presenter.dispose();
}
});
// TODO: hack to fix painting issues with rulers in the scroll pane.
// Find a better solution if possible.
canvasPlugin.refresh();
// setGlassPane(new CustomGlassPane());
// getGlassPane().setVisible(true);
}
@@ -2,6 +2,7 @@ package com.diyfever.diylc.plugins.canvas;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.util.EnumSet;
import javax.swing.SwingConstants;
@@ -103,6 +104,16 @@ public class CanvasPlugin implements IPlugIn {
Dimension d = plugInPort.getCanvasDimensions(true);
canvasPanel.setSize(d);
canvasPanel.setPreferredSize(d);
scrollPane.setZoomLevel(plugInPort.getZoomLevel());
getScrollPane().setZoomLevel(plugInPort.getZoomLevel());
}
/**
* Causes ruller scroll pane to refresh by sending a fake mouse moved
* message to the canvasPanel.
*/
public void refresh() {
MouseEvent event = new MouseEvent(canvasPanel, MouseEvent.MOUSE_MOVED, System
.currentTimeMillis(), 0, 0, 0, 0, false);
canvasPanel.dispatchEvent(event);
}
}