Closed TheRolfFR closed 5 years ago
Hello @TheRolfFR,
What is your desiderated effect??
When you click on the ComboBox you have an effect of "focus" on the combo box, so if you want the border black you can add this code inside your method. With the method, installUIDefault of the AbstractMaterialTheme is a raping method for using the UIDefaults
@Override
public void installUIDefault(UIDefaults table){
table.put("ComboBox.unfocusColor", YOUR_COLOR_BORDERD_WHEN_IS_UNFOCUS);
table.put("ComboBox.focusColor", YOUR_COLOR_BORDERD_WHEN_IS_FOCUS);
}
For the default setting the color, focus border is equal to theme.getHighlightBackgroundPrimary()
The problem is that I don't want any border at all 😄 There is also this weird chevron movement due to a inside empty border / padding reappearing from nowhere.
What I updated currently is that the color is the same as the background color :
table.put("ComboBox.unfocusColor", BACKGROUND_COLOR);
table.put("ComboBox.focusColor", BACKGROUND_COLOR);
But this should not be a definitive solution. Is there any other key I can replace in the table? Do you have some documentation I can see?
Thanks already.
@TheRolfFR with order :)
Thanks for finded the bug :smile:
After searching through the UI, I found this:
protected class FocusListenerColor implements FocusListener {
private Border focus;
private Border unfocus;
public FocusListenerColor() {
focus = MaterialBorders.roundedLineColorBorder(UIManager.getColor("ComboBox.focusColor"), arc);
unfocus = MaterialBorders.roundedLineColorBorder(UIManager.getColor("ComboBox.unfocusColor"), arc);
}
@Override
public void focusGained(FocusEvent e) {
if (e.getComponent() == null) {
return;
}
JComboBox cb = (JComboBox) e.getComponent();
if (focus != null) {
cb.setBorder(focus);
cb.repaint();
}
}
@Override
public void focusLost(FocusEvent e) {
if (e.getComponent() == null) {
return;
}
JComboBox cb = (JComboBox) e.getComponent();
if (unfocus != null) {
cb.setBorder(unfocus);
cb.repaint();
}
}
}
Here on this file. And the thing is that no matter what I will try , it will always comeback to a RoundedLineColorBorder. So I don't know if it helps you but What I would need is a way to put custom border on focus or not, see 🤔 ?
Yes, the bug is inside here class but because exist this codecomboBox.setFocusable(true);
, this is always focusable.
In the next commit, I fix the bug I will if also this issue https://github.com/vincenzopalazzo/material-ui-swing/issues/72:)
Hi @TheRolfFR, I have fixed this problem in version 1.0.3
I will happy if when you finish your theme, publish it with our for creating a repository of theme if you want you can create the pull request in this branch for testing it with the all library
Okay yes why not publish it! I'll try to fix my problem and I will come back to tell if it works!
So it seems like the arrow is still shrinking but I would call this a fix.
Thanks
Hello there, I have made a little program with your nice package but I have a bug with my combo box :
I don't know why it is coming back to this coloured rounded corner, and I have tried to modify the arch methods but nothing :(.
The whole code is available here : https://github.com/TheRolfFR/ExternalInput And the theme is here : https://github.com/TheRolfFR/ExternalInput/blob/master/org/therolf/ExternalInput/MaterialDarkTheme.java
Thanks in advance 😄 .