mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-09 16:25:10 +03:00
FileChooser implemented (issue #5)
This commit is contained in:
@@ -4,6 +4,7 @@ FlatLaf Change Log
|
|||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
- Support using IntelliJ platform themes (.theme.json files).
|
- Support using IntelliJ platform themes (.theme.json files).
|
||||||
|
- Support `JFileChooser`. (issue #5)
|
||||||
- Fixed selection background of checkbox in table cell.
|
- Fixed selection background of checkbox in table cell.
|
||||||
- Fixed jittery submenu rendering on Mac. (issue #10)
|
- Fixed jittery submenu rendering on Mac. (issue #10)
|
||||||
|
|
||||||
|
|||||||
@@ -171,6 +171,9 @@ public abstract class FlatLaf
|
|||||||
public UIDefaults getDefaults() {
|
public UIDefaults getDefaults() {
|
||||||
UIDefaults defaults = getBase().getDefaults();
|
UIDefaults defaults = getBase().getDefaults();
|
||||||
|
|
||||||
|
// add Metal resource bundle, which is required for FlatFileChooserUI
|
||||||
|
defaults.addResourceBundle( "com.sun.swing.internal.plaf.metal.resources.metal" );
|
||||||
|
|
||||||
// initialize some defaults (for overriding) that are used in basic UI delegates,
|
// initialize some defaults (for overriding) that are used in basic UI delegates,
|
||||||
// but are not set in MetalLookAndFeel or BasicLookAndFeel
|
// but are not set in MetalLookAndFeel or BasicLookAndFeel
|
||||||
Color control = defaults.getColor( "control" );
|
Color control = defaults.getColor( "control" );
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* 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.ui;
|
||||||
|
|
||||||
|
import javax.swing.JComponent;
|
||||||
|
import javax.swing.JFileChooser;
|
||||||
|
import javax.swing.plaf.ComponentUI;
|
||||||
|
import javax.swing.plaf.metal.MetalFileChooserUI;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the Flat LaF UI delegate for {@link javax.swing.JFileChooser}.
|
||||||
|
*
|
||||||
|
* TODO document used UI defaults of superclass
|
||||||
|
*
|
||||||
|
* @author Karl Tauber
|
||||||
|
*/
|
||||||
|
public class FlatFileChooserUI
|
||||||
|
extends MetalFileChooserUI
|
||||||
|
{
|
||||||
|
public static ComponentUI createUI( JComponent c ) {
|
||||||
|
return new FlatFileChooserUI( (JFileChooser) c );
|
||||||
|
}
|
||||||
|
|
||||||
|
public FlatFileChooserUI( JFileChooser filechooser ) {
|
||||||
|
super( filechooser );
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -81,8 +81,10 @@ public class FlatTableHeaderUI
|
|||||||
@Override
|
@Override
|
||||||
public void paint( Graphics g, JComponent c ) {
|
public void paint( Graphics g, JComponent c ) {
|
||||||
// do not paint borders if JTableHeader.setDefaultRenderer() was used
|
// do not paint borders if JTableHeader.setDefaultRenderer() was used
|
||||||
boolean paintBorders = header.getDefaultRenderer().getClass().getName().equals(
|
String rendererClassName = header.getDefaultRenderer().getClass().getName();
|
||||||
"sun.swing.table.DefaultTableCellHeaderRenderer" );
|
boolean paintBorders =
|
||||||
|
rendererClassName.equals( "sun.swing.table.DefaultTableCellHeaderRenderer" ) ||
|
||||||
|
rendererClassName.equals( "sun.swing.FilePane$AlignableTableHeaderRenderer" );
|
||||||
|
|
||||||
if( paintBorders )
|
if( paintBorders )
|
||||||
paintColumnBorders( g, c );
|
paintColumnBorders( g, c );
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ CheckBoxMenuItemUI=com.formdev.flatlaf.ui.FlatCheckBoxMenuItemUI
|
|||||||
ColorChooserUI=com.formdev.flatlaf.ui.FlatColorChooserUI
|
ColorChooserUI=com.formdev.flatlaf.ui.FlatColorChooserUI
|
||||||
ComboBoxUI=com.formdev.flatlaf.ui.FlatComboBoxUI
|
ComboBoxUI=com.formdev.flatlaf.ui.FlatComboBoxUI
|
||||||
EditorPaneUI=com.formdev.flatlaf.ui.FlatEditorPaneUI
|
EditorPaneUI=com.formdev.flatlaf.ui.FlatEditorPaneUI
|
||||||
|
FileChooserUI=com.formdev.flatlaf.ui.FlatFileChooserUI
|
||||||
FormattedTextFieldUI=com.formdev.flatlaf.ui.FlatFormattedTextFieldUI
|
FormattedTextFieldUI=com.formdev.flatlaf.ui.FlatFormattedTextFieldUI
|
||||||
LabelUI=com.formdev.flatlaf.ui.FlatLabelUI
|
LabelUI=com.formdev.flatlaf.ui.FlatLabelUI
|
||||||
ListUI=com.formdev.flatlaf.ui.FlatListUI
|
ListUI=com.formdev.flatlaf.ui.FlatListUI
|
||||||
@@ -338,7 +339,7 @@ Table.selectionInactiveForeground=@selectionInactiveForeground
|
|||||||
#---- TableHeader ----
|
#---- TableHeader ----
|
||||||
|
|
||||||
TableHeader.height=25
|
TableHeader.height=25
|
||||||
TableHeader.cellBorder=2,2,2,2
|
TableHeader.cellBorder=2,3,2,3
|
||||||
|
|
||||||
|
|
||||||
#---- TextArea ----
|
#---- TextArea ----
|
||||||
|
|||||||
Reference in New Issue
Block a user