From ce1d3463eafac0c02e3bb22c010b11e509bc9ee9 Mon Sep 17 00:00:00 2001 From: Vincenzo Palazzo Date: Sun, 20 Sep 2020 11:38:35 +0200 Subject: [PATCH] #150 Bug Fixed Signed-off-by: Vincenzo Palazzo --- build.gradle | 2 ++ .../components/spinner/MaterialSpinnerUI.java | 10 +--------- .../java/integration/gui/mock/DemoGUITest.java | 14 +++++++++++++- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index 4cc6e39..c5861ad 100644 --- a/build.gradle +++ b/build.gradle @@ -25,6 +25,8 @@ dependencies { testCompile 'junit:junit:4.12' testCompile group: 'org.assertj', name: 'assertj-swing-junit', version: '3.9.2' testCompile 'io.github.material-ui-swing:DarkStackOverflowTheme:0.0.1-rc2' + testCompile group: 'com.toedter', name: 'jcalendar', version: '1.4' + } allprojects { diff --git a/src/main/java/mdlaf/components/spinner/MaterialSpinnerUI.java b/src/main/java/mdlaf/components/spinner/MaterialSpinnerUI.java index 550eaaa..6f0f2be 100644 --- a/src/main/java/mdlaf/components/spinner/MaterialSpinnerUI.java +++ b/src/main/java/mdlaf/components/spinner/MaterialSpinnerUI.java @@ -50,7 +50,6 @@ public static ComponentUI createUI(JComponent c) { @Override public void installUI(JComponent c) { super.installUI(c); - this.spinnerBackground = UIManager.getColor("Spinner.background"); this.spinnerDisableBackground = UIManager.getColor("Spinner.disabledBackground"); } @@ -64,11 +63,6 @@ public void uninstallUI(JComponent c) { @Override public void paint(Graphics g, JComponent c) { super.paint(g, c); - if(!c.isEnabled()){ - ((JSpinner.DefaultEditor)spinner.getEditor()).getTextField().setBackground(spinnerDisableBackground); - }else{ - ((JSpinner.DefaultEditor)spinner.getEditor()).getTextField().setBackground(spinnerBackground); - } } @Override @@ -132,9 +126,7 @@ protected void paintFocusRing(Graphics g, JButton b) { } @Override - protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect) { - - } + protected void paintFocus(Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect) {} } } diff --git a/src/test/java/integration/gui/mock/DemoGUITest.java b/src/test/java/integration/gui/mock/DemoGUITest.java index bd66e20..98b2c01 100644 --- a/src/test/java/integration/gui/mock/DemoGUITest.java +++ b/src/test/java/integration/gui/mock/DemoGUITest.java @@ -23,6 +23,7 @@ */ package integration.gui.mock; +import com.toedter.calendar.JDateChooser; import integration.gui.mock.component.*; import integration.gui.mock.uiexample.button.ContainedButtonUI; import io.materialtheme.darkstackoverflow.DarkStackOverflowTheme; @@ -42,6 +43,7 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.io.File; +import java.util.Date; /** * @author https://github.com/vincenzopalazzo @@ -123,11 +125,13 @@ public class DemoGUITest extends JFrame { //TabbedPane test mouse hover on Tab JPanel tabbedPanetest = new DemoPanelWithTabbedPane(); + //ToolBar Tab pane private JToolBar toolBarEditor; - private JPanel buttonsPanel; private JButton containedTypeButton; + //JCalendar demo tab + JDateChooser dateNasc; public JMenuItem getMaterialOceanic() { return materialOceanic; @@ -225,6 +229,13 @@ public void actionPerformed(ActionEvent e) { JPanel panelToolBar = new JPanel(); panelToolBar.add(toolBarEditor); + JPanel calendarPanel = new JPanel(); + dateNasc = new JDateChooser(); + dateNasc.setDateFormatString("dd/MM/yyyy"); + dateNasc.setMaxSelectableDate(new Date()); + dateNasc.setDate(new Date()); + calendarPanel.add(dateNasc); + initStyleMouseHoverPanel(); initLayoutContentPanelOne(); @@ -247,6 +258,7 @@ public void actionPerformed(ActionEvent e) { tabbedPane.add(panelToolBar, "ToolBar"); tabbedPane.add(new ChooseValueComponentViewPanel(), "Choose Component"); tabbedPane.add(buttonsPanel, "Button Type"); + tabbedPane.add(calendarPanel, "JCalendar"); this.setContentPane(tabbedPane); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);