painting issue fix

This commit is contained in:
bancika
2011-01-03 13:48:04 +00:00
parent cb56375de9
commit 86e07e60b8
3 changed files with 24 additions and 6 deletions
@@ -29,7 +29,7 @@ public class DIYLCStarter {
} catch (IOException e) {
e.printStackTrace();
}
url = DIYLCStarter.class.getResource("config.properties");
properties = new Properties();
try {
@@ -17,6 +17,7 @@ import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import com.diyfever.diylc.common.BadPositionException;
import com.diyfever.diylc.model.Project;
@@ -44,6 +45,8 @@ public class MainFrame extends JFrame implements IView {
private JMenuBar mainMenuBar;
private Map<String, JMenu> menuMap;
private CanvasPlugin canvasPlugin;
public MainFrame() {
super("DIYLC4");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
@@ -63,7 +66,7 @@ public class MainFrame extends JFrame implements IView {
presenter.installPlugin(new HelpManager());
presenter.installPlugin(new StatusBar());
CanvasPlugin canvasPlugin = new CanvasPlugin();
canvasPlugin = new CanvasPlugin();
presenter.installPlugin(canvasPlugin);
Project project = new Project();
@@ -82,13 +85,26 @@ 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);
}
@Override
public void setVisible(boolean b) {
super.setVisible(b);
// TODO: hack to prevent painting issues in the scroll bar rulers. Find
// a better fix if possible.
if (b) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
canvasPlugin.refresh();
}
});
}
}
private void createBasePanels() {
Container c = new Container();
c.setLayout(new BorderLayout());
@@ -113,7 +113,9 @@ public class CanvasPlugin implements IPlugIn {
*/
public void refresh() {
MouseEvent event = new MouseEvent(canvasPanel, MouseEvent.MOUSE_MOVED, System
.currentTimeMillis(), 0, 0, 0, 0, false);
.currentTimeMillis(), 0, 1, 1,// canvasPanel.getWidth() / 2,
// canvasPanel.getHeight() / 2,
0, false);
canvasPanel.dispatchEvent(event);
}
}