@ -3,8 +3,7 @@ package com.fr.design.gui.ibutton;
import javax.swing.Icon ;
import javax.swing.JPanel ;
import java.awt.BorderLayout ;
import java.awt.event.MouseAdapter ;
import java.awt.event.MouseEvent ;
import java.awt.event.ActionEvent ;
import java.util.function.Consumer ;
import static com.fine.theme.utils.FineClientProperties.BUTTON_BORDER ;
@ -33,8 +32,8 @@ public class UICombinationButton extends JPanel {
protected UIButton rightButton ;
private Consumer < Mouse Event> leftClickLister ;
private Consumer < Mouse Event> rightClickLister ;
private Consumer < Action Event> leftClickLister ;
private Consumer < Action Event> rightClickLister ;
protected void leftButtonClickEvent ( ) {
// 左边按钮点击事件
@ -54,7 +53,7 @@ public class UICombinationButton extends JPanel {
*
* @param lister 监听
* /
public void addLeftClickList er ( Consumer < Mouse Event> lister ) {
public void addLeftActionListen er ( Consumer < Action Event> lister ) {
this . leftClickLister = lister ;
}
@ -63,7 +62,7 @@ public class UICombinationButton extends JPanel {
*
* @param lister 监听
* /
public void addRightClickList er ( Consumer < Mouse Event> lister ) {
public void addRightActionListen er ( Consumer < Action Event> lister ) {
this . rightClickLister = lister ;
}
@ -73,25 +72,18 @@ public class UICombinationButton extends JPanel {
leftButton . putClientProperty ( BUTTON_BORDER , BUTTON_BORDER_LEFT_ROUND_RECT ) ;
rightButton = right ;
rightButton . putClientProperty ( BUTTON_BORDER , BUTTON_BORDER_RIGHT_ROUND_RECT ) ;
leftButton . addMouseListener ( new MouseAdapter ( ) {
@Override
public void mouseClicked ( MouseEvent e ) {
if ( leftClickLister ! = null ) {
leftClickLister . accept ( e ) ;
} else {
leftButtonClickEvent ( ) ;
}
leftButton . addActionListener ( e - > {
if ( leftClickLister ! = null ) {
leftClickLister . accept ( e ) ;
} else {
leftButtonClickEvent ( ) ;
}
} ) ;
rightButton . addMouseListener ( new MouseAdapter ( ) {
@Override
public void mouseClicked ( MouseEvent e ) {
if ( rightClickLister ! = null ) {
rightClickLister . accept ( e ) ;
} else {
rightButtonClickEvent ( ) ;
}
rightButton . addActionListener ( e - > {
if ( rightClickLister ! = null ) {
rightClickLister . accept ( e ) ;
} else {
rightButtonClickEvent ( ) ;
}
} ) ;