Skip to content

Commit 8c48cda

Browse files
author
atarw
committed
updated MaterialUIMovement to become more like a factory, updated fonts
too
1 parent de1877b commit 8c48cda

File tree

7 files changed

+183
-148
lines changed

7 files changed

+183
-148
lines changed

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/workspace.xml

Lines changed: 84 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/material-ui-swing.jar

-540 Bytes
Binary file not shown.

src/MaterialUISwingDemo.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,18 @@ public static void main (String[] args) {
5454
frame.add (content, BorderLayout.CENTER);
5555

5656
// start animating!
57-
// in the first example, new Color (230, 230, 230) is the color that the JComponent will transition to when the user hovers over it
57+
// here, 'gray' is the color that the JComponent will transition to when the user hovers over it
5858
// there will be 5 intermediate colors displayed in the transition from the original component color to the new one specified
5959
// the "frame rate" of the transition will be 1000 / 30, or 30 FPS
6060
// the animation will take 5 * 1000 / 30 = 166.666... milliseconds to complete
61-
MaterialUIMovement animate = new MaterialUIMovement (new Color (230, 230, 230), 5, 1000 / 30);
62-
animate.add (menu1);
63-
animate.add (item1);
61+
Color gray = new Color (230, 230, 230);
62+
MaterialUIMovement.add (menu1, gray, 5, 1000 / 30);
63+
MaterialUIMovement.add (item1, gray, 5, 1000 / 30);
6464

6565
// you can probably figure out what this does based on the explanation above
66-
// note that we used the same MaterialUIMovement object for menu1 and item1, but a different one for the button,
67-
// as it fades to a different color
68-
MaterialUIMovement animate2 = new MaterialUIMovement (new Color (34, 167, 240), 5, 1000 / 30);
69-
animate2.add (button);
66+
// the only difference is a new color
67+
Color blue = new Color (34, 167, 240);
68+
MaterialUIMovement.add (button, blue, 5, 1000 / 30);
7069

7170
// make everything visible to the world
7271
frame.pack ();

src/mdlaf/MaterialLookAndFeel.java

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,24 @@ protected void initSystemColorDefaults (UIDefaults table) {
5656
protected void initComponentDefaults (UIDefaults table) {
5757
super.initComponentDefaults (table);
5858

59+
System.setProperty ("awt.useSystemAAFontSettings", "lcd");
60+
System.setProperty ("swing.aatext", "true");
61+
5962
table.put ("Button.font", MaterialFonts.MEDIUM);
60-
table.put ("RadioButton.font", MaterialFonts.LIGHT);
61-
table.put ("CheckBox.font", MaterialFonts.LIGHT);
62-
table.put ("ComboBox.font", MaterialFonts.LIGHT);
63-
table.put ("Label.font", MaterialFonts.LIGHT);
63+
table.put ("RadioButton.font", MaterialFonts.REGULAR);
64+
table.put ("CheckBox.font", MaterialFonts.REGULAR);
65+
table.put ("ComboBox.font", MaterialFonts.REGULAR);
66+
table.put ("Label.font", MaterialFonts.REGULAR);
6467
table.put ("MenuBar.font", MaterialFonts.BOLD);
6568
table.put ("MenuItem.font", MaterialFonts.MEDIUM);
6669
table.put ("Menu.font", MaterialFonts.BOLD);
67-
table.put ("OptionPane.font", MaterialFonts.LIGHT);
68-
table.put ("Panel.font", MaterialFonts.LIGHT);
69-
table.put ("ScrollPane.font", MaterialFonts.LIGHT);
70-
table.put ("Table.font", MaterialFonts.LIGHT);
71-
table.put ("TableHeader.font", MaterialFonts.LIGHT);
72-
table.put ("TextField.font", MaterialFonts.MEDIUM);
73-
table.put ("TextArea.font", MaterialFonts.MEDIUM);
70+
table.put ("OptionPane.font", MaterialFonts.REGULAR);
71+
table.put ("Panel.font", MaterialFonts.REGULAR);
72+
table.put ("ScrollPane.font", MaterialFonts.REGULAR);
73+
table.put ("Table.font", MaterialFonts.REGULAR);
74+
table.put ("TableHeader.font", MaterialFonts.REGULAR);
75+
table.put ("TextField.font", MaterialFonts.REGULAR);
76+
table.put ("TextArea.font", MaterialFonts.REGULAR);
7477

7578
Border menuBorder = new DropShadowBorder (Color.BLACK, 0, 5, 0.3f, 12, true, true, true, true);
7679
Border defaultBorder = new DropShadowBorder (Color.BLACK, 5, 5, 0.3f, 12, true, true, true, true);

0 commit comments

Comments
 (0)