cross cursor

This commit is contained in:
7u83
2017-04-18 08:20:44 +02:00
parent f5a60d9611
commit a7de69b6bb
5 changed files with 58 additions and 2 deletions

View File

@ -65,9 +65,12 @@
</Component>
</NonVisualComponents>
<Events>
<EventHandler event="mouseMoved" listener="java.awt.event.MouseMotionListener" parameters="java.awt.event.MouseEvent" handler="formMouseMoved"/>
<EventHandler event="mouseWheelMoved" listener="java.awt.event.MouseWheelListener" parameters="java.awt.event.MouseWheelEvent" handler="formMouseWheelMoved"/>
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="formMousePressed"/>
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="formMouseReleased"/>
<EventHandler event="mouseExited" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="formMouseExited"/>
<EventHandler event="mouseEntered" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="formMouseEntered"/>
</Events>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>

View File

@ -7,6 +7,7 @@ package gui;
import chart.Chart;
import java.awt.Color;
import java.awt.Cursor;
import java.util.ArrayList;
import java.util.Objects;
import javax.swing.ButtonGroup;
@ -22,6 +23,14 @@ import sesim.OHLCData;
*/
public class MainChart extends chart.Chart {
class MyCursor extends Cursor{
public MyCursor(int type) {
super(type);
}
}
ButtonGroup typeGroup=new ButtonGroup();
/**
@ -31,6 +40,10 @@ public class MainChart extends chart.Chart {
System.out.printf("This is the main chart constructor\n");
initComponents();
//
//setCursor(new Cursor(Cursor.HAND_CURSOR));
setCursor(new MyCursor(Cursor.CROSSHAIR_CURSOR));
initCtxMenu();
@ -62,7 +75,7 @@ public class MainChart extends chart.Chart {
vol.padding_top = 0.08f;
vol.type = ChartType.VOL;
vol.data = data;
// vol.bgcolor = Color.GRAY;
vol.bgcolor = new Color(230,230,235);
addChart(vol);
}
@ -238,6 +251,11 @@ public class MainChart extends chart.Chart {
});
ctxMenu.add(logMenu);
addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
public void mouseMoved(java.awt.event.MouseEvent evt) {
formMouseMoved(evt);
}
});
addMouseWheelListener(new java.awt.event.MouseWheelListener() {
public void mouseWheelMoved(java.awt.event.MouseWheelEvent evt) {
formMouseWheelMoved(evt);
@ -250,6 +268,12 @@ public class MainChart extends chart.Chart {
public void mouseReleased(java.awt.event.MouseEvent evt) {
formMouseReleased(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
formMouseExited(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
formMouseEntered(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
@ -317,6 +341,20 @@ public class MainChart extends chart.Chart {
doRedraw();
}//GEN-LAST:event_lineTypeItemItemStateChanged
private void formMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseMoved
System.out.printf("Mouse moved %d\n", evt.getLocationOnScreen().x);
this.doRedraw();
}//GEN-LAST:event_formMouseMoved
private void formMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseEntered
}//GEN-LAST:event_formMouseEntered
private void formMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseExited
// TODO add your handling code here:
}//GEN-LAST:event_formMouseExited
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JRadioButtonMenuItem candleTypeMEnuItem;