update file icons

scroll the main pane to center after starting
This commit is contained in:
bancika
2020-03-25 00:16:19 +01:00
parent 77a6f4d3b4
commit 4718ba6592
9 changed files with 211 additions and 154 deletions
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 972 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.
Binary file not shown.
@@ -25,7 +25,6 @@ import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.util.Properties; import java.util.Properties;
import javax.swing.JFrame;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.UIManager; import javax.swing.UIManager;
@@ -130,7 +129,6 @@ public class DIYLCStarter {
MainFrame mainFrame = new MainFrame(); MainFrame mainFrame = new MainFrame();
mainFrame.setLocationRelativeTo(null); mainFrame.setLocationRelativeTo(null);
mainFrame.setExtendedState(mainFrame.getExtendedState() | JFrame.MAXIMIZED_BOTH);
splash.setVisible(false); splash.setVisible(false);
splash.dispose(); splash.dispose();
@@ -23,7 +23,6 @@ package org.diylc.swing.gui;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Container; import java.awt.Container;
import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
@@ -51,6 +50,7 @@ import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JRadioButtonMenuItem; import javax.swing.JRadioButtonMenuItem;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import javax.swing.Timer; import javax.swing.Timer;
import javax.swing.event.MenuEvent; import javax.swing.event.MenuEvent;
@@ -160,10 +160,41 @@ public class MainFrame extends JFrame implements ISwingUI {
System.exit(0); System.exit(0);
} }
} }
}); });
setGlassPane(new CustomGlassPane()); setGlassPane(new CustomGlassPane());
// getGlassPane().setVisible(true); // getGlassPane().setVisible(true);
// maximize the screen
setExtendedState(getExtendedState() | JFrame.MAXIMIZED_BOTH);
new Thread(new Runnable() {
@Override
public void run() {
// wait some time for size to update
// TODO: find a better solution
try {
Thread.sleep(100);
} catch (InterruptedException e) {
}
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
// Important! Notify the canvas to center the scrolls and show the content
canvasPlugin.scrollToCenterAndShowContents();
}
});
}
}).start();
}
@Override
public void setExtendedState(int state) {
super.setExtendedState(state);
} }
public Presenter getPresenter() { public Presenter getPresenter() {
@@ -44,6 +44,7 @@ import javax.swing.JMenu;
import javax.swing.JMenuItem; import javax.swing.JMenuItem;
import javax.swing.JPopupMenu; import javax.swing.JPopupMenu;
import javax.swing.JScrollBar; import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
@@ -115,6 +116,21 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
} }
/**
* Sets the scroll pane location to center and shows the contents. This method must be called when
* the frame is initialized or the contents will remain hidden.
*
* TODO: figure out a better way
*/
public void scrollToCenterAndShowContents() {
JScrollPane scroll = getScrollPane();
Dimension totalSize = plugInPort.getCanvasDimensions(true, true);
Dimension visibleSize = scroll.getSize();
scroll.getHorizontalScrollBar().setValue((totalSize.width - visibleSize.width) / 2);
scroll.getVerticalScrollBar().setValue((totalSize.height - visibleSize.height) / 2);
getScrollPane().getViewport().setVisible(true);
}
@Override @Override
public void connect(IPlugInPort plugInPort) { public void connect(IPlugInPort plugInPort) {
this.plugInPort = plugInPort; this.plugInPort = plugInPort;
@@ -124,7 +140,8 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
LOG.error("Could not install canvas plugin", e); LOG.error("Could not install canvas plugin", e);
} }
getScrollPane().setRulerVisible(ConfigurationManager.getInstance().readBoolean(IPlugInPort.SHOW_RULERS_KEY, true)); getScrollPane().setRulerVisible(
ConfigurationManager.getInstance().readBoolean(IPlugInPort.SHOW_RULERS_KEY, true));
// revalidate canvas on scrolling when we render visible rect only // revalidate canvas on scrolling when we render visible rect only
if (CanvasPanel.RENDER_VISIBLE_RECT_ONLY) { if (CanvasPanel.RENDER_VISIBLE_RECT_ONLY) {
@@ -147,47 +164,53 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
}); });
} }
ConfigurationManager.getInstance().addConfigListener(IPlugInPort.SHOW_RULERS_KEY, new IConfigListener() { ConfigurationManager.getInstance().addConfigListener(IPlugInPort.SHOW_RULERS_KEY,
new IConfigListener() {
@Override @Override
public void valueChanged(String key, Object value) { public void valueChanged(String key, Object value) {
if (IPlugInPort.SHOW_RULERS_KEY.equals(key)) if (IPlugInPort.SHOW_RULERS_KEY.equals(key))
getScrollPane().setRulerVisible((Boolean) value); getScrollPane().setRulerVisible((Boolean) value);
} }
}); });
ConfigurationManager.getInstance().addConfigListener(IPlugInPort.HARDWARE_ACCELERATION, new IConfigListener() { ConfigurationManager.getInstance().addConfigListener(IPlugInPort.HARDWARE_ACCELERATION,
new IConfigListener() {
@Override @Override
public void valueChanged(String key, Object value) { public void valueChanged(String key, Object value) {
canvasPanel.setUseHardwareAcceleration((Boolean) value); canvasPanel.setUseHardwareAcceleration((Boolean) value);
scrollPane.setUseHardwareAcceleration((Boolean) value); scrollPane.setUseHardwareAcceleration((Boolean) value);
} }
}); });
ConfigurationManager.getInstance().addConfigListener(IPlugInPort.METRIC_KEY, new IConfigListener() { ConfigurationManager.getInstance().addConfigListener(IPlugInPort.METRIC_KEY,
new IConfigListener() {
@Override @Override
public void valueChanged(String key, Object value) { public void valueChanged(String key, Object value) {
updateZeroLocation(); updateZeroLocation();
} }
}); });
ConfigurationManager.getInstance().addConfigListener(IPlugInPort.EXTRA_SPACE_KEY, new IConfigListener() { ConfigurationManager.getInstance().addConfigListener(IPlugInPort.EXTRA_SPACE_KEY,
new IConfigListener() {
@Override @Override
public void valueChanged(String key, Object value) { public void valueChanged(String key, Object value) {
refreshSize(); refreshSize();
// Scroll to the center. // Scroll to the center.
Rectangle visibleRect = canvasPanel.getVisibleRect(); Rectangle visibleRect = canvasPanel.getVisibleRect();
visibleRect.setLocation((canvasPanel.getWidth() - visibleRect.width) / 2, visibleRect.setLocation((canvasPanel.getWidth() - visibleRect.width) / 2,
(canvasPanel.getHeight() - visibleRect.height) / 2); (canvasPanel.getHeight() - visibleRect.height) / 2);
canvasPanel.scrollRectToVisible(visibleRect); canvasPanel.scrollRectToVisible(visibleRect);
canvasPanel.revalidate(); canvasPanel.revalidate();
updateZeroLocation(); updateZeroLocation();
} }
}); });
getScrollPane().getViewport().setVisible(false);
} }
public CanvasPanel getCanvasPanel() { public CanvasPanel getCanvasPanel() {
@@ -201,8 +224,9 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if (scrollPane.isMouseScrollMode() || e.getButton() == MouseEvent.BUTTON2) if (scrollPane.isMouseScrollMode() || e.getButton() == MouseEvent.BUTTON2)
return; return;
plugInPort.mouseClicked(e.getPoint(), e.getButton(), Utils.isMac() ? e.isMetaDown() : e.isControlDown(), plugInPort.mouseClicked(e.getPoint(), e.getButton(),
e.isShiftDown(), e.isAltDown(), e.getClickCount()); Utils.isMac() ? e.isMetaDown() : e.isControlDown(), e.isShiftDown(), e.isAltDown(),
e.getClickCount());
} }
@Override @Override
@@ -220,15 +244,16 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
@Override @Override
public void run() { public void run() {
if (plugInPort.getNewComponentTypeSlot() == null if (plugInPort.getNewComponentTypeSlot() == null && (e.isPopupTrigger()
&& (e.isPopupTrigger() || (pressedEvent != null && pressedEvent.isPopupTrigger()))) { || (pressedEvent != null && pressedEvent.isPopupTrigger()))) {
// Enable actions. // Enable actions.
boolean enabled = !plugInPort.getSelectedComponents().isEmpty(); boolean enabled = !plugInPort.getSelectedComponents().isEmpty();
getCutAction().setEnabled(enabled); getCutAction().setEnabled(enabled);
getCopyAction().setEnabled(enabled); getCopyAction().setEnabled(enabled);
getDuplicateAction().setEnabled(enabled); getDuplicateAction().setEnabled(enabled);
try { try {
getPasteAction().setEnabled(clipboard.isDataFlavorAvailable(ComponentTransferable.listFlavor)); getPasteAction().setEnabled(
clipboard.isDataFlavorAvailable(ComponentTransferable.listFlavor));
} catch (Exception ex) { } catch (Exception ex) {
getPasteAction().setEnabled(false); getPasteAction().setEnabled(false);
} }
@@ -247,7 +272,8 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
getMirrorHorizontallyAction().setEnabled(enabled); getMirrorHorizontallyAction().setEnabled(enabled);
getMirrorVerticallyAction().setEnabled(enabled); getMirrorVerticallyAction().setEnabled(enabled);
getSaveAsTemplateAction().setEnabled(plugInPort.getSelectedComponents().size() == 1); getSaveAsTemplateAction()
.setEnabled(plugInPort.getSelectedComponents().size() == 1);
getSaveAsBlockAction().setEnabled(plugInPort.getSelectedComponents().size() > 1); getSaveAsBlockAction().setEnabled(plugInPort.getSelectedComponents().size() > 1);
showPopupAt(e.getX(), e.getY()); showPopupAt(e.getX(), e.getY());
@@ -261,8 +287,8 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
@Override @Override
public void keyPressed(KeyEvent e) { public void keyPressed(KeyEvent e) {
if (plugInPort.keyPressed(e.getKeyCode(), Utils.isMac() ? e.isMetaDown() : e.isControlDown(), if (plugInPort.keyPressed(e.getKeyCode(),
e.isShiftDown(), e.isAltDown())) { Utils.isMac() ? e.isMetaDown() : e.isControlDown(), e.isShiftDown(), e.isAltDown())) {
e.consume(); e.consume();
} }
} }
@@ -275,8 +301,8 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
if (scrollPane.isMouseScrollMode()) if (scrollPane.isMouseScrollMode())
return; return;
canvasPanel.setCursor(plugInPort.getCursorAt(e.getPoint())); canvasPanel.setCursor(plugInPort.getCursorAt(e.getPoint()));
plugInPort.mouseMoved(e.getPoint(), Utils.isMac() ? e.isMetaDown() : e.isControlDown(), e.isShiftDown(), plugInPort.mouseMoved(e.getPoint(), Utils.isMac() ? e.isMetaDown() : e.isControlDown(),
e.isAltDown()); e.isShiftDown(), e.isAltDown());
} }
}); });
} }
@@ -285,9 +311,9 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
private RulerScrollPane getScrollPane() { private RulerScrollPane getScrollPane() {
if (scrollPane == null) { if (scrollPane == null) {
scrollPane = scrollPane = new RulerScrollPane(getCanvasPanel(),
new RulerScrollPane(getCanvasPanel(), new ProjectDrawingProvider(plugInPort, true, false, true), new Size(1d, new ProjectDrawingProvider(plugInPort, true, false, true),
SizeUnit.cm).convertToPixels(), new Size(1d, SizeUnit.in).convertToPixels()); new Size(1d, SizeUnit.cm).convertToPixels(), new Size(1d, SizeUnit.in).convertToPixels());
boolean metric = ConfigurationManager.getInstance().readBoolean(Presenter.METRIC_KEY, true); boolean metric = ConfigurationManager.getInstance().readBoolean(Presenter.METRIC_KEY, true);
boolean useHardwareAcceleration = boolean useHardwareAcceleration =
@@ -317,7 +343,8 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
final JScrollBar horizontalScrollBar = scrollPane.getHorizontalScrollBar(); final JScrollBar horizontalScrollBar = scrollPane.getHorizontalScrollBar();
final JScrollBar verticalScrollBar = scrollPane.getVerticalScrollBar(); final JScrollBar verticalScrollBar = scrollPane.getVerticalScrollBar();
boolean wheelZoom = ConfigurationManager.getInstance().readBoolean(IPlugInPort.WHEEL_ZOOM_KEY, false); boolean wheelZoom =
ConfigurationManager.getInstance().readBoolean(IPlugInPort.WHEEL_ZOOM_KEY, false);
if (wheelZoom || (Utils.isMac() ? e.isMetaDown() : e.isControlDown())) { if (wheelZoom || (Utils.isMac() ? e.isMetaDown() : e.isControlDown())) {
@@ -349,32 +376,30 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
if (selectionBounds == null) { if (selectionBounds == null) {
// center to cursor // center to cursor
Point desiredPos = Point desiredPos = new Point((int) (1d * mousePos.x / oldZoom * newZoom),
new Point((int) (1d * mousePos.x / oldZoom * newZoom), (int) (1d * mousePos.y / oldZoom * newZoom)); (int) (1d * mousePos.y / oldZoom * newZoom));
int dx = desiredPos.x - mousePos.x; int dx = desiredPos.x - mousePos.x;
int dy = desiredPos.y - mousePos.y; int dy = desiredPos.y - mousePos.y;
horizontal.setValue(horizontal.getValue() + dx); horizontal.setValue(horizontal.getValue() + dx);
vertical.setValue(vertical.getValue() + dy); vertical.setValue(vertical.getValue() + dy);
} else { } else {
// center to selection // center to selection
horizontal.setValue((int) (selectionBounds.getX() + selectionBounds.getWidth() / 2 - visibleRect horizontal.setValue((int) (selectionBounds.getX() + selectionBounds.getWidth() / 2
.getWidth() / 2)); - visibleRect.getWidth() / 2));
vertical.setValue((int) (selectionBounds.getY() + selectionBounds.getHeight() / 2 - visibleRect vertical.setValue((int) (selectionBounds.getY() + selectionBounds.getHeight() / 2
.getHeight() / 2)); - visibleRect.getHeight() / 2));
} }
} }
if (e.isShiftDown()) { if (e.isShiftDown()) {
int iScrollAmount = e.getScrollAmount(); int iScrollAmount = e.getScrollAmount();
int iNewValue = int iNewValue = horizontalScrollBar.getValue()
horizontalScrollBar.getValue() + horizontalScrollBar.getBlockIncrement() * iScrollAmount + horizontalScrollBar.getBlockIncrement() * iScrollAmount * e.getWheelRotation();
* e.getWheelRotation();
if (iNewValue <= horizontalScrollBar.getMaximum()) if (iNewValue <= horizontalScrollBar.getMaximum())
horizontalScrollBar.setValue(iNewValue); horizontalScrollBar.setValue(iNewValue);
} else { } else {
int iScrollAmount = e.getScrollAmount(); int iScrollAmount = e.getScrollAmount();
int iNewValue = int iNewValue = verticalScrollBar.getValue()
verticalScrollBar.getValue() + verticalScrollBar.getBlockIncrement() * iScrollAmount + verticalScrollBar.getBlockIncrement() * iScrollAmount * e.getWheelRotation();
* e.getWheelRotation();
if (iNewValue <= verticalScrollBar.getMaximum()) if (iNewValue <= verticalScrollBar.getMaximum())
verticalScrollBar.setValue(iNewValue); verticalScrollBar.setValue(iNewValue);
} }
@@ -556,30 +581,32 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
public ActionFactory.RotateSelectionAction getRotateClockwiseAction() { public ActionFactory.RotateSelectionAction getRotateClockwiseAction() {
if (rotateClockwiseAction == null) { if (rotateClockwiseAction == null) {
rotateClockwiseAction = ActionFactory.getInstance().createRotateSelectionAction(plugInPort, 1); rotateClockwiseAction =
ActionFactory.getInstance().createRotateSelectionAction(plugInPort, 1);
} }
return rotateClockwiseAction; return rotateClockwiseAction;
} }
public ActionFactory.RotateSelectionAction getRotateCounterclockwiseAction() { public ActionFactory.RotateSelectionAction getRotateCounterclockwiseAction() {
if (rotateCounterclockwiseAction == null) { if (rotateCounterclockwiseAction == null) {
rotateCounterclockwiseAction = ActionFactory.getInstance().createRotateSelectionAction(plugInPort, -1); rotateCounterclockwiseAction =
ActionFactory.getInstance().createRotateSelectionAction(plugInPort, -1);
} }
return rotateCounterclockwiseAction; return rotateCounterclockwiseAction;
} }
public ActionFactory.MirrorSelectionAction getMirrorHorizontallyAction() { public ActionFactory.MirrorSelectionAction getMirrorHorizontallyAction() {
if (mirrorHorizontallyAction == null) { if (mirrorHorizontallyAction == null) {
mirrorHorizontallyAction = mirrorHorizontallyAction = ActionFactory.getInstance().createMirrorSelectionAction(plugInPort,
ActionFactory.getInstance().createMirrorSelectionAction(plugInPort, IComponentTransformer.HORIZONTAL); IComponentTransformer.HORIZONTAL);
} }
return mirrorHorizontallyAction; return mirrorHorizontallyAction;
} }
public ActionFactory.MirrorSelectionAction getMirrorVerticallyAction() { public ActionFactory.MirrorSelectionAction getMirrorVerticallyAction() {
if (mirrorVerticallyAction == null) { if (mirrorVerticallyAction == null) {
mirrorVerticallyAction = mirrorVerticallyAction = ActionFactory.getInstance().createMirrorSelectionAction(plugInPort,
ActionFactory.getInstance().createMirrorSelectionAction(plugInPort, IComponentTransformer.VERTICAL); IComponentTransformer.VERTICAL);
} }
return mirrorVerticallyAction; return mirrorVerticallyAction;
} }
@@ -635,23 +662,24 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
public ActionFactory.ExpandSelectionAction getExpandSelectionAllAction() { public ActionFactory.ExpandSelectionAction getExpandSelectionAllAction() {
if (expandSelectionAllAction == null) { if (expandSelectionAllAction == null) {
expandSelectionAllAction = ActionFactory.getInstance().createExpandSelectionAction(plugInPort, ExpansionMode.ALL); expandSelectionAllAction =
ActionFactory.getInstance().createExpandSelectionAction(plugInPort, ExpansionMode.ALL);
} }
return expandSelectionAllAction; return expandSelectionAllAction;
} }
public ActionFactory.ExpandSelectionAction getExpandSelectionImmediateAction() { public ActionFactory.ExpandSelectionAction getExpandSelectionImmediateAction() {
if (expandSelectionImmediateAction == null) { if (expandSelectionImmediateAction == null) {
expandSelectionImmediateAction = expandSelectionImmediateAction = ActionFactory.getInstance()
ActionFactory.getInstance().createExpandSelectionAction(plugInPort, ExpansionMode.IMMEDIATE); .createExpandSelectionAction(plugInPort, ExpansionMode.IMMEDIATE);
} }
return expandSelectionImmediateAction; return expandSelectionImmediateAction;
} }
public ActionFactory.ExpandSelectionAction getExpandSelectionSameTypeAction() { public ActionFactory.ExpandSelectionAction getExpandSelectionSameTypeAction() {
if (expandSelectionSameTypeAction == null) { if (expandSelectionSameTypeAction == null) {
expandSelectionSameTypeAction = expandSelectionSameTypeAction = ActionFactory.getInstance()
ActionFactory.getInstance().createExpandSelectionAction(plugInPort, ExpansionMode.SAME_TYPE); .createExpandSelectionAction(plugInPort, ExpansionMode.SAME_TYPE);
} }
return expandSelectionSameTypeAction; return expandSelectionSameTypeAction;
} }
@@ -688,8 +716,8 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
// Try to set the visible area to be centered with the previous // Try to set the visible area to be centered with the previous
// one. // one.
double zoomFactor = (Double) params[0] / zoomLevel; double zoomFactor = (Double) params[0] / zoomLevel;
visibleRect.setBounds((int) (visibleRect.x * zoomFactor), (int) (visibleRect.y * zoomFactor), visibleRect.setBounds((int) (visibleRect.x * zoomFactor),
visibleRect.width, visibleRect.height); (int) (visibleRect.y * zoomFactor), visibleRect.width, visibleRect.height);
canvasPanel.scrollRectToVisible(visibleRect); canvasPanel.scrollRectToVisible(visibleRect);
canvasPanel.revalidate(); canvasPanel.revalidate();
@@ -717,9 +745,8 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
} }
private void refreshSize() { private void refreshSize() {
Dimension d = Dimension d = plugInPort.getCanvasDimensions(true,
plugInPort.getCanvasDimensions(true, ConfigurationManager.getInstance().readBoolean(IPlugInPort.EXTRA_SPACE_KEY, true));
ConfigurationManager.getInstance().readBoolean(IPlugInPort.EXTRA_SPACE_KEY, true));
canvasPanel.setSize(d); canvasPanel.setSize(d);
canvasPanel.setPreferredSize(d); canvasPanel.setPreferredSize(d);
getScrollPane().setZoomLevel(plugInPort.getZoomLevel()); getScrollPane().setZoomLevel(plugInPort.getZoomLevel());
@@ -729,11 +756,12 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
* Causes ruler scroll pane to refresh by sending a fake mouse moved message to the canvasPanel. * Causes ruler scroll pane to refresh by sending a fake mouse moved message to the canvasPanel.
*/ */
public void refresh() { public void refresh() {
MouseEvent event = new MouseEvent(canvasPanel, MouseEvent.MOUSE_MOVED, System.currentTimeMillis(), 0, 1, 1,// canvasPanel.getWidth() MouseEvent event =
// / new MouseEvent(canvasPanel, MouseEvent.MOUSE_MOVED, System.currentTimeMillis(), 0, 1, 1, // canvasPanel.getWidth()
// 2, // /
// canvasPanel.getHeight() / 2, // 2,
0, false); // canvasPanel.getHeight() / 2,
0, false);
canvasPanel.dispatchEvent(event); canvasPanel.dispatchEvent(event);
} }