slightly changed style of default Light and Dark themes and added IntelliJ and Darcula themes to keep the old style:

- changed focus width from 2 to 0
- changed colors of selected checkbox and radio button
- increased diameter of center circle in selected radio button
This commit is contained in:
Karl Tauber
2019-09-08 17:18:19 +02:00
parent 6b8b5de3b5
commit 83f88cd3a8
8 changed files with 152 additions and 5 deletions

View File

@@ -0,0 +1,36 @@
/*
* 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;
/**
* A Flat LaF that has a dark color scheme and looks like Darcula LaF.
*
* @author Karl Tauber
*/
public class FlatDarculaLaf
extends FlatDarkLaf
{
@Override
public String getName() {
return "Flat Darcula";
}
@Override
public String getDescription() {
return "Flat Darcula Look and Feel";
}
}

View File

@@ -0,0 +1,36 @@
/*
* 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;
/**
* A Flat LaF that has a light color scheme and looks like IntelliJ LaF.
*
* @author Karl Tauber
*/
public class FlatIntelliJLaf
extends FlatLightLaf
{
@Override
public String getName() {
return "Flat IntelliJ";
}
@Override
public String getDescription() {
return "Flat IntelliJ Look and Feel";
}
}

View File

@@ -17,15 +17,21 @@
package com.formdev.flatlaf.icons;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;
import com.formdev.flatlaf.ui.FlatUIUtils;
/**
* Icon for {@link javax.swing.JRadioButton}.
*
* @uiDefault RadioButton.icon.centerDiameter int
*
* @author Karl Tauber
*/
public class FlatRadioButtonIcon
extends FlatCheckBoxIcon
{
protected final int centerDiameter = FlatUIUtils.getUIInt( "RadioButton.icon.centerDiameter", 8 );
@Override
protected void paintFocusBorder( Graphics2D g2 ) {
g2.fillOval( 0, 0, iconSize, iconSize );
@@ -43,6 +49,7 @@ public class FlatRadioButtonIcon
@Override
protected void paintCheckmark( Graphics2D g2 ) {
g2.fillOval( focusWidth + 5, focusWidth + 5, 5, 5 );
float xy = (iconSize - centerDiameter) / 2f;
g2.fill( new Ellipse2D.Float( xy, xy, centerDiameter, centerDiameter ) );
}
}

View File

@@ -0,0 +1,28 @@
#
# 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.
#
# Colors and style mostly based on Darcula theme from IntelliJ IDEA Community Edition,
# which is licensed under the Apache 2.0 license. Copyright 2000-2019 JetBrains s.r.o.
# See: https://github.com/JetBrains/intellij-community/
#---- Component ----
Component.focusWidth=2
#---- RadioButton ----
RadioButton.icon.centerDiameter=5

View File

@@ -0,0 +1,35 @@
#
# 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.
#
# Colors and style mostly based on IntelliJ theme from IntelliJ IDEA Community Edition,
# which is licensed under the Apache 2.0 license. Copyright 2000-2019 JetBrains s.r.o.
# See: https://github.com/JetBrains/intellij-community/
#---- CheckBox ----
CheckBox.icon.selectedBorderColor=4982CC
CheckBox.icon.selectedBackground=4D89C9
CheckBox.icon.checkmarkColor=FFFFFF
#---- Component ----
Component.focusWidth=2
#---- RadioButton ----
RadioButton.icon.centerDiameter=5

View File

@@ -93,7 +93,7 @@ ComboBox.padding=1,6,1,6
#---- Component ----
Component.focusWidth=2
Component.focusWidth=0
Component.arc=5
@@ -189,6 +189,7 @@ ProgressBar.verticalSize=6,146
RadioButton.border=com.formdev.flatlaf.ui.FlatMarginBorder
RadioButton.icon=com.formdev.flatlaf.icons.FlatRadioButtonIcon
RadioButton.icon.centerDiameter=8
#---- RadioButtonMenuItem ----

View File

@@ -82,13 +82,13 @@ Button.toolbar.pressedBackground=cfcfcf
CheckBox.icon.borderColor=878787
CheckBox.icon.disabledBorderColor=BDBDBD
CheckBox.icon.selectedBorderColor=4982CC
CheckBox.icon.selectedBorderColor=878787
CheckBox.icon.focusedBorderColor=7B9FC7
CheckBox.icon.selectedFocusedBorderColor=ACCFF7
CheckBox.icon.background=FFFFFF
CheckBox.icon.disabledBackground=@background
CheckBox.icon.selectedBackground=4D89C9
CheckBox.icon.checkmarkColor=FFFFFF
CheckBox.icon.selectedBackground=FFFFFF
CheckBox.icon.checkmarkColor=4D89C9
CheckBox.icon.disabledCheckmarkColor=ABABAB

View File

@@ -44,6 +44,8 @@ class ControlBar
DefaultComboBoxModel<LafInfo> lafModel = new DefaultComboBoxModel<>();
lafModel.addElement( new LafInfo( "Flat Light (F1)", FlatLightLaf.class.getName() ) );
lafModel.addElement( new LafInfo( "Flat Dark (F2)", FlatDarkLaf.class.getName() ) );
lafModel.addElement( new LafInfo( "Flat IntelliJ (F3)", FlatIntelliJLaf.class.getName() ) );
lafModel.addElement( new LafInfo( "Flat Darcula (F4)", FlatDarculaLaf.class.getName() ) );
UIManager.LookAndFeelInfo[] lookAndFeels = UIManager.getInstalledLookAndFeels();
for( UIManager.LookAndFeelInfo lookAndFeel : lookAndFeels ) {
@@ -82,6 +84,8 @@ class ControlBar
// register F1, F2, ... keys to switch to Light, Dark or other LaFs
registerSwitchToLookAndFeel( KeyEvent.VK_F1, FlatLightLaf.class.getName() );
registerSwitchToLookAndFeel( KeyEvent.VK_F2, FlatDarkLaf.class.getName() );
registerSwitchToLookAndFeel( KeyEvent.VK_F3, FlatIntelliJLaf.class.getName() );
registerSwitchToLookAndFeel( KeyEvent.VK_F4, FlatDarculaLaf.class.getName() );
registerSwitchToLookAndFeel( KeyEvent.VK_F10, NimbusLookAndFeel.class.getName() );
registerSwitchToLookAndFeel( KeyEvent.VK_F11, MetalLookAndFeel.class.getName() );