diff --git a/CHANGELOG.md b/CHANGELOG.md index 06caac06..1099fb47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ FlatLaf Change Log - ToolBar: Disable focusability of buttons in toolbar. - OptionPane: Fixed rendering of longer HTML text. (issue #12) - SwingX: Support `JXBusyLabel`, `JXDatePicker`, `JXHeader`, `JXHyperlink`, - `JXTaskPaneContainer` and `JXTaskPane`. (issue #8) + `JXMonthView`, `JXTaskPaneContainer` and `JXTaskPane`. (issue #8) ## 0.13 diff --git a/flatlaf-swingx/src/main/java/com/formdev/flatlaf/swingx/ui/FlatMonthDownIcon.java b/flatlaf-swingx/src/main/java/com/formdev/flatlaf/swingx/ui/FlatMonthDownIcon.java new file mode 100644 index 00000000..e22fb65b --- /dev/null +++ b/flatlaf-swingx/src/main/java/com/formdev/flatlaf/swingx/ui/FlatMonthDownIcon.java @@ -0,0 +1,76 @@ +/* + * Copyright 2019 FormDev Software GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.formdev.flatlaf.swingx.ui; + +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Component; +import java.awt.Graphics2D; +import java.awt.Shape; +import javax.swing.SwingConstants; +import javax.swing.UIManager; +import com.formdev.flatlaf.icons.FlatAbstractIcon; +import com.formdev.flatlaf.ui.FlatArrowButton; + +/** + * "month down" icon for {@link org.jdesktop.swingx.JXMonthView}. + * + * @uiDefault Component.arrowType String triangle (default) or chevron + * @uiDefault JXMonthView.arrowColor Color + * @uiDefault JXMonthView.disabledArrowColor Color + * + * @author Karl Tauber + */ +public class FlatMonthDownIcon + extends FlatAbstractIcon +{ + protected final boolean chevron = "chevron".equals( UIManager.getString( "Component.arrowType" ) ); + protected final Color arrowColor = UIManager.getColor( "JXMonthView.arrowColor" ); + protected final Color disabledArrowColor = UIManager.getColor( "JXMonthView.disabledArrowColor" ); + + private final int direction; + + public FlatMonthDownIcon() { + this( SwingConstants.WEST ); + } + + protected FlatMonthDownIcon( int direction ) { + super( 20, 20, null ); + this.direction = direction; + } + + @Override + protected void paintIcon( Component c, Graphics2D g ) { + int h = chevron ? 4 : 5; + int w = chevron ? 8 : 9; + int x = Math.round( (width - h) / 2f ); + int y = Math.round( (height - w) / 2f ); + + g.setColor( c.isEnabled() ? arrowColor : disabledArrowColor ); + g.translate( x, y ); + Shape arrowShape = FlatArrowButton.createArrowShape( direction, chevron, w, h ); + if( chevron ) { + // chevron arrow + g.setStroke( new BasicStroke( 1f ) ); + g.draw( arrowShape ); + } else { + // triangle arrow + g.fill( arrowShape ); + } + g.translate( -x, -y ); + } +} diff --git a/flatlaf-swingx/src/main/java/com/formdev/flatlaf/swingx/ui/FlatMonthUpIcon.java b/flatlaf-swingx/src/main/java/com/formdev/flatlaf/swingx/ui/FlatMonthUpIcon.java new file mode 100644 index 00000000..887d71e3 --- /dev/null +++ b/flatlaf-swingx/src/main/java/com/formdev/flatlaf/swingx/ui/FlatMonthUpIcon.java @@ -0,0 +1,32 @@ +/* + * Copyright 2019 FormDev Software GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.formdev.flatlaf.swingx.ui; + +import javax.swing.SwingConstants; + +/** + * "month up" icon for {@link org.jdesktop.swingx.JXMonthView}. + * + * @author Karl Tauber + */ +public class FlatMonthUpIcon + extends FlatMonthDownIcon +{ + public FlatMonthUpIcon() { + super( SwingConstants.EAST ); + } +} diff --git a/flatlaf-swingx/src/main/java/com/formdev/flatlaf/swingx/ui/FlatMonthViewUI.java b/flatlaf-swingx/src/main/java/com/formdev/flatlaf/swingx/ui/FlatMonthViewUI.java new file mode 100644 index 00000000..05a44bb9 --- /dev/null +++ b/flatlaf-swingx/src/main/java/com/formdev/flatlaf/swingx/ui/FlatMonthViewUI.java @@ -0,0 +1,80 @@ +/* + * Copyright 2019 FormDev Software GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.formdev.flatlaf.swingx.ui; + +import java.awt.Insets; +import java.util.Calendar; +import javax.swing.JComponent; +import javax.swing.border.Border; +import javax.swing.border.CompoundBorder; +import javax.swing.border.EmptyBorder; +import javax.swing.plaf.ComponentUI; +import org.jdesktop.swingx.JXMonthView; +import org.jdesktop.swingx.plaf.basic.BasicMonthViewUI; +import org.jdesktop.swingx.plaf.basic.CalendarRenderingHandler; +import org.jdesktop.swingx.plaf.basic.CalendarState; +import com.formdev.flatlaf.ui.FlatEmptyBorder; +import com.formdev.flatlaf.ui.FlatLineBorder; + +/** + * Provides the Flat LaF UI delegate for {@link org.jdesktop.swingx.JXMonthView}. + * + * @author Karl Tauber + */ +public class FlatMonthViewUI + extends BasicMonthViewUI +{ + public static ComponentUI createUI( JComponent c ) { + return new FlatMonthViewUI(); + } + + @Override + protected CalendarRenderingHandler createRenderingHandler() { + return new FlatRenderingHandler(); + } + + //---- class FlatRenderingHandler ----------------------------------------- + + private static class FlatRenderingHandler + extends RenderingHandler + { + @Override + public JComponent prepareRenderingComponent( JXMonthView monthView, Calendar calendar, + CalendarState dayState ) + { + JComponent c = super.prepareRenderingComponent( monthView, calendar, dayState ); + + int px = monthView.getBoxPaddingX(); + int py = monthView.getBoxPaddingY(); + + // scale borders + Border border = null; + if( dayState == CalendarState.TITLE && monthView.isTraversable() ) { + Border b = c.getBorder(); + if( b instanceof CompoundBorder && ((CompoundBorder)b).getInsideBorder() instanceof EmptyBorder ) + border = new CompoundBorder( ((CompoundBorder)b).getOutsideBorder(), new FlatEmptyBorder( py * 2, 0, py * 2, 0 ) ); + } else if( dayState == CalendarState.TODAY ) + border = new FlatLineBorder( new Insets( py, px, py, px ), monthView.getTodayBackground() ); + + if( border == null ) + border = new FlatEmptyBorder( py, px, py, px ); + c.setBorder( border ); + + return c; + } + } +} diff --git a/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatDarkLaf.properties b/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatDarkLaf.properties index 286d11a9..bf66ad7f 100644 --- a/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatDarkLaf.properties +++ b/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatDarkLaf.properties @@ -33,6 +33,22 @@ Hyperlink.visitedColor=@@Hyperlink.linkColor Hyperlink.disabledText=@disabledText +#---- MonthView ---- + +JXMonthView.background=@textComponentBackground +JXMonthView.monthStringBackground=4c5052 +JXMonthView.monthStringForeground=@foreground +JXMonthView.daysOfTheWeekForeground=aaaaaa +JXMonthView.weekOfTheYearForeground=888888 +JXMonthView.unselectableDayForeground=E05555 +JXMonthView.selectedBackground=@selectionBackground +JXMonthView.flaggedDayForeground=E05555 +JXMonthView.leadingDayForeground=@disabledText +JXMonthView.trailingDayForeground=@disabledText +JXMonthView.arrowColor=@foreground +JXMonthView.disabledArrowColor=@disabledText + + #---- TaskPaneContainer ---- TaskPaneContainer.background=3E434C diff --git a/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatLaf.properties b/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatLaf.properties index f1f86354..be3c451f 100644 --- a/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatLaf.properties +++ b/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatLaf.properties @@ -20,9 +20,16 @@ BusyLabelUI=com.formdev.flatlaf.swingx.ui.FlatBusyLabelUI DatePickerUI=com.formdev.flatlaf.swingx.ui.FlatDatePickerUI HeaderUI=com.formdev.flatlaf.swingx.ui.FlatHeaderUI HyperlinkUI=com.formdev.flatlaf.swingx.ui.FlatHyperlinkUI +MonthViewUI=com.formdev.flatlaf.swingx.ui.FlatMonthViewUI swingx/TaskPaneUI=com.formdev.flatlaf.swingx.ui.FlatTaskPaneUI #---- DatePicker ---- JXDatePicker.border=com.formdev.flatlaf.swingx.ui.FlatDatePickerBorder + + +#---- MonthView ---- + +JXMonthView.monthDownFileName={icon}com.formdev.flatlaf.swingx.ui.FlatMonthDownIcon +JXMonthView.monthUpFileName={icon}com.formdev.flatlaf.swingx.ui.FlatMonthUpIcon diff --git a/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatLightLaf.properties b/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatLightLaf.properties index 3fe879b6..74b57b9e 100644 --- a/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatLightLaf.properties +++ b/flatlaf-swingx/src/main/resources/com/formdev/flatlaf/swingx/FlatLightLaf.properties @@ -33,6 +33,22 @@ Hyperlink.visitedColor=@@Hyperlink.linkColor Hyperlink.disabledText=@disabledText +#---- MonthView ---- + +JXMonthView.background=@textComponentBackground +JXMonthView.monthStringBackground=dfdfdf +JXMonthView.monthStringForeground=@foreground +JXMonthView.daysOfTheWeekForeground=444444 +JXMonthView.weekOfTheYearForeground=666666 +JXMonthView.unselectableDayForeground=E02222 +JXMonthView.selectedBackground=B9CEF8 +JXMonthView.flaggedDayForeground=E02222 +JXMonthView.leadingDayForeground=@disabledText +JXMonthView.trailingDayForeground=@disabledText +JXMonthView.arrowColor=@foreground +JXMonthView.disabledArrowColor=@disabledText + + #---- TaskPaneContainer ---- TaskPaneContainer.background=E6EBF0 diff --git a/flatlaf-swingx/src/test/java/com/formdev/flatlaf/swingx/FlatSwingXTest.java b/flatlaf-swingx/src/test/java/com/formdev/flatlaf/swingx/FlatSwingXTest.java index b7bf312e..472fc2b7 100644 --- a/flatlaf-swingx/src/test/java/com/formdev/flatlaf/swingx/FlatSwingXTest.java +++ b/flatlaf-swingx/src/test/java/com/formdev/flatlaf/swingx/FlatSwingXTest.java @@ -17,6 +17,7 @@ package com.formdev.flatlaf.swingx; import java.awt.*; +import java.util.Calendar; import java.util.Date; import javax.swing.*; import net.miginfocom.swing.*; @@ -36,6 +37,17 @@ public class FlatSwingXTest FlatSwingXTest() { initComponents(); + + Calendar calendar = Calendar.getInstance(); + + calendar.set( Calendar.DAY_OF_MONTH, 2 ); + monthView1.setSelectionDate( calendar.getTime() ); + + calendar.set( Calendar.DAY_OF_MONTH, 9 ); + monthView1.setFlaggedDates( calendar.getTime() ); + + calendar.set( Calendar.DAY_OF_MONTH, 16 ); + monthView1.setUnselectableDates( calendar.getTime() ); } private void busyChanged() { @@ -48,13 +60,16 @@ public class FlatSwingXTest // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents JLabel label1 = new JLabel(); JLabel label3 = new JLabel(); - JLabel label4 = new JLabel(); - JLabel label5 = new JLabel(); JLabel datePickerLabel = new JLabel(); JXDatePicker xDatePicker1 = new JXDatePicker(); JXDatePicker xDatePicker2 = new JXDatePicker(); + JLabel label4 = new JLabel(); + JLabel label5 = new JLabel(); JXDatePicker xDatePicker3 = new JXDatePicker(); JXDatePicker xDatePicker4 = new JXDatePicker(); + JLabel monthViewLabel = new JLabel(); + monthView1 = new JXMonthView(); + monthView2 = new JXMonthView(); JLabel hyperlinkLabel = new JLabel(); JXHyperlink xHyperlink1 = new JXHyperlink(); JXHyperlink xHyperlink2 = new JXHyperlink(); @@ -62,7 +77,7 @@ public class FlatSwingXTest xBusyLabel1 = new JXBusyLabel(); xBusyLabel2 = new JXBusyLabel(); busyCheckBox = new JCheckBox(); - JPanel panel1 = new JPanel(); + JPanel panel2 = new JPanel(); JLabel taskPaneContainerLabel = new JLabel(); JLabel taskPaneLabel = new JLabel(); JScrollPane scrollPane1 = new JScrollPane(); @@ -89,10 +104,11 @@ public class FlatSwingXTest "[left]" + "[]" + "[]" + - "[]" + "[fill]", // rows + "[]0" + "[]" + + "[]0" + "[]" + "[]" + "[]" + @@ -107,166 +123,186 @@ public class FlatSwingXTest label3.setText("disabled"); add(label3, "cell 2 0"); - //---- label4 ---- - label4.setText("not editable"); - add(label4, "cell 3 0"); - - //---- label5 ---- - label5.setText("not editable disabled"); - add(label5, "cell 4 0"); - //---- datePickerLabel ---- datePickerLabel.setText("JXDatePicker:"); add(datePickerLabel, "cell 0 1"); - add(xDatePicker1, "cell 1 1,growx"); + add(xDatePicker1, "cell 1 1"); //---- xDatePicker2 ---- xDatePicker2.setEnabled(false); add(xDatePicker2, "cell 2 1"); + //---- label4 ---- + label4.setText("not editable"); + add(label4, "cell 1 2"); + + //---- label5 ---- + label5.setText("not editable disabled"); + add(label5, "cell 2 2"); + //---- xDatePicker3 ---- xDatePicker3.setEditable(false); - add(xDatePicker3, "cell 3 1"); + add(xDatePicker3, "cell 1 3"); //---- xDatePicker4 ---- xDatePicker4.setEnabled(false); xDatePicker4.setEditable(false); - add(xDatePicker4, "cell 4 1"); + add(xDatePicker4, "cell 2 3"); + + //---- monthViewLabel ---- + monthViewLabel.setText("JXMonthView:"); + add(monthViewLabel, "cell 0 4,aligny top,growy 0"); + + //---- monthView1 ---- + monthView1.setTraversable(true); + monthView1.setShowingLeadingDays(true); + monthView1.setShowingTrailingDays(true); + monthView1.setShowingWeekNumber(true); + add(monthView1, "cell 1 4"); + + //---- monthView2 ---- + monthView2.setTraversable(true); + monthView2.setShowingLeadingDays(true); + monthView2.setShowingTrailingDays(true); + monthView2.setShowingWeekNumber(true); + monthView2.setEnabled(false); + add(monthView2, "cell 2 4"); //---- hyperlinkLabel ---- hyperlinkLabel.setText("JXHyperlink:"); - add(hyperlinkLabel, "cell 0 2"); + add(hyperlinkLabel, "cell 0 5"); //---- xHyperlink1 ---- xHyperlink1.setText("enabled"); - add(xHyperlink1, "cell 1 2"); + add(xHyperlink1, "cell 1 5"); //---- xHyperlink2 ---- xHyperlink2.setText("disabled"); xHyperlink2.setEnabled(false); - add(xHyperlink2, "cell 2 2"); + add(xHyperlink2, "cell 2 5"); //---- label2 ---- label2.setText("JXBusyLabel:"); - add(label2, "cell 0 3"); + add(label2, "cell 0 6"); //---- xBusyLabel1 ---- xBusyLabel1.setText("enabled"); - add(xBusyLabel1, "cell 1 3"); + add(xBusyLabel1, "cell 1 6"); //---- xBusyLabel2 ---- xBusyLabel2.setText("disabled"); xBusyLabel2.setEnabled(false); - add(xBusyLabel2, "cell 2 3"); + add(xBusyLabel2, "cell 2 6,growx"); //---- busyCheckBox ---- busyCheckBox.setText("busy"); busyCheckBox.setMnemonic('B'); busyCheckBox.addActionListener(e -> busyChanged()); - add(busyCheckBox, "cell 3 3"); + add(busyCheckBox, "cell 2 6"); - //======== panel1 ======== + //======== panel2 ======== { - panel1.setLayout(new MigLayout( + panel2.setLayout(new MigLayout( "ltr,insets 0,hidemode 3", // columns - "[left]", + "[fill]", // rows "[]" + + "[]" + "[]")); //---- taskPaneContainerLabel ---- taskPaneContainerLabel.setText("JXTaskPaneContainer:"); - panel1.add(taskPaneContainerLabel, "cell 0 0"); + panel2.add(taskPaneContainerLabel, "cell 0 0"); //---- taskPaneLabel ---- taskPaneLabel.setText("JXTaskPane:"); - panel1.add(taskPaneLabel, "cell 0 1"); - } - add(panel1, "cell 0 4,aligny top,growy 0"); + panel2.add(taskPaneLabel, "cell 0 1"); - //======== scrollPane1 ======== - { - - //======== xTaskPaneContainer1 ======== + //======== scrollPane1 ======== { - //======== xTaskPane3 ======== + //======== xTaskPaneContainer1 ======== { - xTaskPane3.setTitle("Basic Tasks"); - Container xTaskPane3ContentPane = xTaskPane3.getContentPane(); - //---- xHyperlink3 ---- - xHyperlink3.setText("New"); - xTaskPane3ContentPane.add(xHyperlink3); + //======== xTaskPane3 ======== + { + xTaskPane3.setTitle("Basic Tasks"); + Container xTaskPane3ContentPane = xTaskPane3.getContentPane(); - //---- xHyperlink4 ---- - xHyperlink4.setText("Open"); - xTaskPane3ContentPane.add(xHyperlink4); + //---- xHyperlink3 ---- + xHyperlink3.setText("New"); + xTaskPane3ContentPane.add(xHyperlink3); - //---- xHyperlink5 ---- - xHyperlink5.setText("Save"); - xTaskPane3ContentPane.add(xHyperlink5); + //---- xHyperlink4 ---- + xHyperlink4.setText("Open"); + xTaskPane3ContentPane.add(xHyperlink4); + + //---- xHyperlink5 ---- + xHyperlink5.setText("Save"); + xTaskPane3ContentPane.add(xHyperlink5); + } + xTaskPaneContainer1.add(xTaskPane3); + + //======== xTaskPane4 ======== + { + xTaskPane4.setTitle("Other Tasks"); + xTaskPane4.setIcon(UIManager.getIcon("Tree.closedIcon")); + Container xTaskPane4ContentPane = xTaskPane4.getContentPane(); + + //---- xHyperlink6 ---- + xHyperlink6.setText("Duplicate"); + xTaskPane4ContentPane.add(xHyperlink6); + + //---- xHyperlink7 ---- + xHyperlink7.setText("Delete"); + xTaskPane4ContentPane.add(xHyperlink7); + } + xTaskPaneContainer1.add(xTaskPane4); + + //======== xTaskPane5 ======== + { + xTaskPane5.setTitle("Special Tasks"); + xTaskPane5.setSpecial(true); + Container xTaskPane5ContentPane = xTaskPane5.getContentPane(); + + //---- xHyperlink8 ---- + xHyperlink8.setText("Go to space"); + xTaskPane5ContentPane.add(xHyperlink8); + } + xTaskPaneContainer1.add(xTaskPane5); + + //======== xTaskPane6 ======== + { + xTaskPane6.setTitle("Collapsed"); + xTaskPane6.setCollapsed(true); + Container xTaskPane6ContentPane = xTaskPane6.getContentPane(); + + //---- xHyperlink9 ---- + xHyperlink9.setText("text"); + xTaskPane6ContentPane.add(xHyperlink9); + + //---- xHyperlink10 ---- + xHyperlink10.setText("text"); + xTaskPane6ContentPane.add(xHyperlink10); + } + xTaskPaneContainer1.add(xTaskPane6); } - xTaskPaneContainer1.add(xTaskPane3); - - //======== xTaskPane4 ======== - { - xTaskPane4.setTitle("Other Tasks"); - xTaskPane4.setIcon(UIManager.getIcon("Tree.closedIcon")); - Container xTaskPane4ContentPane = xTaskPane4.getContentPane(); - - //---- xHyperlink6 ---- - xHyperlink6.setText("Duplicate"); - xTaskPane4ContentPane.add(xHyperlink6); - - //---- xHyperlink7 ---- - xHyperlink7.setText("Delete"); - xTaskPane4ContentPane.add(xHyperlink7); - } - xTaskPaneContainer1.add(xTaskPane4); - - //======== xTaskPane5 ======== - { - xTaskPane5.setTitle("Special Tasks"); - xTaskPane5.setSpecial(true); - Container xTaskPane5ContentPane = xTaskPane5.getContentPane(); - - //---- xHyperlink8 ---- - xHyperlink8.setText("Go to space"); - xTaskPane5ContentPane.add(xHyperlink8); - } - xTaskPaneContainer1.add(xTaskPane5); - - //======== xTaskPane6 ======== - { - xTaskPane6.setTitle("Collapsed"); - xTaskPane6.setCollapsed(true); - Container xTaskPane6ContentPane = xTaskPane6.getContentPane(); - - //---- xHyperlink9 ---- - xHyperlink9.setText("text"); - xTaskPane6ContentPane.add(xHyperlink9); - - //---- xHyperlink10 ---- - xHyperlink10.setText("text"); - xTaskPane6ContentPane.add(xHyperlink10); - } - xTaskPaneContainer1.add(xTaskPane6); + scrollPane1.setViewportView(xTaskPaneContainer1); } - scrollPane1.setViewportView(xTaskPaneContainer1); + panel2.add(scrollPane1, "cell 0 2,width 150,height 350"); } - add(scrollPane1, "cell 1 4,width 150,height 350"); + add(panel2, "cell 3 0 1 8,aligny top,growy 0"); //---- headerLabel ---- headerLabel.setText("JXHeader:"); - add(headerLabel, "cell 0 5"); + add(headerLabel, "cell 0 7,aligny top,growy 0"); //---- xHeader1 ---- xHeader1.setTitle("Title"); xHeader1.setDescription("Description\nMore description"); xHeader1.setIcon(new ImageIcon(getClass().getResource("/org/jdesktop/swingx/plaf/windows/resources/tipoftheday.png"))); - add(xHeader1, "cell 1 5 2 1,width 200"); + add(xHeader1, "cell 1 7 2 1,width 200"); // JFormDesigner - End of component initialization //GEN-END:initComponents xDatePicker1.setDate( new Date() ); @@ -276,6 +312,8 @@ public class FlatSwingXTest } // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables + private JXMonthView monthView1; + private JXMonthView monthView2; private JXBusyLabel xBusyLabel1; private JXBusyLabel xBusyLabel2; private JCheckBox busyCheckBox; diff --git a/flatlaf-swingx/src/test/java/com/formdev/flatlaf/swingx/FlatSwingXTest.jfd b/flatlaf-swingx/src/test/java/com/formdev/flatlaf/swingx/FlatSwingXTest.jfd index 37593709..54db5c33 100644 --- a/flatlaf-swingx/src/test/java/com/formdev/flatlaf/swingx/FlatSwingXTest.jfd +++ b/flatlaf-swingx/src/test/java/com/formdev/flatlaf/swingx/FlatSwingXTest.jfd @@ -8,8 +8,8 @@ new FormModel { } add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { "$layoutConstraints": "hidemode 3,ltr" - "$columnConstraints": "[left][][][][fill]" - "$rowConstraints": "[][][][][][]" + "$columnConstraints": "[left][][][fill]" + "$rowConstraints": "[]0[][]0[][][][][]" } ) { name: "this" add( new FormComponent( "javax.swing.JLabel" ) { @@ -24,18 +24,6 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 2 0" } ) - add( new FormComponent( "javax.swing.JLabel" ) { - name: "label4" - "text": "not editable" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 3 0" - } ) - add( new FormComponent( "javax.swing.JLabel" ) { - name: "label5" - "text": "not editable disabled" - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 4 0" - } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "datePickerLabel" "text": "JXDatePicker:" @@ -45,7 +33,7 @@ new FormModel { add( new FormComponent( "org.jdesktop.swingx.JXDatePicker" ) { name: "xDatePicker1" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 1,growx" + "value": "cell 1 1" } ) add( new FormComponent( "org.jdesktop.swingx.JXDatePicker" ) { name: "xDatePicker2" @@ -53,43 +41,86 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 2 1" } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label4" + "text": "not editable" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 2" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "label5" + "text": "not editable disabled" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 2" + } ) add( new FormComponent( "org.jdesktop.swingx.JXDatePicker" ) { name: "xDatePicker3" "editable": false }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 3 1" + "value": "cell 1 3" } ) add( new FormComponent( "org.jdesktop.swingx.JXDatePicker" ) { name: "xDatePicker4" "enabled": false "editable": false }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 4 1" + "value": "cell 2 3" + } ) + add( new FormComponent( "javax.swing.JLabel" ) { + name: "monthViewLabel" + "text": "JXMonthView:" + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 4,aligny top,growy 0" + } ) + add( new FormComponent( "org.jdesktop.swingx.JXMonthView" ) { + name: "monthView1" + "traversable": true + "showingLeadingDays": true + "showingTrailingDays": true + "showingWeekNumber": true + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 1 4" + } ) + add( new FormComponent( "org.jdesktop.swingx.JXMonthView" ) { + name: "monthView2" + "traversable": true + "showingLeadingDays": true + "showingTrailingDays": true + "showingWeekNumber": true + "enabled": false + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 4" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "hyperlinkLabel" "text": "JXHyperlink:" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 2" + "value": "cell 0 5" } ) add( new FormComponent( "org.jdesktop.swingx.JXHyperlink" ) { name: "xHyperlink1" "text": "enabled" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 2" + "value": "cell 1 5" } ) add( new FormComponent( "org.jdesktop.swingx.JXHyperlink" ) { name: "xHyperlink2" "text": "disabled" "enabled": false }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 2 2" + "value": "cell 2 5" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "label2" "text": "JXBusyLabel:" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 3" + "value": "cell 0 6" } ) add( new FormComponent( "org.jdesktop.swingx.JXBusyLabel" ) { name: "xBusyLabel1" @@ -98,7 +129,7 @@ new FormModel { "JavaCodeGenerator.variableLocal": false } }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 3" + "value": "cell 1 6" } ) add( new FormComponent( "org.jdesktop.swingx.JXBusyLabel" ) { name: "xBusyLabel2" @@ -108,7 +139,7 @@ new FormModel { "JavaCodeGenerator.variableLocal": false } }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 2 3" + "value": "cell 2 6,growx" } ) add( new FormComponent( "javax.swing.JCheckBox" ) { name: "busyCheckBox" @@ -119,14 +150,14 @@ new FormModel { } addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "busyChanged", false ) ) }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 3 3" + "value": "cell 2 6" } ) add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { - "$columnConstraints": "[left]" - "$rowConstraints": "[][]" + "$columnConstraints": "[fill]" + "$rowConstraints": "[][][]" "$layoutConstraints": "ltr,insets 0,hidemode 3" } ) { - name: "panel1" + name: "panel2" add( new FormComponent( "javax.swing.JLabel" ) { name: "taskPaneContainerLabel" "text": "JXTaskPaneContainer:" @@ -139,73 +170,73 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 1" } ) - }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 4,aligny top,growy 0" - } ) - add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { - name: "scrollPane1" - add( new FormContainer( "org.jdesktop.swingx.JXTaskPaneContainer", new FormLayoutManager( class com.jformdesigner.runtime.GenericIndexLayout ) ) { - name: "xTaskPaneContainer1" - add( new FormContainer( "org.jdesktop.swingx.JXTaskPane", new FormLayoutManager( class com.jformdesigner.runtime.GenericIndexLayout ) ) { - name: "xTaskPane3" - "title": "Basic Tasks" - add( new FormComponent( "org.jdesktop.swingx.JXHyperlink" ) { - name: "xHyperlink3" - "text": "New" + add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { + name: "scrollPane1" + add( new FormContainer( "org.jdesktop.swingx.JXTaskPaneContainer", new FormLayoutManager( class com.jformdesigner.runtime.GenericIndexLayout ) ) { + name: "xTaskPaneContainer1" + add( new FormContainer( "org.jdesktop.swingx.JXTaskPane", new FormLayoutManager( class com.jformdesigner.runtime.GenericIndexLayout ) ) { + name: "xTaskPane3" + "title": "Basic Tasks" + add( new FormComponent( "org.jdesktop.swingx.JXHyperlink" ) { + name: "xHyperlink3" + "text": "New" + } ) + add( new FormComponent( "org.jdesktop.swingx.JXHyperlink" ) { + name: "xHyperlink4" + "text": "Open" + } ) + add( new FormComponent( "org.jdesktop.swingx.JXHyperlink" ) { + name: "xHyperlink5" + "text": "Save" + } ) } ) - add( new FormComponent( "org.jdesktop.swingx.JXHyperlink" ) { - name: "xHyperlink4" - "text": "Open" + add( new FormContainer( "org.jdesktop.swingx.JXTaskPane", new FormLayoutManager( class com.jformdesigner.runtime.GenericIndexLayout ) ) { + name: "xTaskPane4" + "title": "Other Tasks" + "icon": new com.jformdesigner.model.SwingIcon( 2, "Tree.closedIcon" ) + add( new FormComponent( "org.jdesktop.swingx.JXHyperlink" ) { + name: "xHyperlink6" + "text": "Duplicate" + } ) + add( new FormComponent( "org.jdesktop.swingx.JXHyperlink" ) { + name: "xHyperlink7" + "text": "Delete" + } ) } ) - add( new FormComponent( "org.jdesktop.swingx.JXHyperlink" ) { - name: "xHyperlink5" - "text": "Save" - } ) - } ) - add( new FormContainer( "org.jdesktop.swingx.JXTaskPane", new FormLayoutManager( class com.jformdesigner.runtime.GenericIndexLayout ) ) { - name: "xTaskPane4" - "title": "Other Tasks" - "icon": new com.jformdesigner.model.SwingIcon( 2, "Tree.closedIcon" ) - add( new FormComponent( "org.jdesktop.swingx.JXHyperlink" ) { - name: "xHyperlink6" - "text": "Duplicate" - } ) - add( new FormComponent( "org.jdesktop.swingx.JXHyperlink" ) { - name: "xHyperlink7" - "text": "Delete" - } ) - } ) - add( new FormContainer( "org.jdesktop.swingx.JXTaskPane", new FormLayoutManager( class com.jformdesigner.runtime.GenericIndexLayout ) ) { - name: "xTaskPane5" - "title": "Special Tasks" - "special": true - add( new FormComponent( "org.jdesktop.swingx.JXHyperlink" ) { - name: "xHyperlink8" - "text": "Go to space" - } ) - } ) - add( new FormContainer( "org.jdesktop.swingx.JXTaskPane", new FormLayoutManager( class com.jformdesigner.runtime.GenericIndexLayout ) ) { - name: "xTaskPane6" - "title": "Collapsed" - "collapsed": true - add( new FormComponent( "org.jdesktop.swingx.JXHyperlink" ) { - name: "xHyperlink9" - "text": "text" - } ) - add( new FormComponent( "org.jdesktop.swingx.JXHyperlink" ) { - name: "xHyperlink10" - "text": "text" + add( new FormContainer( "org.jdesktop.swingx.JXTaskPane", new FormLayoutManager( class com.jformdesigner.runtime.GenericIndexLayout ) ) { + name: "xTaskPane5" + "title": "Special Tasks" + "special": true + add( new FormComponent( "org.jdesktop.swingx.JXHyperlink" ) { + name: "xHyperlink8" + "text": "Go to space" + } ) + } ) + add( new FormContainer( "org.jdesktop.swingx.JXTaskPane", new FormLayoutManager( class com.jformdesigner.runtime.GenericIndexLayout ) ) { + name: "xTaskPane6" + "title": "Collapsed" + "collapsed": true + add( new FormComponent( "org.jdesktop.swingx.JXHyperlink" ) { + name: "xHyperlink9" + "text": "text" + } ) + add( new FormComponent( "org.jdesktop.swingx.JXHyperlink" ) { + name: "xHyperlink10" + "text": "text" + } ) } ) } ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 0 2,width 150,height 350" } ) }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 4,width 150,height 350" + "value": "cell 3 0 1 8,aligny top,growy 0" } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "headerLabel" "text": "JXHeader:" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 0 5" + "value": "cell 0 7,aligny top,growy 0" } ) add( new FormComponent( "org.jdesktop.swingx.JXHeader" ) { name: "xHeader1" @@ -213,11 +244,11 @@ new FormModel { "description": "Description\nMore description" "icon": new com.jformdesigner.model.SwingIcon( 0, "/org/jdesktop/swingx/plaf/windows/resources/tipoftheday.png" ) }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { - "value": "cell 1 5 2 1,width 200" + "value": "cell 1 7 2 1,width 200" } ) }, new FormLayoutConstraints( null ) { "location": new java.awt.Point( 0, 0 ) - "size": new java.awt.Dimension( 645, 600 ) + "size": new java.awt.Dimension( 700, 600 ) } ) } } diff --git a/flatlaf-swingx/src/test/resources/com/formdev/flatlaf/swingx/FlatTestLaf.properties b/flatlaf-swingx/src/test/resources/com/formdev/flatlaf/swingx/FlatTestLaf.properties index cc79e717..9754ce3c 100644 --- a/flatlaf-swingx/src/test/resources/com/formdev/flatlaf/swingx/FlatTestLaf.properties +++ b/flatlaf-swingx/src/test/resources/com/formdev/flatlaf/swingx/FlatTestLaf.properties @@ -35,6 +35,22 @@ Hyperlink.visitedColor=0000ff Hyperlink.disabledText=000088 +#---- MonthView ---- + +JXMonthView.background=@textComponentBackground +JXMonthView.monthStringBackground=00ff00 +JXMonthView.monthStringForeground=0000ff +JXMonthView.daysOfTheWeekForeground=00ff00 +JXMonthView.weekOfTheYearForeground=0000ff +JXMonthView.unselectableDayForeground=0000ff +JXMonthView.selectedBackground=aaffaa +JXMonthView.flaggedDayForeground=00ffff +JXMonthView.leadingDayForeground=c0c0c0 +JXMonthView.trailingDayForeground=c0c0c0 +JXMonthView.arrowColor=0000ff +JXMonthView.disabledArrowColor=ABABAB + + #---- TaskPaneContainer ---- TaskPaneContainer.background=ff8888