Skip to content

Commit 4368a15

Browse files
github conflict resolution
1 parent 6e87f00 commit 4368a15

File tree

1 file changed

+46
-31
lines changed

1 file changed

+46
-31
lines changed
Lines changed: 46 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,65 @@
11
package mdlaf.components.combobox;
22

3-
import mdlaf.resources.MaterialDrawingUtils;
3+
import java.awt.Cursor;
4+
import java.awt.Graphics;
5+
import java.awt.Rectangle;
46

5-
import javax.swing.*;
7+
import javax.swing.BorderFactory;
8+
import javax.swing.ImageIcon;
9+
import javax.swing.JButton;
10+
import javax.swing.JComboBox;
11+
import javax.swing.JComponent;
612
import javax.swing.plaf.ComponentUI;
7-
import javax.swing.plaf.basic.BasicArrowButton;
813
import javax.swing.plaf.basic.BasicComboBoxUI;
9-
import java.awt.*;
1014

11-
public class MaterialComboBoxUI extends BasicComboBoxUI {
15+
import com.sun.corba.se.impl.protocol.BootstrapServerRequestDispatcher;
1216

13-
public static ComponentUI createUI (JComponent c) {
14-
return new MaterialComboBoxUI ();
15-
}
17+
import mdlaf.resources.MaterialBorders;
18+
import mdlaf.resources.MaterialColors;
19+
import mdlaf.resources.MaterialDrawingUtils;
20+
import mdlaf.resources.MaterialFonts;
21+
import mdlaf.resources.MaterialImages;
1622

17-
@Override
18-
public void installUI (JComponent c) {
19-
super.installUI (c);
23+
/**
24+
*
25+
* @author https://github.com/vincenzopalazzo
26+
*
27+
*/
2028

21-
JComboBox<?> comboBox = (JComboBox<?>) c;
22-
comboBox.setFont (UIManager.getFont ("ComboBox.font"));
23-
comboBox.setBackground (UIManager.getColor ("ComboBox.background"));
24-
comboBox.setForeground (UIManager.getColor ("ComboBox.foreground"));
25-
comboBox.setBorder (UIManager.getBorder ("ComboBox.border"));
26-
comboBox.setLightWeightPopupEnabled (true);
27-
comboBox.setRenderer (new MaterialComboBoxRenderer ());
29+
public class MaterialComboBoxUI extends BasicComboBoxUI{
30+
31+
public static ComponentUI createUI(JComponent c) {
32+
return new MaterialComboBoxUI();
2833
}
2934

3035
@Override
31-
protected JButton createArrowButton () {
32-
Icon icon = UIManager.getIcon("ComboBox.buttonIcon");
33-
JButton button;
34-
if (icon != null) {
35-
button = new JButton(icon);
36-
} else {
37-
button = new BasicArrowButton(SwingConstants.SOUTH);
38-
}
39-
button.setOpaque (true);
40-
button.setBackground (UIManager.getColor ("ComboBox.buttonBackground"));
41-
button.setBorder (BorderFactory.createEmptyBorder ());
36+
public void installUI(JComponent c) {
37+
super.installUI(c);
38+
JComboBox<?> comboBox = (JComboBox<?>) c;
39+
comboBox.setFont(MaterialFonts.BLACK_ITALIC);
40+
comboBox.setBackground(MaterialColors.GRAY_300);
41+
comboBox.setForeground(MaterialColors.GRAY_800);
42+
comboBox.setBorder(BorderFactory.createEmptyBorder());
43+
comboBox.setRenderer(new MaterialComboBoxRender());
44+
}
4245

46+
@Override
47+
protected JButton createArrowButton() {
48+
JButton button = new JButton(new ImageIcon(MaterialImages.DOWN_ARROW));
49+
button.setOpaque(true);
50+
button.setBorder(BorderFactory.createEmptyBorder());
51+
button.setBackground(MaterialColors.GRAY_300);
4352
return button;
4453
}
4554

4655
@Override
47-
public void paint (Graphics g, JComponent c) {
48-
super.paint (MaterialDrawingUtils.getAliasedGraphics (g), c);
56+
public void paint(Graphics g, JComponent c) {
57+
super.paint(MaterialDrawingUtils.getAliasedGraphics(g), c);
4958
}
59+
60+
61+
62+
63+
64+
5065
}

0 commit comments

Comments
 (0)