cross cursor
This commit is contained in:
parent
f5a60d9611
commit
a7de69b6bb
@ -1,4 +1,4 @@
|
||||
#Mon, 17 Apr 2017 07:45:53 +0200
|
||||
#Tue, 18 Apr 2017 08:01:58 +0200
|
||||
annotation.processing.enabled=true
|
||||
annotation.processing.enabled.in.editor=false
|
||||
annotation.processing.processors.list=
|
||||
|
@ -14,6 +14,9 @@
|
||||
</Property>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="mouseMoved" listener="java.awt.event.MouseMotionListener" parameters="java.awt.event.MouseEvent" handler="formMouseMoved"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
|
@ -500,6 +500,9 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
|
||||
return;
|
||||
}
|
||||
|
||||
// Point m = MouseInfo.getPointerInfo().getLocation() ;
|
||||
// g.drawLine(0, m.y, 1000, m.y);
|
||||
|
||||
int pwidth = (int) (em_width * x_unit_width * (num_bars + 1)) + clip_bounds.width;
|
||||
|
||||
this.setPreferredSize(new Dimension(pwidth, gdim.height));
|
||||
@ -699,6 +702,11 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
|
||||
setOpaque(false);
|
||||
setPreferredSize(new java.awt.Dimension(300, 300));
|
||||
setRequestFocusEnabled(false);
|
||||
addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
|
||||
public void mouseMoved(java.awt.event.MouseEvent evt) {
|
||||
formMouseMoved(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
@ -712,6 +720,10 @@ public class Chart extends javax.swing.JPanel implements QuoteReceiver, Scrollab
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void formMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseMoved
|
||||
|
||||
}//GEN-LAST:event_formMouseMoved
|
||||
|
||||
@Override
|
||||
public void UpdateQuote(Quote q) {
|
||||
this.repaint();
|
||||
|
@ -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"/>
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user