Merge branch 'master' of F000L/java-org.hwo.ui into master

JDiaAutoScaleFix
Harald Wolff 2018-02-07 18:02:06 +01:00 committed by Gogs
commit e75b8cee72
2 changed files with 19 additions and 4 deletions

View File

@ -25,7 +25,9 @@ public class JColoredToggleButton extends JLabel {
*/ */
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private Color colorOff = getBackground(); 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; private boolean selected = false;
@ -82,11 +84,11 @@ public class JColoredToggleButton extends JLabel {
public void paint(Graphics g) { public void paint(Graphics g) {
if (this.selected) { if (this.selected) {
setBackground(colorOn); setBackground(colorOn);
setForeground(colorOff); setForeground(textColorOn);
} }
else { else {
setBackground(colorOff); setBackground(colorOff);
setForeground(colorOn); setForeground(textColorOff);
} }
super.paint(g); super.paint(g);
} }
@ -98,6 +100,13 @@ public class JColoredToggleButton extends JLabel {
this.colorOff = colorOff; this.colorOff = colorOff;
} }
public Color getTextColorOff() {
return this.textColorOff;
}
public void setTextColorOff(Color textColorOff) {
this.textColorOff = textColorOff;
}
public Color getColorOn() { public Color getColorOn() {
return colorOn; return colorOn;
} }
@ -105,5 +114,11 @@ public class JColoredToggleButton extends JLabel {
this.colorOn = colorOn; this.colorOn = colorOn;
} }
public Color getTextColorOn() {
return this.textColorOn;
}
public void setTextColorOn(Color textColorOn) {
this.textColorOn = textColorOn;
}
} }

View File

@ -664,9 +664,9 @@ public class JDiagram extends JComponent implements PlotProviderListener, Bounde
} }
public Point2D mapMouseToDiagram(Point p,int ordinate) { public Point2D mapMouseToDiagram(Point p,int ordinate) {
double x,y; double x,y;
int xl = (getWidth() - bRight - plotWidth); int xl = (getWidth() - bRight - plotWidth);
ordinate = ordinate >= ordinateViews.length? ordinateViews.length - 1 : ordinate;
x = this.abszissMinimum + (((p.getX() - xl) / plotWidth) * this.abszissWindow); x = this.abszissMinimum + (((p.getX() - xl) / plotWidth) * this.abszissWindow);
// TODO implement reverse mapping into scaler interface ??!! // TODO implement reverse mapping into scaler interface ??!!