Java Code Examples for javax.swing.JLabel.addMouseMotionListener()

The following are Jave code examples for showing how to use addMouseMotionListener() of the javax.swing.JLabel class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: jmt   File: KMeansInfoClustering.java   View Source Code Vote up 5 votes
private JLabel setPie1() {
	int[] angle = new int[numClust];
	double[] prc = info.percent;
	int i;

	angle[0] = 0;
	for (i = 1; i < numClust; i++) {
		angle[i] = angle[i - 1] + (int) ((360) * prc[i - 1]);
	}
	for (; i < angle.length; i++) {
		angle[i] = 360;
	}
	final JLabel l = new JLabel();
	final pieChartIcon p = new pieChartIcon(numClust);
	l.addMouseMotionListener(new MouseMotionAdapter() {
		@Override
		public void mouseMoved(MouseEvent e) {
			int pos;

			pos = p.getPosXY(e.getX(), e.getY());

			if (pos != -1) {
				l.setToolTipText(tableClusters.getValueAt(pos, 2).toString());
			} else {
				l.setToolTipText("");
			}
		}
	});
	p.setAngle(angle);
	l.setIcon(p);
	return l;
}
 
Example 2
Project: jmt   File: KMeansInfoClustering.java   View Source Code Vote up 5 votes
private JLabel setPie2(int var) {
	int[] angle = new int[numClust];
	int i;

	angle[0] = 0;
	for (i = 1; i < numClust; i++) {
		angle[i] = angle[i - 1] + (int) ((360) * info.infoCluster[i].percVar[var]);
	}
	for (; i < angle.length; i++) {
		angle[i] = 360;
	}

	final JLabel l = new JLabel();
	pieChartVars = new pieChartIcon(numClust);
	l.addMouseMotionListener(new MouseMotionAdapter() {
		@Override
		public void mouseMoved(MouseEvent e) {
			int pos;

			pos = pieChartVars.getPosXY(e.getX(), e.getY());

			if (pos != -1) {
				l.setToolTipText(tableVars.getValueAt(pos, 1).toString());
			} else {
				l.setToolTipText("");
			}
		}
	});
	pieChartVars.setAngle(angle);
	l.setIcon(pieChartVars);
	return l;
}
 
Example 3
Project: QN-ACTR-Release   File: KMeansInfoClustering.java   View Source Code Vote up 5 votes
private JLabel setPie1() {
	int[] angle = new int[numClust];
	double[] prc = info.percent;
	int i;

	angle[0] = 0;
	for (i = 1; i < numClust; i++) {
		angle[i] = angle[i - 1] + (int) ((360) * prc[i - 1]);
	}
	for (; i < angle.length; i++) {
		angle[i] = 360;
	}
	final JLabel l = new JLabel();
	final pieChartIcon p = new pieChartIcon(numClust);
	l.addMouseMotionListener(new MouseMotionAdapter() {
		@Override
		public void mouseMoved(MouseEvent e) {
			int pos;

			pos = p.getPosXY(e.getX(), e.getY());

			if (pos != -1) {
				l.setToolTipText(tableClusters.getValueAt(pos, 2).toString());
			} else {
				l.setToolTipText("");
			}
		}
	});
	p.setAngle(angle);
	l.setIcon(p);
	return l;
}
 
Example 4
Project: QN-ACTR-Release   File: KMeansInfoClustering.java   View Source Code Vote up 5 votes
private JLabel setPie2(int var) {
	int[] angle = new int[numClust];
	int i;

	angle[0] = 0;
	for (i = 1; i < numClust; i++) {
		angle[i] = angle[i - 1] + (int) ((360) * info.infoCluster[i].percVar[var]);
	}
	for (; i < angle.length; i++) {
		angle[i] = 360;
	}

	final JLabel l = new JLabel();
	pieChartVars = new pieChartIcon(numClust);
	l.addMouseMotionListener(new MouseMotionAdapter() {
		@Override
		public void mouseMoved(MouseEvent e) {
			int pos;

			pos = pieChartVars.getPosXY(e.getX(), e.getY());

			if (pos != -1) {
				l.setToolTipText(tableVars.getValueAt(pos, 1).toString());
			} else {
				l.setToolTipText("");
			}
		}
	});
	pieChartVars.setAngle(angle);
	l.setIcon(pieChartVars);
	return l;
}