added textColorOn/Off in JColeredToggleButton & added bounds to in mapMouseToDiagram in JDiagram
parent
6b36943144
commit
34b6b52d43
|
@ -25,7 +25,9 @@ public class JColoredToggleButton extends JLabel {
|
|||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Color colorOff = getBackground();
|
||||
private Color colorOn = Color.BLUE;
|
||||
private Color colorOn = Color.ORANGE;
|
||||
private Color textColorOff = Color.BLACK;
|
||||
private Color textColorOn = Color.GREEN;
|
||||
|
||||
private boolean selected = false;
|
||||
|
||||
|
@ -82,11 +84,11 @@ public class JColoredToggleButton extends JLabel {
|
|||
public void paint(Graphics g) {
|
||||
if (this.selected) {
|
||||
setBackground(colorOn);
|
||||
setForeground(colorOff);
|
||||
setForeground(textColorOn);
|
||||
}
|
||||
else {
|
||||
setBackground(colorOff);
|
||||
setForeground(colorOn);
|
||||
setForeground(textColorOff);
|
||||
}
|
||||
super.paint(g);
|
||||
}
|
||||
|
@ -98,6 +100,13 @@ public class JColoredToggleButton extends JLabel {
|
|||
this.colorOff = colorOff;
|
||||
}
|
||||
|
||||
public Color getTextColorOff() {
|
||||
return this.textColorOff;
|
||||
}
|
||||
public void setTextColorOff(Color textColorOff) {
|
||||
this.textColorOff = textColorOff;
|
||||
}
|
||||
|
||||
public Color getColorOn() {
|
||||
return colorOn;
|
||||
}
|
||||
|
@ -105,5 +114,11 @@ public class JColoredToggleButton extends JLabel {
|
|||
this.colorOn = colorOn;
|
||||
}
|
||||
|
||||
public Color getTextColorOn() {
|
||||
return this.textColorOn;
|
||||
}
|
||||
public void setTextColorOn(Color textColorOn) {
|
||||
this.textColorOn = textColorOn;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -664,9 +664,9 @@ public class JDiagram extends JComponent implements PlotProviderListener, Bounde
|
|||
}
|
||||
public Point2D mapMouseToDiagram(Point p,int ordinate) {
|
||||
double x,y;
|
||||
|
||||
int xl = (getWidth() - bRight - plotWidth);
|
||||
|
||||
ordinate = ordinate >= ordinateViews.length? ordinateViews.length - 1 : ordinate;
|
||||
|
||||
x = this.abszissMinimum + (((p.getX() - xl) / plotWidth) * this.abszissWindow);
|
||||
// TODO implement reverse mapping into scaler interface ??!!
|
||||
|
|
Loading…
Reference in New Issue