|
|
@ -10,13 +10,15 @@ import java.awt.event.MouseAdapter; |
|
|
|
import java.awt.event.MouseEvent; |
|
|
|
import java.awt.event.MouseEvent; |
|
|
|
import java.util.function.Consumer; |
|
|
|
import java.util.function.Consumer; |
|
|
|
|
|
|
|
|
|
|
|
import static com.fine.theme.utils.FineClientProperties.BUTTON_TYPE_LEFT_ROUND_RECT; |
|
|
|
import static com.fine.theme.utils.FineClientProperties.BUTTON_BORDER; |
|
|
|
import static com.fine.theme.utils.FineClientProperties.BUTTON_TYPE_RIGHT_ROUND_RECT; |
|
|
|
import static com.fine.theme.utils.FineClientProperties.BUTTON_BORDER_LEFT_ROUND_RECT; |
|
|
|
|
|
|
|
import static com.fine.theme.utils.FineClientProperties.BUTTON_BORDER_RIGHT_ROUND_RECT; |
|
|
|
import static com.fine.theme.utils.FineUIStyle.IN_TOOLBAR_LEFT; |
|
|
|
import static com.fine.theme.utils.FineUIStyle.IN_TOOLBAR_LEFT; |
|
|
|
import static com.fine.theme.utils.FineUIStyle.IN_TOOLBAR_RIGHT; |
|
|
|
import static com.fine.theme.utils.FineUIStyle.IN_TOOLBAR_RIGHT; |
|
|
|
import static com.fine.theme.utils.FineUIStyle.STYLE_PRIMARY; |
|
|
|
import static com.fine.theme.utils.FineUIStyle.STYLE_PRIMARY; |
|
|
|
import static com.fine.theme.utils.FineUIStyle.setStyle; |
|
|
|
import static com.fine.theme.utils.FineUIStyle.setStyle; |
|
|
|
import static com.formdev.flatlaf.FlatClientProperties.BUTTON_TYPE; |
|
|
|
import static com.formdev.flatlaf.FlatClientProperties.BUTTON_TYPE; |
|
|
|
|
|
|
|
import static com.formdev.flatlaf.FlatClientProperties.BUTTON_TYPE_TOOLBAR_BUTTON; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 双按钮组件 |
|
|
|
* 双按钮组件 |
|
|
@ -69,10 +71,11 @@ public class UICombinationButton extends JPanel { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public UICombinationButton(UIButton left, UIButton right) { |
|
|
|
public UICombinationButton(UIButton left, UIButton right) { |
|
|
|
|
|
|
|
setOpaque(false); |
|
|
|
leftButton = left; |
|
|
|
leftButton = left; |
|
|
|
leftButton.putClientProperty(BUTTON_TYPE, BUTTON_TYPE_LEFT_ROUND_RECT); |
|
|
|
leftButton.putClientProperty(BUTTON_BORDER, BUTTON_BORDER_LEFT_ROUND_RECT); |
|
|
|
rightButton = right; |
|
|
|
rightButton = right; |
|
|
|
rightButton.putClientProperty(BUTTON_TYPE, BUTTON_TYPE_RIGHT_ROUND_RECT); |
|
|
|
rightButton.putClientProperty(BUTTON_BORDER, BUTTON_BORDER_RIGHT_ROUND_RECT); |
|
|
|
leftButton.addMouseListener(new MouseAdapter() { |
|
|
|
leftButton.addMouseListener(new MouseAdapter() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void mouseClicked(MouseEvent e) { |
|
|
|
public void mouseClicked(MouseEvent e) { |
|
|
@ -139,8 +142,10 @@ public class UICombinationButton extends JPanel { |
|
|
|
|
|
|
|
|
|
|
|
public void set4Toolbar() { |
|
|
|
public void set4Toolbar() { |
|
|
|
leftButton.setBorderPainted(false); |
|
|
|
leftButton.setBorderPainted(false); |
|
|
|
|
|
|
|
leftButton.putClientProperty(BUTTON_TYPE, BUTTON_TYPE_TOOLBAR_BUTTON); |
|
|
|
setStyle(leftButton, IN_TOOLBAR_LEFT); |
|
|
|
setStyle(leftButton, IN_TOOLBAR_LEFT); |
|
|
|
rightButton.setBorderPainted(false); |
|
|
|
rightButton.setBorderPainted(false); |
|
|
|
|
|
|
|
rightButton.putClientProperty(BUTTON_TYPE, BUTTON_TYPE_TOOLBAR_BUTTON); |
|
|
|
setStyle(rightButton, IN_TOOLBAR_RIGHT); |
|
|
|
setStyle(rightButton, IN_TOOLBAR_RIGHT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|