Skip to content

Commit 90f7d58

Browse files
Added support to EditorPane
1 parent e1a51c5 commit 90f7d58

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

src/MaterialUISwingDemo.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ public static void main (String[] args) {
121121
pn.add(textPane);
122122
pn.add(textPane1);
123123

124+
JEditorPane editorPane = new JEditorPane();
125+
editorPane.setText("This theme is fantastic");
126+
pn.add(editorPane);
127+
124128
// make everything visible to the world
125129
frame.pack ();
126130
frame.setVisible (true);

src/mdlaf/MaterialLookAndFeel.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public class MaterialLookAndFeel extends MetalLookAndFeel {
6262
private static final String radioButtonMenuItemUI = MaterialRadioButtonMenuItemUI.class.getCanonicalName();
6363
private static final String checkBoxMenuItemUI = MaterialCheckBoxMenuItemUI.class.getCanonicalName();
6464
private static final String textPaneUI = MaterialTextPaneUI.class.getCanonicalName();
65+
private static final String editorPane = MaterialTextPaneUI.class.getCanonicalName();
6566

6667
@Override
6768
public String getName () {
@@ -116,6 +117,7 @@ protected void initClassDefaults (UIDefaults table) {
116117
table.put("RadioButtonMenuItemUI", radioButtonMenuItemUI);
117118
table.put("CheckBoxMenuItemUI", checkBoxMenuItemUI);
118119
table.put("TextPaneUI", textPaneUI);
120+
table.put("EditorPaneUI", editorPane);
119121
}
120122

121123
@Override
@@ -290,5 +292,11 @@ protected void initComponentDefaults (UIDefaults table) {
290292
table.put("TextPane.selectionBackground", MaterialColors.LIGHT_BLUE_200);
291293
table.put("TextPane.inactiveForeground", MaterialColors.GRAY_500);
292294
table.put("TextPane.font", MaterialFonts.BLACK_ITALIC);
295+
296+
table.put("EditorPane.border", MaterialBorders.DEFAULT_SHADOW_BORDER);
297+
table.put("EditorPane.background", MaterialColors.GRAY_50);
298+
table.put("EditorPane.selectionBackground", MaterialColors.LIGHT_BLUE_200);
299+
table.put("EditorPane.inactiveForeground", MaterialColors.GRAY_500);
300+
table.put("EditorPane.font", MaterialFonts.BLACK_ITALIC);
293301
}
294302
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package mdlaf.components.editorpane;
2+
3+
import javax.swing.*;
4+
import javax.swing.plaf.ComponentUI;
5+
import javax.swing.plaf.basic.BasicEditorPaneUI;
6+
7+
/**
8+
*
9+
* @author https://github.com/vincenzopalazzo
10+
*
11+
*/
12+
13+
public class MaterialEditorPaneUI extends BasicEditorPaneUI {
14+
15+
public static ComponentUI createUI(JComponent c){
16+
return new MaterialEditorPaneUI();
17+
}
18+
19+
@Override
20+
public void installUI(JComponent c) {
21+
super.installUI(c);
22+
}
23+
}

0 commit comments

Comments
 (0)