mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
painting issue fix
This commit is contained in:
+1
-1
@@ -29,7 +29,7 @@ public class DIYLCStarter {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
url = DIYLCStarter.class.getResource("config.properties");
|
url = DIYLCStarter.class.getResource("config.properties");
|
||||||
properties = new Properties();
|
properties = new Properties();
|
||||||
try {
|
try {
|
||||||
|
|||||||
+20
-4
@@ -17,6 +17,7 @@ import javax.swing.JMenu;
|
|||||||
import javax.swing.JMenuBar;
|
import javax.swing.JMenuBar;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.SwingConstants;
|
import javax.swing.SwingConstants;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import com.diyfever.diylc.common.BadPositionException;
|
import com.diyfever.diylc.common.BadPositionException;
|
||||||
import com.diyfever.diylc.model.Project;
|
import com.diyfever.diylc.model.Project;
|
||||||
@@ -44,6 +45,8 @@ public class MainFrame extends JFrame implements IView {
|
|||||||
private JMenuBar mainMenuBar;
|
private JMenuBar mainMenuBar;
|
||||||
private Map<String, JMenu> menuMap;
|
private Map<String, JMenu> menuMap;
|
||||||
|
|
||||||
|
private CanvasPlugin canvasPlugin;
|
||||||
|
|
||||||
public MainFrame() {
|
public MainFrame() {
|
||||||
super("DIYLC4");
|
super("DIYLC4");
|
||||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
@@ -63,7 +66,7 @@ public class MainFrame extends JFrame implements IView {
|
|||||||
presenter.installPlugin(new HelpManager());
|
presenter.installPlugin(new HelpManager());
|
||||||
|
|
||||||
presenter.installPlugin(new StatusBar());
|
presenter.installPlugin(new StatusBar());
|
||||||
CanvasPlugin canvasPlugin = new CanvasPlugin();
|
canvasPlugin = new CanvasPlugin();
|
||||||
presenter.installPlugin(canvasPlugin);
|
presenter.installPlugin(canvasPlugin);
|
||||||
|
|
||||||
Project project = new Project();
|
Project project = new Project();
|
||||||
@@ -82,13 +85,26 @@ public class MainFrame extends JFrame implements IView {
|
|||||||
presenter.dispose();
|
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());
|
// setGlassPane(new CustomGlassPane());
|
||||||
// getGlassPane().setVisible(true);
|
// 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() {
|
private void createBasePanels() {
|
||||||
Container c = new Container();
|
Container c = new Container();
|
||||||
c.setLayout(new BorderLayout());
|
c.setLayout(new BorderLayout());
|
||||||
|
|||||||
+3
-1
@@ -113,7 +113,9 @@ public class CanvasPlugin implements IPlugIn {
|
|||||||
*/
|
*/
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
MouseEvent event = new MouseEvent(canvasPanel, MouseEvent.MOUSE_MOVED, System
|
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);
|
canvasPanel.dispatchEvent(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user