|
|
@ -11,6 +11,7 @@ import com.fr.design.style.color.ColorSelectDialog; |
|
|
|
import com.fr.design.style.color.ColorSelectable; |
|
|
|
import com.fr.design.style.color.ColorSelectable; |
|
|
|
import com.fr.stable.AssistUtils; |
|
|
|
import com.fr.stable.AssistUtils; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fr.stable.os.OperatingSystem; |
|
|
|
import javax.swing.JComponent; |
|
|
|
import javax.swing.JComponent; |
|
|
|
import javax.swing.event.ChangeEvent; |
|
|
|
import javax.swing.event.ChangeEvent; |
|
|
|
import javax.swing.event.ChangeListener; |
|
|
|
import javax.swing.event.ChangeListener; |
|
|
@ -124,14 +125,20 @@ public class GradientBar extends JComponent implements UIObserver, ColorSelectab |
|
|
|
protected void addMouseDragListener() { |
|
|
|
protected void addMouseDragListener() { |
|
|
|
this.addMouseMotionListener(new MouseAdapter() { |
|
|
|
this.addMouseMotionListener(new MouseAdapter() { |
|
|
|
public void mouseDragged(MouseEvent e) { |
|
|
|
public void mouseDragged(MouseEvent e) { |
|
|
|
|
|
|
|
int oldIndex = index; |
|
|
|
for (int i = 0; i < list.size(); i++) { |
|
|
|
for (int i = 0; i < list.size(); i++) { |
|
|
|
if (list.get(i).contains(e.getX(), e.getY())) { |
|
|
|
if (list.get(i).contains(e.getX(), e.getY())) { |
|
|
|
index = i; |
|
|
|
index = i; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if(OperatingSystem.isLinux() && AssistUtils.equals(oldIndex,index)){ |
|
|
|
|
|
|
|
if(Math.abs(p1.getX() - e.getX()) > Math.abs(p2.getX() - e.getX())){ |
|
|
|
|
|
|
|
index = 1; |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
index = 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
boolean x = e.getX() <= max && e.getX() >= min; |
|
|
|
boolean x = e.getX() <= max && e.getX() >= min; |
|
|
|
if (x && e.getY() < MAX_VERTICAL) { |
|
|
|
if (x && e.getY() < MAX_VERTICAL) { |
|
|
|
list.get(index).setX(e.getX()); |
|
|
|
list.get(index).setX(e.getX()); |
|
|
|