mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 06:27:13 -06:00
Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2bcdf774ff | ||
|
|
ef01f23384 | ||
|
|
ab7bbb6593 | ||
|
|
f2dad88875 | ||
|
|
c474565ff5 | ||
|
|
fd9dbbd7e6 | ||
|
|
43ab095e0f | ||
|
|
41e2888bf1 | ||
|
|
e7d5e22960 | ||
|
|
3f3884193d | ||
|
|
dfccabc2b9 | ||
|
|
af7c181596 | ||
|
|
8e84112837 | ||
|
|
822cd16daa | ||
|
|
33ea84004d | ||
|
|
8dbbe20840 | ||
|
|
d990ccc4ab | ||
|
|
9f16249898 | ||
|
|
62fc3139cf | ||
|
|
452452dcc9 | ||
|
|
b6fb06bc65 |
38
CHANGELOG.md
38
CHANGELOG.md
@@ -1,6 +1,40 @@
|
||||
FlatLaf Change Log
|
||||
==================
|
||||
|
||||
## 0.24
|
||||
|
||||
- Support smooth scrolling with touchpads and high precision mouse wheels.
|
||||
(issue #27)
|
||||
- Changed `.properties` file loading order: Now all core `.properties` files are
|
||||
loaded before loading addon `.properties` files. This makes it easier to
|
||||
overwrite core values in addons. Also, addon loading order can be specified.
|
||||
- TableHeader: Paint column borders if renderer has changed, but delegates to
|
||||
the system default renderer (e.g. done in NetBeans).
|
||||
- Label and ToolTip: Fixed font sizes for HTML headings.
|
||||
- Button and ToggleButton: Support square button style (set client property
|
||||
`JButton.buttonType` to `square`).
|
||||
- ToggleButton: Support underline toggle button style (set client property
|
||||
`JButton.buttonType` to `underline`).
|
||||
- Button and TextComponent: Support per component minimum width (set client
|
||||
property `JComponent.minimumWidth` to an integer).
|
||||
- ScrollPane with Table: The border of buttons that are added to one of the four
|
||||
scroll pane corners are now removed if the center component is a table. Also,
|
||||
these corner buttons are made not focusable.
|
||||
- Table: Replaced `Table.showGrid` with `Table.showHorizontalLines` and
|
||||
`Table.showVerticalLines`. (issue #38)
|
||||
- ProgressBar: Now uses blueish color for the progress part in "Flat Dark"
|
||||
theme. In the "Flat Darcula" theme, it remains light gray.
|
||||
- Improved Swing system colors `controlHighlight`, `controlLtHighlight`,
|
||||
`controlShadow` and `controlDkShadow`.
|
||||
|
||||
|
||||
## 0.23.1
|
||||
|
||||
- Tree: Fixed wide selection if scrolled horizontally.
|
||||
- ComboBox: Fixed NPE in Oracle SQL Developer settings.
|
||||
- IntelliJ Themes: Fixed checkbox colors in Material UI Lite dark themes.
|
||||
|
||||
|
||||
## 0.23
|
||||
|
||||
- Updated colors in "Flat Light" and "Flat IntelliJ" themes with colors from
|
||||
@@ -8,6 +42,8 @@ FlatLaf Change Log
|
||||
platform colors.
|
||||
- Tree: Support wide selection (enabled by default).
|
||||
- Table: Hide grid and changed intercell spacing to zero.
|
||||
- List, Table and Tree: Added colors for drag-and-drop. Added "enable drag and
|
||||
drop" checkbox to Demo on "Data Components" tab.
|
||||
- List and Tree: Hide cell focus indicator (black rectangle) by default. Can be
|
||||
enabled with `List.showCellFocusIndicator=true` /
|
||||
`Tree.showCellFocusIndicator=true`, but then the cell focus indicator is shown
|
||||
@@ -23,6 +59,8 @@ FlatLaf Change Log
|
||||
- Fixed link color (in HTML text) and separator color in IntelliJ platform
|
||||
themes.
|
||||
- Use logging instead of printing errors to `System.err`.
|
||||
- Updated IntelliJ Themes in demo to the latest versions.
|
||||
- IntelliJ Themes: Fixed link and separator colors.
|
||||
|
||||
|
||||
## 0.22
|
||||
|
||||
@@ -45,7 +45,7 @@ build script:
|
||||
|
||||
groupId: com.formdev
|
||||
artifactId: flatlaf
|
||||
version: 0.23
|
||||
version: 0.24
|
||||
|
||||
Otherwise download `flatlaf-<version>.jar` here:
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
version = "0.23"
|
||||
version = "0.24"
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
|
||||
@@ -27,14 +27,34 @@ public interface FlatClientProperties
|
||||
/**
|
||||
* Specifies type of a button.
|
||||
* <p>
|
||||
* <strong>Component</strong> {@link javax.swing.JButton}<br>
|
||||
* <strong>Components</strong> {@link javax.swing.JButton} and {@link javax.swing.JToggleButton}<br>
|
||||
* <strong>Value type</strong> {@link java.lang.String}<br>
|
||||
* <strong>Allowed Values</strong> {@link BUTTON_TYPE_HELP}
|
||||
* <strong>Allowed Values</strong> {@link #BUTTON_TYPE_SQUARE} and {@link #BUTTON_TYPE_HELP}
|
||||
*/
|
||||
String BUTTON_TYPE = "JButton.buttonType";
|
||||
|
||||
/**
|
||||
* Paint the button with square edges.
|
||||
* <p>
|
||||
* <strong>Components</strong> {@link javax.swing.JButton} and {@link javax.swing.JToggleButton}
|
||||
*
|
||||
* @see #BUTTON_TYPE
|
||||
*/
|
||||
String BUTTON_TYPE_SQUARE = "square";
|
||||
|
||||
/**
|
||||
* Paint the toggle button in underline style.
|
||||
* <p>
|
||||
* <strong>Components</strong> {@link javax.swing.JToggleButton}
|
||||
*
|
||||
* @see #TOGGLE_BUTTON_TYPE
|
||||
*/
|
||||
String BUTTON_TYPE_UNDERLINE = "underline";
|
||||
|
||||
/**
|
||||
* Paint a help button (circle with question mark).
|
||||
* <p>
|
||||
* <strong>Components</strong> {@link javax.swing.JButton}
|
||||
*
|
||||
* @see #BUTTON_TYPE
|
||||
*/
|
||||
@@ -45,7 +65,7 @@ public interface FlatClientProperties
|
||||
* <p>
|
||||
* <strong>Component</strong> {@link javax.swing.JCheckBox}<br>
|
||||
* <strong>Value type</strong> {@link java.lang.String}<br>
|
||||
* <strong>Allowed Values</strong> {@link SELECTED_STATE_INDETERMINATE}
|
||||
* <strong>Allowed Values</strong> {@link #SELECTED_STATE_INDETERMINATE}
|
||||
*/
|
||||
String SELECTED_STATE = "JButton.selectedState";
|
||||
|
||||
@@ -56,6 +76,14 @@ public interface FlatClientProperties
|
||||
*/
|
||||
String SELECTED_STATE_INDETERMINATE = "indeterminate";
|
||||
|
||||
/**
|
||||
* Specifies minimum width of a component.
|
||||
* <p>
|
||||
* <strong>Component</strong> {@link javax.swing.JButton} and {@link javax.swing.text.JTextComponent}<br>
|
||||
* <strong>Value type</strong> {@link java.lang.Integer}<br>
|
||||
*/
|
||||
String MINIMUM_WIDTH = "JComponent.minimumWidth";
|
||||
|
||||
/**
|
||||
* Specifies whether the decrease/increase arrow buttons of a scrollbar are shown.
|
||||
* <p>
|
||||
|
||||
@@ -45,8 +45,18 @@ public abstract class FlatDefaultsAddon
|
||||
*/
|
||||
public InputStream getDefaults( Class<?> lafClass ) {
|
||||
Class<?> addonClass = this.getClass();
|
||||
String propertiesName = "/" + addonClass.getPackage().getName().replace( '.', '/' )
|
||||
String propertiesName = '/' + addonClass.getPackage().getName().replace( '.', '/' )
|
||||
+ '/' + lafClass.getSimpleName() + ".properties";
|
||||
return addonClass.getResourceAsStream( propertiesName );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the priority used to sort addon loading.
|
||||
* The order is only important if you want overwrite UI defaults of other addons.
|
||||
* Lower numbers mean higher priority.
|
||||
* Returns 10000 by default.
|
||||
*/
|
||||
public int getPriority() {
|
||||
return 10000;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -355,33 +355,43 @@ public class IntelliJTheme
|
||||
value = "#ffffff";
|
||||
}
|
||||
|
||||
String key2 = checkboxDuplicateColors.get( key );
|
||||
|
||||
if( dark )
|
||||
key = StringUtils.removeTrailing( key, ".Dark" );
|
||||
|
||||
String newKey = checkboxKeyMapping.get( key );
|
||||
if( newKey != null ) {
|
||||
ColorUIResource color = toColor( (String) value );
|
||||
if( color != null )
|
||||
if( color != null ) {
|
||||
defaults.put( newKey, color );
|
||||
|
||||
if( key2 != null ) {
|
||||
// When IDEA replaces colors in SVGs it uses color values and not the keys
|
||||
// from com.intellij.ide.ui.UITheme.colorPalette, but there are some keys that
|
||||
// have same color value:
|
||||
// - Checkbox.Background.Default.Dark has same color as Checkbox.Background.Selected.Dark
|
||||
// - Checkbox.Border.Default.Dark has same color as Checkbox.Border.Selected.Dark
|
||||
// - Checkbox.Focus.Thin.Default.Dark has same color as Checkbox.Focus.Thin.Selected.Dark
|
||||
//
|
||||
// So if only e.g. Checkbox.Background.Default.Dark is specified in .theme.json,
|
||||
// then this color is also used for Checkbox.Background.Selected.Dark.
|
||||
//
|
||||
// If Checkbox.Background.Default.Dark and Checkbox.Background.Selected.Dark
|
||||
// are specified in .theme.json, then the later specified is used for both.
|
||||
if( dark )
|
||||
key2 = StringUtils.removeTrailing( key2, ".Dark" );
|
||||
|
||||
String newKey2 = checkboxKeyMapping.get( key2 );
|
||||
if( newKey2 != null )
|
||||
defaults.put( newKey2, color );
|
||||
}
|
||||
}
|
||||
|
||||
checkboxModified = true;
|
||||
}
|
||||
}
|
||||
|
||||
// When IDEA replaces colors in SVGs it uses color values and not the keys
|
||||
// from com.intellij.ide.ui.UITheme.colorPalette, but there are some keys that
|
||||
// have same color value:
|
||||
// - Checkbox.Background.Default.Dark has same color as Checkbox.Background.Selected.Dark
|
||||
// - Checkbox.Border.Default.Dark has same color as Checkbox.Border.Selected.Dark
|
||||
// - Checkbox.Focus.Thin.Default.Dark has same color as Checkbox.Focus.Thin.Selected.Dark
|
||||
//
|
||||
// So if only e.g. Checkbox.Background.Default.Dark is specified in .theme.json,
|
||||
// then this color is also used for Checkbox.Background.Selected.Dark.
|
||||
// Occurs e.g. in "Dark purple" theme.
|
||||
fixCheckBoxColor( defaults, colorPalette, "Checkbox.Background.Default.Dark", "Checkbox.Background.Selected.Dark" );
|
||||
fixCheckBoxColor( defaults, colorPalette, "Checkbox.Border.Default.Dark", "Checkbox.Border.Selected.Dark" );
|
||||
fixCheckBoxColor( defaults, colorPalette, "Checkbox.Focus.Thin.Default.Dark", "Checkbox.Focus.Thin.Selected.Dark" );
|
||||
|
||||
// remove hover and pressed colors
|
||||
if( checkboxModified ) {
|
||||
defaults.remove( "CheckBox.icon.hoverBorderColor" );
|
||||
@@ -391,23 +401,17 @@ public class IntelliJTheme
|
||||
defaults.remove( "CheckBox.icon.selectedHoverBackground" );
|
||||
defaults.remove( "CheckBox.icon.selectedPressedBackground" );
|
||||
}
|
||||
}
|
||||
|
||||
private void fixCheckBoxColor( UIDefaults defaults, Map<String, Object> colorPalette, String key1, String key2 ) {
|
||||
if( colorPalette.containsKey( key1 ) == colorPalette.containsKey( key2 ) )
|
||||
return;
|
||||
|
||||
String newKey1 = checkboxKeyMapping.get( StringUtils.removeTrailing( key1, ".Dark" ) );
|
||||
String newKey2 = checkboxKeyMapping.get( StringUtils.removeTrailing( key2, ".Dark" ) );
|
||||
if( colorPalette.containsKey( key1 ) )
|
||||
defaults.put( newKey2, defaults.get( newKey1 ) );
|
||||
else
|
||||
defaults.put( newKey1, defaults.get( newKey2 ) );
|
||||
// copy values
|
||||
for( Map.Entry<String, String> e : uiKeyCopying.entrySet() )
|
||||
defaults.put( e.getKey(), defaults.get( e.getValue() ) );
|
||||
}
|
||||
|
||||
private static Map<String, String> uiKeyMapping = new HashMap<>();
|
||||
private static Map<String, String> uiKeyCopying = new HashMap<>();
|
||||
private static Map<String, String> uiKeyInverseMapping = new HashMap<>();
|
||||
private static Map<String, String> checkboxKeyMapping = new HashMap<>();
|
||||
private static Map<String, String> checkboxDuplicateColors = new HashMap<>();
|
||||
private static Set<String> noWildcardReplace = new HashSet<>();
|
||||
|
||||
static {
|
||||
@@ -441,6 +445,12 @@ public class IntelliJTheme
|
||||
for( Map.Entry<String, String> e : uiKeyMapping.entrySet() )
|
||||
uiKeyInverseMapping.put( e.getValue(), e.getKey() );
|
||||
|
||||
uiKeyCopying.put( "ToggleButton.underline.underlineColor", "TabbedPane.underlineColor" );
|
||||
uiKeyCopying.put( "ToggleButton.underline.disabledUnderlineColor", "TabbedPane.disabledUnderlineColor" );
|
||||
uiKeyCopying.put( "ToggleButton.underline.selectedBackground", "TabbedPane.selectedBackground" );
|
||||
uiKeyCopying.put( "ToggleButton.underline.hoverBackground", "TabbedPane.hoverColor" );
|
||||
uiKeyCopying.put( "ToggleButton.underline.focusBackground", "TabbedPane.focusColor" );
|
||||
|
||||
checkboxKeyMapping.put( "Checkbox.Background.Default", "CheckBox.icon.background" );
|
||||
checkboxKeyMapping.put( "Checkbox.Background.Disabled", "CheckBox.icon.disabledBackground" );
|
||||
checkboxKeyMapping.put( "Checkbox.Border.Default", "CheckBox.icon.borderColor" );
|
||||
@@ -453,6 +463,14 @@ public class IntelliJTheme
|
||||
checkboxKeyMapping.put( "Checkbox.Foreground.Selected", "CheckBox.icon.checkmarkColor" );
|
||||
checkboxKeyMapping.put( "Checkbox.Focus.Thin.Selected", "CheckBox.icon.selectedFocusedBorderColor" );
|
||||
|
||||
checkboxDuplicateColors.put( "Checkbox.Background.Default.Dark", "Checkbox.Background.Selected.Dark" );
|
||||
checkboxDuplicateColors.put( "Checkbox.Border.Default.Dark", "Checkbox.Border.Selected.Dark" );
|
||||
checkboxDuplicateColors.put( "Checkbox.Focus.Thin.Default.Dark", "Checkbox.Focus.Thin.Selected.Dark" );
|
||||
@SuppressWarnings( "unchecked" )
|
||||
Map.Entry<String, String>[] entries = checkboxDuplicateColors.entrySet().toArray( new Map.Entry[checkboxDuplicateColors.size()] );
|
||||
for( Map.Entry<String, String> e : entries )
|
||||
checkboxDuplicateColors.put( e.getValue(), e.getKey() );
|
||||
|
||||
// because FlatLaf uses Button.background and Button.borderColor,
|
||||
// but IDEA uses Button.startBackground and Button.startBorderColor,
|
||||
// our default button background and border colors may be replaced by
|
||||
|
||||
@@ -84,32 +84,41 @@ class UIDefaultsLoader
|
||||
|
||||
static void loadDefaultsFromProperties( List<Class<?>> lafClasses, UIDefaults defaults ) {
|
||||
try {
|
||||
List<ClassLoader> addonClassLoaders = new ArrayList<>();
|
||||
|
||||
// load properties files
|
||||
// load core properties files
|
||||
Properties properties = new Properties();
|
||||
ServiceLoader<FlatDefaultsAddon> addonLoader = ServiceLoader.load( FlatDefaultsAddon.class );
|
||||
for( Class<?> lafClass : lafClasses ) {
|
||||
// load core properties
|
||||
String propertiesName = "/" + lafClass.getName().replace( '.', '/' ) + ".properties";
|
||||
String propertiesName = '/' + lafClass.getName().replace( '.', '/' ) + ".properties";
|
||||
try( InputStream in = lafClass.getResourceAsStream( propertiesName ) ) {
|
||||
if( in != null )
|
||||
properties.load( in );
|
||||
}
|
||||
}
|
||||
|
||||
// load properties from addons
|
||||
for( FlatDefaultsAddon addon : addonLoader ) {
|
||||
// get addons and sort them by priority
|
||||
ServiceLoader<FlatDefaultsAddon> addonLoader = ServiceLoader.load( FlatDefaultsAddon.class );
|
||||
List<FlatDefaultsAddon> addonList = new ArrayList<>();
|
||||
for( FlatDefaultsAddon addon : addonLoader )
|
||||
addonList.add( addon );
|
||||
addonList.sort( (addon1, addon2) -> addon1.getPriority() - addon2.getPriority() );
|
||||
|
||||
// load properties from addons
|
||||
for( FlatDefaultsAddon addon : addonList ) {
|
||||
for( Class<?> lafClass : lafClasses ) {
|
||||
try( InputStream in = addon.getDefaults( lafClass ) ) {
|
||||
if( in != null )
|
||||
properties.load( in );
|
||||
}
|
||||
|
||||
ClassLoader addonClassLoader = addon.getClass().getClassLoader();
|
||||
if( !addonClassLoaders.contains( addonClassLoader ) )
|
||||
addonClassLoaders.add( addonClassLoader );
|
||||
}
|
||||
}
|
||||
|
||||
// collect addon class loaders
|
||||
List<ClassLoader> addonClassLoaders = new ArrayList<>();
|
||||
for( FlatDefaultsAddon addon : addonList ) {
|
||||
ClassLoader addonClassLoader = addon.getClass().getClassLoader();
|
||||
if( !addonClassLoaders.contains( addonClassLoader ) )
|
||||
addonClassLoaders.add( addonClassLoader );
|
||||
}
|
||||
|
||||
// collect all platform specific keys (but do not modify properties)
|
||||
ArrayList<String> platformSpecificKeys = new ArrayList<>();
|
||||
for( Object key : properties.keySet() ) {
|
||||
|
||||
@@ -75,7 +75,7 @@ public class FlatBorder
|
||||
boolean isCellEditor = isTableCellEditor( c );
|
||||
float focusWidth = isCellEditor ? 0 : getFocusWidth();
|
||||
float borderWidth = getBorderWidth( c );
|
||||
float arc = isCellEditor ? 0 : getArc();
|
||||
float arc = isCellEditor ? 0 : getArc( c );
|
||||
|
||||
if( isFocused( c ) ) {
|
||||
g2.setColor( getFocusColor( c ) );
|
||||
@@ -173,7 +173,7 @@ public class FlatBorder
|
||||
return getLineWidth();
|
||||
}
|
||||
|
||||
protected float getArc() {
|
||||
protected float getArc( Component c ) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class FlatButtonBorder
|
||||
|
||||
@Override
|
||||
public void paintBorder( Component c, Graphics g, int x, int y, int width, int height ) {
|
||||
if( FlatButtonUI.isContentAreaFilled( c ) && !FlatButtonUI.isHelpButton( c ) )
|
||||
if( FlatButtonUI.isContentAreaFilled( c ) && !FlatButtonUI.isHelpButton( c ) && !FlatToggleButtonUI.isUnderlineButton( c ) )
|
||||
super.paintBorder( c, g, x, y, width, height );
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ public class FlatButtonBorder
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getArc() {
|
||||
return scale( (float) arc );
|
||||
protected float getArc( Component c ) {
|
||||
return FlatButtonUI.isSquareButton( c ) ? 0 : scale( (float) arc );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,6 +209,10 @@ public class FlatButtonUI
|
||||
(icon == null && text != null && ("...".equals( text ) || text.length() == 1));
|
||||
}
|
||||
|
||||
static boolean isSquareButton( Component c ) {
|
||||
return c instanceof AbstractButton && clientPropertyEquals( (AbstractButton) c, BUTTON_TYPE, BUTTON_TYPE_SQUARE );
|
||||
}
|
||||
|
||||
static boolean isHelpButton( Component c ) {
|
||||
return c instanceof JButton && clientPropertyEquals( (JButton) c, BUTTON_TYPE, BUTTON_TYPE_HELP );
|
||||
}
|
||||
@@ -228,43 +232,47 @@ public class FlatButtonUI
|
||||
return;
|
||||
}
|
||||
|
||||
if( isContentAreaFilled( c ) ) {
|
||||
Color background = getBackground( c );
|
||||
if( background != null ) {
|
||||
Graphics2D g2 = (Graphics2D) g.create();
|
||||
try {
|
||||
FlatUIUtils.setRenderingHints( g2 );
|
||||
|
||||
Border border = c.getBorder();
|
||||
float focusWidth = (border instanceof FlatBorder) ? scale( (float) this.focusWidth ) : 0;
|
||||
float arc = (border instanceof FlatButtonBorder || isToolBarButton( c )) ? scale( (float) this.arc ) : 0;
|
||||
boolean def = isDefaultButton( c );
|
||||
|
||||
// paint shadow
|
||||
Color shadowColor = def ? defaultShadowColor : this.shadowColor;
|
||||
if( shadowColor != null && shadowWidth > 0 && focusWidth > 0 && !c.hasFocus() && c.isEnabled() ) {
|
||||
g2.setColor( shadowColor );
|
||||
g2.fill( new RoundRectangle2D.Float( focusWidth, focusWidth + UIScale.scale( (float) shadowWidth ),
|
||||
c.getWidth() - focusWidth * 2, c.getHeight() - focusWidth * 2, arc, arc ) );
|
||||
}
|
||||
|
||||
// paint background
|
||||
Color startBg = def ? defaultBackground : startBackground;
|
||||
Color endBg = def ? defaultEndBackground : endBackground;
|
||||
if( background == startBg && endBg != null && !startBg.equals( endBg ) )
|
||||
g2.setPaint( new GradientPaint( 0, 0, startBg, 0, c.getHeight(), endBg ) );
|
||||
else
|
||||
FlatUIUtils.setColor( g2, background, def ? defaultBackground : c.getBackground() );
|
||||
FlatUIUtils.paintComponentBackground( g2, 0, 0, c.getWidth(), c.getHeight(), focusWidth, arc );
|
||||
} finally {
|
||||
g2.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
if( isContentAreaFilled( c ) )
|
||||
paintBackground( g, c );
|
||||
|
||||
paint( g, c );
|
||||
}
|
||||
|
||||
protected void paintBackground( Graphics g, JComponent c ) {
|
||||
Color background = getBackground( c );
|
||||
if( background != null ) {
|
||||
Graphics2D g2 = (Graphics2D) g.create();
|
||||
try {
|
||||
FlatUIUtils.setRenderingHints( g2 );
|
||||
|
||||
Border border = c.getBorder();
|
||||
float focusWidth = (border instanceof FlatBorder) ? scale( (float) this.focusWidth ) : 0;
|
||||
float arc = ((border instanceof FlatButtonBorder && !isSquareButton( c )) || isToolBarButton( c ))
|
||||
? scale( (float) this.arc ) : 0;
|
||||
boolean def = isDefaultButton( c );
|
||||
|
||||
// paint shadow
|
||||
Color shadowColor = def ? defaultShadowColor : this.shadowColor;
|
||||
if( shadowColor != null && shadowWidth > 0 && focusWidth > 0 && !c.hasFocus() && c.isEnabled() ) {
|
||||
g2.setColor( shadowColor );
|
||||
g2.fill( new RoundRectangle2D.Float( focusWidth, focusWidth + UIScale.scale( (float) shadowWidth ),
|
||||
c.getWidth() - focusWidth * 2, c.getHeight() - focusWidth * 2, arc, arc ) );
|
||||
}
|
||||
|
||||
// paint background
|
||||
Color startBg = def ? defaultBackground : startBackground;
|
||||
Color endBg = def ? defaultEndBackground : endBackground;
|
||||
if( background == startBg && endBg != null && !startBg.equals( endBg ) )
|
||||
g2.setPaint( new GradientPaint( 0, 0, startBg, 0, c.getHeight(), endBg ) );
|
||||
else
|
||||
FlatUIUtils.setColor( g2, background, def ? defaultBackground : c.getBackground() );
|
||||
FlatUIUtils.paintComponentBackground( g2, 0, 0, c.getWidth(), c.getHeight(), focusWidth, arc );
|
||||
} finally {
|
||||
g2.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintText( Graphics g, AbstractButton b, Rectangle textRect, String text ) {
|
||||
if( isHelpButton( b ) )
|
||||
@@ -355,7 +363,7 @@ public class FlatButtonUI
|
||||
if( isIconOnlyButton( c ) )
|
||||
prefSize.width = Math.max( prefSize.width, prefSize.height );
|
||||
else if( !isToolBarButton( c ) )
|
||||
prefSize.width = Math.max( prefSize.width, scale( minimumWidth + (focusWidth * 2) ) );
|
||||
prefSize.width = Math.max( prefSize.width, scale( FlatUIUtils.minimumWidth( c, minimumWidth ) + (focusWidth * 2) ) );
|
||||
|
||||
return prefSize;
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.lang.ref.WeakReference;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.DefaultListCellRenderer;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JComponent;
|
||||
@@ -348,6 +349,8 @@ public class FlatComboBoxUI
|
||||
public void paintCurrentValue( Graphics g, Rectangle bounds, boolean hasFocus ) {
|
||||
ListCellRenderer<Object> renderer = comboBox.getRenderer();
|
||||
uninstallCellPaddingBorder( renderer );
|
||||
if( renderer == null )
|
||||
renderer = new DefaultListCellRenderer();
|
||||
Component c = renderer.getListCellRendererComponent( listBox, comboBox.getSelectedItem(), -1, false, false );
|
||||
c.setFont( comboBox.getFont() );
|
||||
c.applyComponentOrientation( comboBox.getComponentOrientation() );
|
||||
@@ -520,6 +523,8 @@ public class FlatComboBoxUI
|
||||
CellPaddingBorder.uninstall( renderer );
|
||||
CellPaddingBorder.uninstall( lastRendererComponent );
|
||||
|
||||
if( renderer == null )
|
||||
renderer = new DefaultListCellRenderer();
|
||||
Component c = renderer.getListCellRendererComponent( list, value, index, isSelected, cellHasFocus );
|
||||
c.applyComponentOrientation( comboBox.getComponentOrientation() );
|
||||
|
||||
|
||||
@@ -98,6 +98,7 @@ public class FlatEditorPaneUI
|
||||
// and subtract 1px border line width.
|
||||
// Using "(scale( 1 ) * 2)" instead of "scale( 2 )" to deal with rounding
|
||||
// issues. E.g. at scale factor 1.5 the first returns 4, but the second 3.
|
||||
int minimumWidth = FlatUIUtils.minimumWidth( getComponent(), this.minimumWidth );
|
||||
size.width = Math.max( size.width, scale( minimumWidth ) - (scale( 1 ) * 2) );
|
||||
return size;
|
||||
}
|
||||
|
||||
@@ -20,12 +20,14 @@ import java.awt.Color;
|
||||
import java.awt.FontMetrics;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Rectangle;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.basic.BasicHTML;
|
||||
import javax.swing.plaf.basic.BasicLabelUI;
|
||||
import com.formdev.flatlaf.FlatLaf;
|
||||
import com.formdev.flatlaf.util.UIScale;
|
||||
@@ -77,6 +79,51 @@ public class FlatLabelUI
|
||||
defaults_initialized = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installComponents( JLabel c ) {
|
||||
super.installComponents( c );
|
||||
|
||||
// update HTML renderer if necessary
|
||||
updateHTMLRenderer( c, c.getText(), false );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertyChange( PropertyChangeEvent e ) {
|
||||
String name = e.getPropertyName();
|
||||
if( name == "text" || name == "font" || name == "foreground" ) {
|
||||
JLabel label = (JLabel) e.getSource();
|
||||
updateHTMLRenderer( label, label.getText(), true );
|
||||
} else
|
||||
super.propertyChange( e );
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether text contains HTML headings and adds a special CSS rule to
|
||||
* re-calculate heading font sizes based on current component font size.
|
||||
*/
|
||||
static void updateHTMLRenderer( JComponent c, String text, boolean always ) {
|
||||
if( BasicHTML.isHTMLString( text ) &&
|
||||
c.getClientProperty( "html.disable" ) != Boolean.TRUE &&
|
||||
text.contains( "<h" ) &&
|
||||
(text.contains( "<h1" ) || text.contains( "<h2" ) || text.contains( "<h3" ) ||
|
||||
text.contains( "<h4" ) || text.contains( "<h5" ) || text.contains( "<h6" )) )
|
||||
{
|
||||
int headIndex = text.indexOf( "<head>" );
|
||||
|
||||
String style = "<style>BASE_SIZE " + c.getFont().getSize() + "</style>";
|
||||
if( headIndex < 0 )
|
||||
style = "<head>" + style + "</head>";
|
||||
|
||||
int insertIndex = headIndex >= 0 ? (headIndex + "<head>".length()) : "<html>".length();
|
||||
text = text.substring( 0, insertIndex )
|
||||
+ style
|
||||
+ text.substring( insertIndex );
|
||||
} else if( !always )
|
||||
return; // not necessary to invoke BasicHTML.updateRenderer()
|
||||
|
||||
BasicHTML.updateRenderer( c, text );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintEnabledText( JLabel l, Graphics g, String s, int textX, int textY ) {
|
||||
int mnemIndex = FlatLaf.isShowMnemonics() ? l.getDisplayedMnemonicIndex() : -1;
|
||||
|
||||
@@ -147,6 +147,7 @@ public class FlatPasswordFieldUI
|
||||
}
|
||||
|
||||
private Dimension applyMinimumWidth( Dimension size, JComponent c ) {
|
||||
int minimumWidth = FlatUIUtils.minimumWidth( getComponent(), this.minimumWidth );
|
||||
int focusWidth = (c.getBorder() instanceof FlatBorder) ? this.focusWidth : 0;
|
||||
size.width = Math.max( size.width, scale( minimumWidth + (focusWidth * 2) ) );
|
||||
return size;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.formdev.flatlaf.ui;
|
||||
|
||||
import static com.formdev.flatlaf.util.UIScale.scale;
|
||||
import java.awt.Component;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
/**
|
||||
@@ -32,7 +33,7 @@ public class FlatRoundBorder
|
||||
protected final int arc = UIManager.getInt( "Component.arc" );
|
||||
|
||||
@Override
|
||||
protected float getArc() {
|
||||
protected float getArc( Component c ) {
|
||||
return scale( (float) arc );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,22 +14,37 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Smooth scrolling code partly based on code from IntelliJ IDEA Community Edition,
|
||||
* which is licensed under the Apache 2.0 license. Copyright 2000-2016 JetBrains s.r.o.
|
||||
* See: https://github.com/JetBrains/intellij-community/blob/31e1b5a8e43219b9571951bab6457cfb3012e3ef/platform/platform-api/src/com/intellij/ui/components/SmoothScrollPane.java#L141-L185
|
||||
*
|
||||
*/
|
||||
package com.formdev.flatlaf.ui;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Insets;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.ContainerEvent;
|
||||
import java.awt.event.ContainerListener;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.FocusListener;
|
||||
import java.awt.event.MouseWheelEvent;
|
||||
import java.awt.event.MouseWheelListener;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JScrollBar;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.JViewport;
|
||||
import javax.swing.LookAndFeel;
|
||||
import javax.swing.ScrollPaneConstants;
|
||||
import javax.swing.Scrollable;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.basic.BasicScrollPaneUI;
|
||||
@@ -46,6 +61,10 @@ import com.formdev.flatlaf.FlatClientProperties;
|
||||
* @uiDefault ScrollPane.border Border
|
||||
* @uiDefault ScrollPane.viewportBorder Border
|
||||
*
|
||||
* <!-- FlatScrollPaneUI -->
|
||||
*
|
||||
* @uiDefault ScrollPane.smoothScrolling boolean
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatScrollPaneUI
|
||||
@@ -90,6 +109,130 @@ public class FlatScrollPaneUI
|
||||
handler = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MouseWheelListener createMouseWheelListener() {
|
||||
return new BasicScrollPaneUI.MouseWheelHandler() {
|
||||
@Override
|
||||
public void mouseWheelMoved( MouseWheelEvent e ) {
|
||||
// Note: Getting UI value "ScrollPane.smoothScrolling" here to allow
|
||||
// applications to turn smooth scrolling on or off at any time
|
||||
// (e.g. in application options dialog).
|
||||
if( UIManager.getBoolean( "ScrollPane.smoothScrolling" ) &&
|
||||
scrollpane.isWheelScrollingEnabled() &&
|
||||
e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL &&
|
||||
e.getPreciseWheelRotation() != 0 &&
|
||||
e.getPreciseWheelRotation() != e.getWheelRotation() )
|
||||
{
|
||||
mouseWheelMovedSmooth( e );
|
||||
} else
|
||||
super.mouseWheelMoved( e );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static final double EPSILON = 1e-5d;
|
||||
|
||||
private void mouseWheelMovedSmooth( MouseWheelEvent e ) {
|
||||
// return if there is no viewport
|
||||
JViewport viewport = scrollpane.getViewport();
|
||||
if( viewport == null )
|
||||
return;
|
||||
|
||||
// find scrollbar to scroll
|
||||
JScrollBar scrollbar = scrollpane.getVerticalScrollBar();
|
||||
if( scrollbar == null || !scrollbar.isVisible() || e.isShiftDown() ) {
|
||||
scrollbar = scrollpane.getHorizontalScrollBar();
|
||||
if( scrollbar == null || !scrollbar.isVisible() )
|
||||
return;
|
||||
}
|
||||
|
||||
// consume event
|
||||
e.consume();
|
||||
|
||||
// get precise wheel rotation
|
||||
double rotation = e.getPreciseWheelRotation();
|
||||
|
||||
// get unit and block increment
|
||||
int unitIncrement;
|
||||
int blockIncrement;
|
||||
int orientation = scrollbar.getOrientation();
|
||||
Component view = viewport.getView();
|
||||
if( view instanceof Scrollable ) {
|
||||
Scrollable scrollable = (Scrollable) view;
|
||||
|
||||
// Use (0, 0) view position to obtain constant unit increment of first item
|
||||
// (which might otherwise be variable on smaller-than-unit scrolling).
|
||||
Rectangle visibleRect = new Rectangle( viewport.getViewSize() );
|
||||
unitIncrement = scrollable.getScrollableUnitIncrement( visibleRect, orientation, 1 );
|
||||
blockIncrement = scrollable.getScrollableBlockIncrement( visibleRect, orientation, 1 );
|
||||
|
||||
if( unitIncrement > 0 ) {
|
||||
// For the case that the first item (e.g. in a list) is larger
|
||||
// than the other items, get the unit increment of the second item
|
||||
// and use the smaller one.
|
||||
if( orientation == SwingConstants.VERTICAL ) {
|
||||
visibleRect.y += unitIncrement;
|
||||
visibleRect.height -= unitIncrement;
|
||||
} else {
|
||||
visibleRect.x += unitIncrement;
|
||||
visibleRect.width -= unitIncrement;
|
||||
}
|
||||
int unitIncrement2 = scrollable.getScrollableUnitIncrement( visibleRect, orientation, 1 );
|
||||
if( unitIncrement2 > 0 )
|
||||
unitIncrement = Math.min( unitIncrement, unitIncrement2 );
|
||||
}
|
||||
} else {
|
||||
int direction = rotation < 0 ? -1 : 1;
|
||||
unitIncrement = scrollbar.getUnitIncrement( direction );
|
||||
blockIncrement = scrollbar.getBlockIncrement( direction );
|
||||
}
|
||||
|
||||
// limit scroll amount (number of units to scroll) for small viewports
|
||||
// (e.g. vertical scrolling in file chooser)
|
||||
int scrollAmount = e.getScrollAmount();
|
||||
int viewportWH = (orientation == SwingConstants.VERTICAL)
|
||||
? viewport.getHeight()
|
||||
: viewport.getWidth();
|
||||
if( unitIncrement * scrollAmount > viewportWH )
|
||||
scrollAmount = Math.max( viewportWH / unitIncrement, 1 );
|
||||
|
||||
// compute relative delta
|
||||
double delta = rotation * scrollAmount * unitIncrement;
|
||||
boolean adjustDelta = Math.abs( rotation ) < (1.0 + EPSILON);
|
||||
double adjustedDelta = adjustDelta
|
||||
? Math.max( -blockIncrement, Math.min( delta, blockIncrement ) )
|
||||
: delta;
|
||||
|
||||
// compute new value
|
||||
int value = scrollbar.getValue();
|
||||
double minDelta = scrollbar.getMinimum() - value;
|
||||
double maxDelta = scrollbar.getMaximum() - scrollbar.getModel().getExtent() - value;
|
||||
double boundedDelta = Math.max( minDelta, Math.min( adjustedDelta, maxDelta ) );
|
||||
int newValue = value + (int) Math.round( boundedDelta );
|
||||
|
||||
// set new value
|
||||
if( newValue != value )
|
||||
scrollbar.setValue( newValue );
|
||||
|
||||
/*debug
|
||||
System.out.println( String.format( "%4d %9f / %4d %4d / %12f %5s %12f / %4d %4d %4d / %12f %12f %12f / %4d",
|
||||
e.getWheelRotation(),
|
||||
e.getPreciseWheelRotation(),
|
||||
unitIncrement,
|
||||
blockIncrement,
|
||||
delta,
|
||||
adjustDelta,
|
||||
adjustedDelta,
|
||||
value,
|
||||
scrollbar.getMinimum(),
|
||||
scrollbar.getMaximum(),
|
||||
minDelta,
|
||||
maxDelta,
|
||||
boundedDelta,
|
||||
newValue ) );
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PropertyChangeListener createPropertyChangeListener() {
|
||||
return new BasicScrollPaneUI.PropertyChangeHandler() {
|
||||
@@ -97,17 +240,35 @@ public class FlatScrollPaneUI
|
||||
public void propertyChange( PropertyChangeEvent e ) {
|
||||
super.propertyChange( e );
|
||||
|
||||
if( FlatClientProperties.SCROLL_BAR_SHOW_BUTTONS.equals( e.getPropertyName() ) ) {
|
||||
JScrollBar vsb = scrollpane.getVerticalScrollBar();
|
||||
JScrollBar hsb = scrollpane.getHorizontalScrollBar();
|
||||
if( vsb != null ) {
|
||||
vsb.revalidate();
|
||||
vsb.repaint();
|
||||
}
|
||||
if( hsb != null ) {
|
||||
hsb.revalidate();
|
||||
hsb.repaint();
|
||||
}
|
||||
switch( e.getPropertyName() ) {
|
||||
case FlatClientProperties.SCROLL_BAR_SHOW_BUTTONS:
|
||||
JScrollBar vsb = scrollpane.getVerticalScrollBar();
|
||||
JScrollBar hsb = scrollpane.getHorizontalScrollBar();
|
||||
if( vsb != null ) {
|
||||
vsb.revalidate();
|
||||
vsb.repaint();
|
||||
}
|
||||
if( hsb != null ) {
|
||||
hsb.revalidate();
|
||||
hsb.repaint();
|
||||
}
|
||||
break;
|
||||
|
||||
case ScrollPaneConstants.LOWER_LEFT_CORNER:
|
||||
case ScrollPaneConstants.LOWER_RIGHT_CORNER:
|
||||
case ScrollPaneConstants.UPPER_LEFT_CORNER:
|
||||
case ScrollPaneConstants.UPPER_RIGHT_CORNER:
|
||||
// remove border from buttons added to corners
|
||||
Object corner = e.getNewValue();
|
||||
if( corner instanceof JButton &&
|
||||
((JButton)corner).getBorder() instanceof FlatButtonBorder &&
|
||||
scrollpane.getViewport() != null &&
|
||||
scrollpane.getViewport().getView() instanceof JTable )
|
||||
{
|
||||
((JButton)corner).setBorder( BorderFactory.createEmptyBorder() );
|
||||
((JButton)corner).setFocusable( false );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -326,6 +326,7 @@ public class FlatSpinnerUI
|
||||
Dimension editorSize = (editor != null) ? editor.getPreferredSize() : new Dimension( 0, 0 );
|
||||
|
||||
// the arrows width is the same as the inner height so that the arrows area is square
|
||||
int minimumWidth = FlatUIUtils.minimumWidth( spinner, FlatSpinnerUI.this.minimumWidth );
|
||||
int innerHeight = editorSize.height + padding.top + padding.bottom;
|
||||
return new Dimension(
|
||||
Math.max( insets.left + insets.right + editorSize.width + padding.left + padding.right + innerHeight, scale( minimumWidth + (focusWidth * 2) ) ),
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.formdev.flatlaf.ui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
@@ -29,6 +30,7 @@ import javax.swing.JTable;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.basic.BasicTableHeaderUI;
|
||||
import javax.swing.table.TableCellRenderer;
|
||||
import javax.swing.table.TableColumn;
|
||||
import javax.swing.table.TableColumnModel;
|
||||
import com.formdev.flatlaf.util.UIScale;
|
||||
@@ -81,10 +83,14 @@ public class FlatTableHeaderUI
|
||||
@Override
|
||||
public void paint( Graphics g, JComponent c ) {
|
||||
// do not paint borders if JTableHeader.setDefaultRenderer() was used
|
||||
String rendererClassName = header.getDefaultRenderer().getClass().getName();
|
||||
boolean paintBorders =
|
||||
rendererClassName.equals( "sun.swing.table.DefaultTableCellHeaderRenderer" ) ||
|
||||
rendererClassName.equals( "sun.swing.FilePane$AlignableTableHeaderRenderer" );
|
||||
TableCellRenderer defaultRenderer = header.getDefaultRenderer();
|
||||
boolean paintBorders = isSystemDefaultRenderer( defaultRenderer );
|
||||
if( !paintBorders && header.getColumnModel().getColumnCount() > 0 ) {
|
||||
// check whether the renderer delegates to the system default renderer
|
||||
Component rendererComponent = defaultRenderer.getTableCellRendererComponent(
|
||||
header.getTable(), "", false, false, -1, 0 );
|
||||
paintBorders = isSystemDefaultRenderer( rendererComponent );
|
||||
}
|
||||
|
||||
if( paintBorders )
|
||||
paintColumnBorders( g, c );
|
||||
@@ -95,6 +101,12 @@ public class FlatTableHeaderUI
|
||||
paintDraggedColumnBorders( g, c );
|
||||
}
|
||||
|
||||
private boolean isSystemDefaultRenderer( Object headerRenderer ) {
|
||||
String rendererClassName = headerRenderer.getClass().getName();
|
||||
return rendererClassName.equals( "sun.swing.table.DefaultTableCellHeaderRenderer" ) ||
|
||||
rendererClassName.equals( "sun.swing.FilePane$AlignableTableHeaderRenderer" );
|
||||
}
|
||||
|
||||
private void paintColumnBorders( Graphics g, JComponent c ) {
|
||||
int width = c.getWidth();
|
||||
int height = c.getHeight();
|
||||
|
||||
@@ -56,7 +56,8 @@ import com.formdev.flatlaf.util.UIScale;
|
||||
* <!-- FlatTableUI -->
|
||||
*
|
||||
* @uiDefault Table.rowHeight int
|
||||
* @uiDefault Table.showGrid boolean
|
||||
* @uiDefault Table.showHorizontalLines boolean
|
||||
* @uiDefault Table.showVerticalLines boolean
|
||||
* @uiDefault Table.intercellSpacing Dimension
|
||||
* @uiDefault Table.selectionInactiveBackground Color
|
||||
* @uiDefault Table.selectionInactiveForeground Color
|
||||
@@ -72,7 +73,8 @@ import com.formdev.flatlaf.util.UIScale;
|
||||
public class FlatTableUI
|
||||
extends BasicTableUI
|
||||
{
|
||||
protected boolean showGrid;
|
||||
protected boolean showHorizontalLines;
|
||||
protected boolean showVerticalLines;
|
||||
protected Dimension intercellSpacing;
|
||||
|
||||
protected Color selectionBackground;
|
||||
@@ -102,7 +104,8 @@ public class FlatTableUI
|
||||
protected void installDefaults() {
|
||||
super.installDefaults();
|
||||
|
||||
showGrid = UIManager.getBoolean( "Table.showGrid" );
|
||||
showHorizontalLines = UIManager.getBoolean( "Table.showHorizontalLines" );
|
||||
showVerticalLines = UIManager.getBoolean( "Table.showVerticalLines" );
|
||||
intercellSpacing = UIManager.getDimension( "Table.intercellSpacing" );
|
||||
|
||||
selectionBackground = UIManager.getColor( "Table.selectionBackground" );
|
||||
@@ -116,10 +119,13 @@ public class FlatTableUI
|
||||
if( rowHeight > 0 )
|
||||
LookAndFeel.installProperty( table, "rowHeight", UIScale.scale( rowHeight ) );
|
||||
|
||||
if( !showGrid ) {
|
||||
if( !showHorizontalLines ) {
|
||||
oldShowHorizontalLines = table.getShowHorizontalLines();
|
||||
table.setShowHorizontalLines( false );
|
||||
}
|
||||
if( !showVerticalLines ) {
|
||||
oldShowVerticalLines = table.getShowVerticalLines();
|
||||
table.setShowGrid( false );
|
||||
table.setShowVerticalLines( false );
|
||||
}
|
||||
|
||||
if( intercellSpacing != null ) {
|
||||
@@ -137,19 +143,15 @@ public class FlatTableUI
|
||||
selectionInactiveBackground = null;
|
||||
selectionInactiveForeground = null;
|
||||
|
||||
// restore old show grid
|
||||
if( !showGrid ) {
|
||||
if( !table.getShowHorizontalLines() )
|
||||
table.setShowHorizontalLines( oldShowHorizontalLines );
|
||||
if( !table.getShowVerticalLines() )
|
||||
table.setShowVerticalLines( oldShowVerticalLines );
|
||||
}
|
||||
// restore old show horizontal/vertical lines (if not modified)
|
||||
if( !showHorizontalLines && oldShowHorizontalLines && !table.getShowHorizontalLines() )
|
||||
table.setShowHorizontalLines( true );
|
||||
if( !showVerticalLines && oldShowVerticalLines && !table.getShowVerticalLines() )
|
||||
table.setShowVerticalLines( true );
|
||||
|
||||
// restore old intercell spacing
|
||||
if( intercellSpacing != null ) {
|
||||
if( table.getIntercellSpacing().equals( intercellSpacing ) )
|
||||
table.setIntercellSpacing( oldIntercellSpacing );
|
||||
}
|
||||
// restore old intercell spacing (if not modified)
|
||||
if( intercellSpacing != null && table.getIntercellSpacing().equals( intercellSpacing ) )
|
||||
table.setIntercellSpacing( oldIntercellSpacing );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -117,6 +117,7 @@ public class FlatTextAreaUI
|
||||
// and subtract 1px border line width.
|
||||
// Using "(scale( 1 ) * 2)" instead of "scale( 2 )" to deal with rounding
|
||||
// issues. E.g. at scale factor 1.5 the first returns 4, but the second 3.
|
||||
int minimumWidth = FlatUIUtils.minimumWidth( getComponent(), this.minimumWidth );
|
||||
size.width = Math.max( size.width, scale( minimumWidth ) - (scale( 1 ) * 2) );
|
||||
return size;
|
||||
}
|
||||
|
||||
@@ -217,6 +217,7 @@ public class FlatTextFieldUI
|
||||
(parent != null && parent.getParent() instanceof JSpinner) )
|
||||
return size;
|
||||
|
||||
int minimumWidth = FlatUIUtils.minimumWidth( getComponent(), this.minimumWidth );
|
||||
int focusWidth = (c.getBorder() instanceof FlatBorder) ? this.focusWidth : 0;
|
||||
size.width = Math.max( size.width, scale( minimumWidth + (focusWidth * 2) ) );
|
||||
return size;
|
||||
|
||||
@@ -98,6 +98,7 @@ public class FlatTextPaneUI
|
||||
// and subtract 1px border line width.
|
||||
// Using "(scale( 1 ) * 2)" instead of "scale( 2 )" to deal with rounding
|
||||
// issues. E.g. at scale factor 1.5 the first returns 4, but the second 3.
|
||||
int minimumWidth = FlatUIUtils.minimumWidth( getComponent(), this.minimumWidth );
|
||||
size.width = Math.max( size.width, scale( minimumWidth ) - (scale( 1 ) * 2) );
|
||||
return size;
|
||||
}
|
||||
|
||||
@@ -16,12 +16,17 @@
|
||||
|
||||
package com.formdev.flatlaf.ui;
|
||||
|
||||
import static com.formdev.flatlaf.FlatClientProperties.*;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Graphics;
|
||||
import javax.swing.AbstractButton;
|
||||
import javax.swing.ButtonModel;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JToggleButton;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import com.formdev.flatlaf.util.UIScale;
|
||||
|
||||
/**
|
||||
* Provides the Flat LaF UI delegate for {@link javax.swing.JToggleButton}.
|
||||
@@ -55,6 +60,13 @@ import javax.swing.plaf.ComponentUI;
|
||||
* @uiDefault ToggleButton.disabledSelectedBackground Color
|
||||
* @uiDefault ToggleButton.toolbar.selectedBackground Color
|
||||
*
|
||||
* @uiDefault ToggleButton.underline.underlineHeight int
|
||||
* @uiDefault ToggleButton.underline.underlineColor Color
|
||||
* @uiDefault ToggleButton.underline.disabledUnderlineColor Color
|
||||
* @uiDefault ToggleButton.underline.selectedBackground Color optional
|
||||
* @uiDefault ToggleButton.underline.hoverBackground Color
|
||||
* @uiDefault ToggleButton.underline.focusBackground Color
|
||||
*
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
@@ -67,6 +79,13 @@ public class FlatToggleButtonUI
|
||||
|
||||
protected Color toolbarSelectedBackground;
|
||||
|
||||
protected int underlineHeight;
|
||||
protected Color underlineColor;
|
||||
protected Color disabledUnderlineColor;
|
||||
protected Color underlineSelectedBackground;
|
||||
protected Color underlineHoverBackground;
|
||||
protected Color underlineFocusBackground;
|
||||
|
||||
private boolean defaults_initialized = false;
|
||||
|
||||
private static ComponentUI instance;
|
||||
@@ -93,6 +112,13 @@ public class FlatToggleButtonUI
|
||||
|
||||
toolbarSelectedBackground = UIManager.getColor( "ToggleButton.toolbar.selectedBackground" );
|
||||
|
||||
underlineHeight = UIManager.getInt( "ToggleButton.underline.underlineHeight" );
|
||||
underlineColor = UIManager.getColor( "ToggleButton.underline.underlineColor" );
|
||||
disabledUnderlineColor = UIManager.getColor( "ToggleButton.underline.disabledUnderlineColor" );
|
||||
underlineSelectedBackground = UIManager.getColor( "ToggleButton.underline.selectedBackground" );
|
||||
underlineHoverBackground = UIManager.getColor( "ToggleButton.underline.hoverBackground" );
|
||||
underlineFocusBackground = UIManager.getColor( "ToggleButton.underline.focusBackground" );
|
||||
|
||||
defaults_initialized = true;
|
||||
}
|
||||
}
|
||||
@@ -103,6 +129,36 @@ public class FlatToggleButtonUI
|
||||
defaults_initialized = false;
|
||||
}
|
||||
|
||||
static boolean isUnderlineButton( Component c ) {
|
||||
return c instanceof JToggleButton && clientPropertyEquals( (JToggleButton) c, BUTTON_TYPE, BUTTON_TYPE_UNDERLINE );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintBackground( Graphics g, JComponent c ) {
|
||||
if( isUnderlineButton( c ) ) {
|
||||
int height = c.getHeight();
|
||||
int width = c.getWidth();
|
||||
boolean selected = ((AbstractButton)c).isSelected();
|
||||
|
||||
// paint background
|
||||
Color background = buttonStateColor( c,
|
||||
selected ? underlineSelectedBackground : null,
|
||||
null, underlineFocusBackground, underlineHoverBackground, null );
|
||||
if( background != null ) {
|
||||
g.setColor( background );
|
||||
g.fillRect( 0, 0, width, height );
|
||||
}
|
||||
|
||||
// paint underline if selected
|
||||
if( selected ) {
|
||||
int underlineHeight = UIScale.scale( this.underlineHeight );
|
||||
g.setColor( c.isEnabled() ? underlineColor : disabledUnderlineColor );
|
||||
g.fillRect( 0, height - underlineHeight, width, underlineHeight );
|
||||
}
|
||||
} else
|
||||
super.paintBackground( g, c );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Color getBackground( JComponent c ) {
|
||||
ButtonModel model = ((AbstractButton)c).getModel();
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.awt.FontMetrics;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Insets;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.util.List;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JToolTip;
|
||||
@@ -47,6 +48,8 @@ import com.formdev.flatlaf.util.StringUtils;
|
||||
public class FlatToolTipUI
|
||||
extends BasicToolTipUI
|
||||
{
|
||||
private static PropertyChangeListener sharedPropertyChangedListener;
|
||||
|
||||
private static ComponentUI instance;
|
||||
|
||||
public static ComponentUI createUI( JComponent c ) {
|
||||
@@ -55,6 +58,38 @@ public class FlatToolTipUI
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void installUI( JComponent c ) {
|
||||
super.installUI( c );
|
||||
|
||||
// update HTML renderer if necessary
|
||||
FlatLabelUI.updateHTMLRenderer( c, ((JToolTip)c).getTipText(), false );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installListeners( JComponent c ) {
|
||||
super.installListeners( c );
|
||||
|
||||
if( sharedPropertyChangedListener == null ) {
|
||||
sharedPropertyChangedListener = e -> {
|
||||
String name = e.getPropertyName();
|
||||
if( name == "text" || name == "font" || name == "foreground" ) {
|
||||
JToolTip toolTip = (JToolTip) e.getSource();
|
||||
FlatLabelUI.updateHTMLRenderer( toolTip, toolTip.getTipText(), false );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
c.addPropertyChangeListener( sharedPropertyChangedListener );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallListeners( JComponent c ) {
|
||||
super.uninstallListeners( c );
|
||||
|
||||
c.removePropertyChangeListener( sharedPropertyChangedListener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getPreferredSize( JComponent c ) {
|
||||
if( isMultiLine( c ) ) {
|
||||
|
||||
@@ -232,7 +232,7 @@ public class FlatTreeUI
|
||||
g.setColor( isDropRow
|
||||
? UIManager.getColor( "Tree.dropCellBackground" )
|
||||
: (hasFocus ? selectionBackground : selectionInactiveBackground) );
|
||||
g.fillRect( 0, bounds.y, clipBounds.width, bounds.height );
|
||||
g.fillRect( 0, bounds.y, tree.getWidth(), bounds.height );
|
||||
|
||||
// paint expand/collapse icon
|
||||
if( shouldPaintExpandControl( path, row, isExpanded, hasBeenExpanded, isLeaf ) ) {
|
||||
|
||||
@@ -38,6 +38,7 @@ import javax.swing.JComponent;
|
||||
import javax.swing.LookAndFeel;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.ColorUIResource;
|
||||
import com.formdev.flatlaf.FlatClientProperties;
|
||||
import com.formdev.flatlaf.util.DerivedColor;
|
||||
import com.formdev.flatlaf.util.HiDPIUtils;
|
||||
import com.formdev.flatlaf.util.JavaCompatibility;
|
||||
@@ -111,6 +112,11 @@ public class FlatUIUtils
|
||||
return (c instanceof ColorUIResource) ? new Color( c.getRGB(), true ) : c;
|
||||
}
|
||||
|
||||
public static int minimumWidth( JComponent c, int minimumWidth ) {
|
||||
Object p = c.getClientProperty( FlatClientProperties.MINIMUM_WIDTH );
|
||||
return (p instanceof Integer) ? ((Integer)p).intValue() : minimumWidth;
|
||||
}
|
||||
|
||||
public static boolean isTableCellEditor( Component c ) {
|
||||
return c instanceof JComponent && Boolean.TRUE.equals( ((JComponent)c).getClientProperty( "JComboBox.isTableCellEditor" ) );
|
||||
}
|
||||
|
||||
@@ -30,6 +30,12 @@ Component.innerFocusWidth=0
|
||||
Component.arrowType=triangle
|
||||
|
||||
|
||||
#---- ProgressBar ----
|
||||
|
||||
ProgressBar.foreground=#a0a0a0
|
||||
ProgressBar.selectionForeground=@background
|
||||
|
||||
|
||||
#---- RadioButton ----
|
||||
|
||||
RadioButton.icon.centerDiameter=5
|
||||
|
||||
@@ -64,10 +64,9 @@
|
||||
|
||||
activeCaption=#434E60
|
||||
inactiveCaption=#393C3D
|
||||
controlHighlight=#616669
|
||||
controlLtHighlight=#303234
|
||||
controlShadow=#afb3b5
|
||||
controlDkShadow=#d7d9da
|
||||
controlHighlight=darken($controlShadow,20%)
|
||||
controlLtHighlight=darken($controlShadow,25%)
|
||||
controlDkShadow=lighten($controlShadow,10%)
|
||||
|
||||
|
||||
#---- Button ----
|
||||
@@ -161,8 +160,8 @@ PopupMenu.borderColor=#515151
|
||||
#---- ProgressBar ----
|
||||
|
||||
ProgressBar.background=#555555
|
||||
ProgressBar.foreground=#a0a0a0
|
||||
ProgressBar.selectionForeground=@background
|
||||
ProgressBar.foreground=#4A88C7
|
||||
ProgressBar.selectionForeground=@foreground
|
||||
ProgressBar.selectionBackground=@foreground
|
||||
|
||||
|
||||
|
||||
@@ -80,6 +80,7 @@ textHighlightText=@selectionForeground
|
||||
textInactiveText=@disabledText
|
||||
control=@background
|
||||
controlText=@foreground
|
||||
controlShadow=$Component.borderColor
|
||||
scrollbar=$ScrollBar.track
|
||||
info=$ToolTip.background
|
||||
infoText=@foreground
|
||||
@@ -196,6 +197,7 @@ HelpButton.disabledQuestionMarkColor=$CheckBox.icon.disabledCheckmarkColor
|
||||
#---- List ----
|
||||
|
||||
List.border=1,0,1,0
|
||||
List.border=0,0,0,0
|
||||
List.cellMargins=1,6,1,6
|
||||
List.cellFocusColor=@cellFocusColor
|
||||
List.cellNoFocusBorder=com.formdev.flatlaf.ui.FlatListCellBorder$Default
|
||||
@@ -311,6 +313,7 @@ ScrollBar.buttonDisabledArrowColor=$ComboBox.buttonDisabledArrowColor
|
||||
ScrollPane.border=com.formdev.flatlaf.ui.FlatBorder
|
||||
ScrollPane.background=$ScrollBar.track
|
||||
ScrollPane.fillUpperCorner=true
|
||||
ScrollPane.smoothScrolling=true
|
||||
|
||||
|
||||
#---- Separator ----
|
||||
@@ -369,7 +372,8 @@ TabbedPane.shadow=$ComboBox.buttonArrowColor
|
||||
#---- Table ----
|
||||
|
||||
Table.rowHeight=20
|
||||
Table.showGrid=false
|
||||
Table.showHorizontalLines=false
|
||||
Table.showVerticalLines=false
|
||||
Table.intercellSpacing={dimension}0,0
|
||||
Table.scrollPaneBorder=com.formdev.flatlaf.ui.FlatBorder
|
||||
Table.ascendingSortIcon=com.formdev.flatlaf.icons.FlatAscendingSortIcon
|
||||
@@ -435,6 +439,14 @@ ToggleButton.pressedBackground=$Button.pressedBackground
|
||||
ToggleButton.toolbar.hoverBackground=$Button.toolbar.hoverBackground
|
||||
ToggleButton.toolbar.pressedBackground=$Button.toolbar.pressedBackground
|
||||
|
||||
# button type "underline"
|
||||
ToggleButton.underline.underlineHeight=2
|
||||
ToggleButton.underline.underlineColor=$TabbedPane.underlineColor
|
||||
ToggleButton.underline.disabledUnderlineColor=$TabbedPane.disabledUnderlineColor
|
||||
ToggleButton.underline.selectedBackground=$?TabbedPane.selectedBackground
|
||||
ToggleButton.underline.hoverBackground=$TabbedPane.hoverColor
|
||||
ToggleButton.underline.focusBackground=$TabbedPane.focusColor
|
||||
|
||||
|
||||
#---- ToolBar ----
|
||||
|
||||
|
||||
@@ -66,8 +66,7 @@ activeCaption=#99b4d1
|
||||
inactiveCaption=#bfcddb
|
||||
controlHighlight=#e3e3e3
|
||||
controlLtHighlight=#fff
|
||||
controlShadow=#a0a0a0
|
||||
controlDkShadow=#696969
|
||||
controlDkShadow=darken($controlShadow,15%)
|
||||
|
||||
|
||||
#---- Button ----
|
||||
|
||||
@@ -37,6 +37,8 @@ class BasicComponentsPanel
|
||||
JLabel buttonLabel = new JLabel();
|
||||
JButton button1 = new JButton();
|
||||
JButton button2 = new JButton();
|
||||
JButton button5 = new JButton();
|
||||
JButton button6 = new JButton();
|
||||
JButton button3 = new JButton();
|
||||
JButton button4 = new JButton();
|
||||
JButton button13 = new JButton();
|
||||
@@ -166,10 +168,21 @@ class BasicComponentsPanel
|
||||
button2.setEnabled(false);
|
||||
add(button2, "cell 2 1");
|
||||
|
||||
//---- button5 ----
|
||||
button5.setText("square");
|
||||
button5.putClientProperty("JButton.buttonType", "square");
|
||||
add(button5, "cell 3 1");
|
||||
|
||||
//---- button6 ----
|
||||
button6.setText("square");
|
||||
button6.setEnabled(false);
|
||||
button6.putClientProperty("JButton.buttonType", "square");
|
||||
add(button6, "cell 4 1");
|
||||
|
||||
//---- button3 ----
|
||||
button3.setText("Help");
|
||||
button3.putClientProperty("JButton.buttonType", "help");
|
||||
add(button3, "cell 3 1");
|
||||
add(button3, "cell 4 1");
|
||||
|
||||
//---- button4 ----
|
||||
button4.setText("Help");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
JFDML JFormDesigner: "7.0.0.0.194" Java: "11.0.2" encoding: "UTF-8"
|
||||
JFDML JFormDesigner: "7.0.0.0.194" Java: "13.0.1" encoding: "UTF-8"
|
||||
|
||||
new FormModel {
|
||||
contentType: "form/swing"
|
||||
@@ -54,12 +54,27 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
name: "button5"
|
||||
"text": "square"
|
||||
"$client.JButton.buttonType": "square"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 3 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
name: "button6"
|
||||
"text": "square"
|
||||
"enabled": false
|
||||
"$client.JButton.buttonType": "square"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 4 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
name: "button3"
|
||||
"text": "Help"
|
||||
"$client.JButton.buttonType": "help"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 3 1"
|
||||
"value": "cell 4 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
name: "button4"
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.awt.datatransfer.StringSelection;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.*;
|
||||
import javax.swing.tree.*;
|
||||
import net.miginfocom.swing.*;
|
||||
|
||||
/**
|
||||
@@ -171,6 +172,32 @@ class DataComponentsPanel
|
||||
//---- tree1 ----
|
||||
tree1.setShowsRootHandles(true);
|
||||
tree1.setEditable(true);
|
||||
tree1.setModel(new DefaultTreeModel(
|
||||
new DefaultMutableTreeNode("JTree") {
|
||||
{
|
||||
DefaultMutableTreeNode node1 = new DefaultMutableTreeNode("colors");
|
||||
node1.add(new DefaultMutableTreeNode("blue"));
|
||||
node1.add(new DefaultMutableTreeNode("violet"));
|
||||
node1.add(new DefaultMutableTreeNode("red"));
|
||||
node1.add(new DefaultMutableTreeNode("yellow"));
|
||||
add(node1);
|
||||
node1 = new DefaultMutableTreeNode("sports");
|
||||
node1.add(new DefaultMutableTreeNode("basketball"));
|
||||
node1.add(new DefaultMutableTreeNode("soccer"));
|
||||
node1.add(new DefaultMutableTreeNode("football"));
|
||||
node1.add(new DefaultMutableTreeNode("hockey"));
|
||||
add(node1);
|
||||
node1 = new DefaultMutableTreeNode("food");
|
||||
node1.add(new DefaultMutableTreeNode("hot dogs"));
|
||||
DefaultMutableTreeNode node2 = new DefaultMutableTreeNode("pizza");
|
||||
node2.add(new DefaultMutableTreeNode("pizza aglio e olio"));
|
||||
node2.add(new DefaultMutableTreeNode("pizza margherita bianca"));
|
||||
node1.add(node2);
|
||||
node1.add(new DefaultMutableTreeNode("ravioli"));
|
||||
node1.add(new DefaultMutableTreeNode("bananas"));
|
||||
add(node1);
|
||||
}
|
||||
}));
|
||||
scrollPane3.setViewportView(tree1);
|
||||
}
|
||||
add(scrollPane3, "cell 1 1,growx");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
JFDML JFormDesigner: "7.0.0.0.194" Java: "11.0.2" encoding: "UTF-8"
|
||||
JFDML JFormDesigner: "7.0.0.0.194" Java: "13.0.1" encoding: "UTF-8"
|
||||
|
||||
new FormModel {
|
||||
contentType: "form/swing"
|
||||
@@ -89,6 +89,60 @@ new FormModel {
|
||||
name: "tree1"
|
||||
"showsRootHandles": true
|
||||
"editable": true
|
||||
"model": new javax.swing.tree.DefaultTreeModel( new javax.swing.tree.DefaultMutableTreeNode {
|
||||
userObject: "JTree"
|
||||
add( new javax.swing.tree.DefaultMutableTreeNode {
|
||||
userObject: "colors"
|
||||
add( new javax.swing.tree.DefaultMutableTreeNode {
|
||||
userObject: "blue"
|
||||
} )
|
||||
add( new javax.swing.tree.DefaultMutableTreeNode {
|
||||
userObject: "violet"
|
||||
} )
|
||||
add( new javax.swing.tree.DefaultMutableTreeNode {
|
||||
userObject: "red"
|
||||
} )
|
||||
add( new javax.swing.tree.DefaultMutableTreeNode {
|
||||
userObject: "yellow"
|
||||
} )
|
||||
} )
|
||||
add( new javax.swing.tree.DefaultMutableTreeNode {
|
||||
userObject: "sports"
|
||||
add( new javax.swing.tree.DefaultMutableTreeNode {
|
||||
userObject: "basketball"
|
||||
} )
|
||||
add( new javax.swing.tree.DefaultMutableTreeNode {
|
||||
userObject: "soccer"
|
||||
} )
|
||||
add( new javax.swing.tree.DefaultMutableTreeNode {
|
||||
userObject: "football"
|
||||
} )
|
||||
add( new javax.swing.tree.DefaultMutableTreeNode {
|
||||
userObject: "hockey"
|
||||
} )
|
||||
} )
|
||||
add( new javax.swing.tree.DefaultMutableTreeNode {
|
||||
userObject: "food"
|
||||
add( new javax.swing.tree.DefaultMutableTreeNode {
|
||||
userObject: "hot dogs"
|
||||
} )
|
||||
add( new javax.swing.tree.DefaultMutableTreeNode {
|
||||
userObject: "pizza"
|
||||
add( new javax.swing.tree.DefaultMutableTreeNode {
|
||||
userObject: "pizza aglio e olio"
|
||||
} )
|
||||
add( new javax.swing.tree.DefaultMutableTreeNode {
|
||||
userObject: "pizza margherita bianca"
|
||||
} )
|
||||
} )
|
||||
add( new javax.swing.tree.DefaultMutableTreeNode {
|
||||
userObject: "ravioli"
|
||||
} )
|
||||
add( new javax.swing.tree.DefaultMutableTreeNode {
|
||||
userObject: "bananas"
|
||||
} )
|
||||
} )
|
||||
} )
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
|
||||
@@ -160,22 +160,6 @@
|
||||
"inactiveBackground": "#44475a"
|
||||
}
|
||||
},
|
||||
"ScrollBar": {
|
||||
"thumbColor": "#bd93f9",
|
||||
"hoverThumbColor": "#bd93f9",
|
||||
"Transparent": {
|
||||
"thumbColor": "#bd93f9",
|
||||
"hoverThumbColor": "#bd93f9"
|
||||
},
|
||||
"Mac": {
|
||||
"thumbColor": "#bd93f9",
|
||||
"hoverThumbColor": "#bd93f9",
|
||||
"Transparent": {
|
||||
"thumbColor": "#bd93f9",
|
||||
"hoverThumbColor": "#bd93f9"
|
||||
}
|
||||
}
|
||||
},
|
||||
"SearchEverywhere": {
|
||||
"SearchField": {
|
||||
"background": "#44475a"
|
||||
|
||||
@@ -212,7 +212,7 @@
|
||||
"ProgressBar.passedColor": "green",
|
||||
"ProgressBar.passedEndColor": "greyDot65",
|
||||
"ProgressBar.progressColor": "accent",
|
||||
"ProgressBar.trackColor": "greyDot65",
|
||||
"ProgressBar.trackColor": "greyDot75",
|
||||
"RadioButton.background": "greyDot75",
|
||||
"ScrollBar.Mac.hoverTrackColor": "greyDot75",
|
||||
"ScrollBar.Mac.trackColor": "greyDot75",
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"background": "#393f4c",
|
||||
"foreground": "#D3DAE3",
|
||||
"infoForeground": "#8b9eb5",
|
||||
"matchForeground": "#42A5F52",
|
||||
"matchForeground": "#42A5F5",
|
||||
"matchSelectionForeground": "#42A5F5",
|
||||
"nonFocusedState": "false",
|
||||
"selectedGrayedForeground": "#FFFFFF",
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"background": "#393f4c",
|
||||
"foreground": "#D3DAE3",
|
||||
"infoForeground": "#8b9eb5",
|
||||
"matchForeground": "#42A5F52",
|
||||
"matchForeground": "#42A5F5",
|
||||
"matchSelectionForeground": "#42A5F5",
|
||||
"nonFocusedState": "false",
|
||||
"selectedGrayedForeground": "#FFFFFF",
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"background": "#2F333D",
|
||||
"foreground": "#979FAD",
|
||||
"infoForeground": "#979FAD",
|
||||
"matchForeground": "#2979ff2",
|
||||
"matchForeground": "#2979ff",
|
||||
"matchSelectionForeground": "#2979ff",
|
||||
"nonFocusedState": "false",
|
||||
"selectedGrayedForeground": "#FFFFFF",
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"background": "#2F333D",
|
||||
"foreground": "#979FAD",
|
||||
"infoForeground": "#979FAD",
|
||||
"matchForeground": "#2979ff2",
|
||||
"matchForeground": "#2979ff",
|
||||
"matchSelectionForeground": "#2979ff",
|
||||
"nonFocusedState": "false",
|
||||
"selectedGrayedForeground": "#FFFFFF",
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"background": "#EAEAEB",
|
||||
"foreground": "#232324",
|
||||
"infoForeground": "#7f7f7f",
|
||||
"matchForeground": "#2979ff2",
|
||||
"matchForeground": "#2979ff",
|
||||
"matchSelectionForeground": "#2979ff",
|
||||
"nonFocusedState": "false",
|
||||
"selectedGrayedForeground": "#232324",
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"background": "#EAEAEB",
|
||||
"foreground": "#232324",
|
||||
"infoForeground": "#7f7f7f",
|
||||
"matchForeground": "#2979ff2",
|
||||
"matchForeground": "#2979ff",
|
||||
"matchSelectionForeground": "#2979ff",
|
||||
"nonFocusedState": "false",
|
||||
"selectedGrayedForeground": "#232324",
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"background": "#282A36",
|
||||
"foreground": "#F8F8F2",
|
||||
"infoForeground": "#6272A4",
|
||||
"matchForeground": "#FF79C52",
|
||||
"matchForeground": "#FF79C5",
|
||||
"matchSelectionForeground": "#FF79C5",
|
||||
"nonFocusedState": "false",
|
||||
"selectedGrayedForeground": "#8BE9FD",
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"background": "#282A36",
|
||||
"foreground": "#F8F8F2",
|
||||
"infoForeground": "#6272A4",
|
||||
"matchForeground": "#FF79C52",
|
||||
"matchForeground": "#FF79C5",
|
||||
"matchSelectionForeground": "#FF79C5",
|
||||
"nonFocusedState": "false",
|
||||
"selectedGrayedForeground": "#8BE9FD",
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"background": "#f3f3f3",
|
||||
"foreground": "#5B6168",
|
||||
"infoForeground": "#292D31",
|
||||
"matchForeground": "#79CB602",
|
||||
"matchForeground": "#79CB60",
|
||||
"matchSelectionForeground": "#79CB60",
|
||||
"nonFocusedState": "false",
|
||||
"selectedGrayedForeground": "#FFFFFF",
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"background": "#f3f3f3",
|
||||
"foreground": "#5B6168",
|
||||
"infoForeground": "#292D31",
|
||||
"matchForeground": "#79CB602",
|
||||
"matchForeground": "#79CB60",
|
||||
"matchSelectionForeground": "#79CB60",
|
||||
"nonFocusedState": "false",
|
||||
"selectedGrayedForeground": "#FFFFFF",
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"background": "#FBFBFB",
|
||||
"foreground": "#403f53",
|
||||
"infoForeground": "#90A7B2",
|
||||
"matchForeground": "#2AA2982",
|
||||
"matchForeground": "#2AA298",
|
||||
"matchSelectionForeground": "#2AA298",
|
||||
"nonFocusedState": "false",
|
||||
"selectedGrayedForeground": "#403f53",
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"background": "#FBFBFB",
|
||||
"foreground": "#403f53",
|
||||
"infoForeground": "#90A7B2",
|
||||
"matchForeground": "#2AA2982",
|
||||
"matchForeground": "#2AA298",
|
||||
"matchSelectionForeground": "#2AA298",
|
||||
"nonFocusedState": "false",
|
||||
"selectedGrayedForeground": "#403f53",
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"background": "#292929",
|
||||
"foreground": "#B0BEC5",
|
||||
"infoForeground": "#727272",
|
||||
"matchForeground": "#FF98002",
|
||||
"matchForeground": "#FF9800",
|
||||
"matchSelectionForeground": "#FF9800",
|
||||
"nonFocusedState": "false",
|
||||
"selectedGrayedForeground": "#FFFFFF",
|
||||
@@ -294,7 +294,7 @@
|
||||
"selectionBackground": "#40404050",
|
||||
"selectionForeground": "#FFFFFF",
|
||||
"selectionInactiveForeground": "#FFFFFF",
|
||||
"selectionInactiveBackground": "#3232327025"
|
||||
"selectionInactiveBackground": "#32323225"
|
||||
},
|
||||
"material": {
|
||||
"background": "#212121",
|
||||
@@ -746,10 +746,10 @@
|
||||
"hash": "#292929",
|
||||
"modifiedItemForeground": "#FF9800",
|
||||
"rowHeight": 28,
|
||||
"selectionBackground": "#3232327070",
|
||||
"selectionBackground": "#32323270",
|
||||
"selectionForeground": "#FFFFFF",
|
||||
"selectionInactiveForeground": "#FFFFFF",
|
||||
"selectionInactiveBackground": "#3232327025",
|
||||
"selectionInactiveBackground": "#32323225",
|
||||
"textBackground": "#1A1A1A"
|
||||
},
|
||||
"Tree.leftChildIndent": 10,
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"background": "#292929",
|
||||
"foreground": "#B0BEC5",
|
||||
"infoForeground": "#727272",
|
||||
"matchForeground": "#FF98002",
|
||||
"matchForeground": "#FF9800",
|
||||
"matchSelectionForeground": "#FF9800",
|
||||
"nonFocusedState": "false",
|
||||
"selectedGrayedForeground": "#FFFFFF",
|
||||
@@ -294,7 +294,7 @@
|
||||
"selectionBackground": "#40404050",
|
||||
"selectionForeground": "#FFFFFF",
|
||||
"selectionInactiveForeground": "#FFFFFF",
|
||||
"selectionInactiveBackground": "#3232327025"
|
||||
"selectionInactiveBackground": "#32323225"
|
||||
},
|
||||
"material": {
|
||||
"background": "#212121",
|
||||
@@ -746,10 +746,10 @@
|
||||
"hash": "#292929",
|
||||
"modifiedItemForeground": "#FF9800",
|
||||
"rowHeight": 28,
|
||||
"selectionBackground": "#3232327070",
|
||||
"selectionBackground": "#32323270",
|
||||
"selectionForeground": "#FFFFFF",
|
||||
"selectionInactiveForeground": "#FFFFFF",
|
||||
"selectionInactiveBackground": "#3232327025",
|
||||
"selectionInactiveBackground": "#32323225",
|
||||
"textBackground": "#212121"
|
||||
},
|
||||
"Tree.leftChildIndent": 10,
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"background": "#181A1F",
|
||||
"foreground": "#8F93A2",
|
||||
"infoForeground": "#4B526D",
|
||||
"matchForeground": "#84ffff2",
|
||||
"matchForeground": "#84ffff",
|
||||
"matchSelectionForeground": "#84ffff",
|
||||
"nonFocusedState": "false",
|
||||
"selectedGrayedForeground": "#FFFFFF",
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"background": "#181A1F",
|
||||
"foreground": "#8F93A2",
|
||||
"infoForeground": "#4B526D",
|
||||
"matchForeground": "#84ffff2",
|
||||
"matchForeground": "#84ffff",
|
||||
"matchSelectionForeground": "#84ffff",
|
||||
"nonFocusedState": "false",
|
||||
"selectedGrayedForeground": "#FFFFFF",
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"background": "#FFFFFF",
|
||||
"foreground": "#546E7A",
|
||||
"infoForeground": "#94A7B0",
|
||||
"matchForeground": "#00BCD42",
|
||||
"matchForeground": "#00BCD4",
|
||||
"matchSelectionForeground": "#00BCD4",
|
||||
"nonFocusedState": "false",
|
||||
"selectedGrayedForeground": "#546e7a",
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"background": "#FFFFFF",
|
||||
"foreground": "#546E7A",
|
||||
"infoForeground": "#94A7B0",
|
||||
"matchForeground": "#00BCD42",
|
||||
"matchForeground": "#00BCD4",
|
||||
"matchSelectionForeground": "#00BCD4",
|
||||
"nonFocusedState": "false",
|
||||
"selectedGrayedForeground": "#546e7a",
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"background": "#32424A",
|
||||
"foreground": "#B0BEC5",
|
||||
"infoForeground": "#607D8B",
|
||||
"matchForeground": "#0096882",
|
||||
"matchForeground": "#009688",
|
||||
"matchSelectionForeground": "#009688",
|
||||
"nonFocusedState": "false",
|
||||
"selectedGrayedForeground": "#FFFFFF",
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"background": "#32424A",
|
||||
"foreground": "#B0BEC5",
|
||||
"infoForeground": "#607D8B",
|
||||
"matchForeground": "#0096882",
|
||||
"matchForeground": "#009688",
|
||||
"matchSelectionForeground": "#009688",
|
||||
"nonFocusedState": "false",
|
||||
"selectedGrayedForeground": "#FFFFFF",
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"background": "#34324a",
|
||||
"foreground": "#A6ACCD",
|
||||
"infoForeground": "#676E95",
|
||||
"matchForeground": "#ab47bc2",
|
||||
"matchForeground": "#ab47bc",
|
||||
"matchSelectionForeground": "#ab47bc",
|
||||
"nonFocusedState": "false",
|
||||
"selectedGrayedForeground": "#FFFFFF",
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"background": "#34324a",
|
||||
"foreground": "#A6ACCD",
|
||||
"infoForeground": "#676E95",
|
||||
"matchForeground": "#ab47bc2",
|
||||
"matchForeground": "#ab47bc",
|
||||
"matchSelectionForeground": "#ab47bc",
|
||||
"nonFocusedState": "false",
|
||||
"selectedGrayedForeground": "#FFFFFF",
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"background": "#403E41",
|
||||
"foreground": "#fcfcfa",
|
||||
"infoForeground": "#939293",
|
||||
"matchForeground": "#ffd8662",
|
||||
"matchForeground": "#ffd866",
|
||||
"matchSelectionForeground": "#ffd866",
|
||||
"nonFocusedState": "false",
|
||||
"selectedGrayedForeground": "#FFFFFF",
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"background": "#403E41",
|
||||
"foreground": "#fcfcfa",
|
||||
"infoForeground": "#939293",
|
||||
"matchForeground": "#ffd8662",
|
||||
"matchForeground": "#ffd866",
|
||||
"matchSelectionForeground": "#ffd866",
|
||||
"nonFocusedState": "false",
|
||||
"selectedGrayedForeground": "#FFFFFF",
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"background": "#0b2942",
|
||||
"foreground": "#d6deeb",
|
||||
"infoForeground": "#5f7e97",
|
||||
"matchForeground": "#7e57c22",
|
||||
"matchForeground": "#7e57c2",
|
||||
"matchSelectionForeground": "#7e57c2",
|
||||
"nonFocusedState": "false",
|
||||
"selectedGrayedForeground": "#ffffff",
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"background": "#0b2942",
|
||||
"foreground": "#d6deeb",
|
||||
"infoForeground": "#5f7e97",
|
||||
"matchForeground": "#7e57c22",
|
||||
"matchForeground": "#7e57c2",
|
||||
"matchSelectionForeground": "#7e57c2",
|
||||
"nonFocusedState": "false",
|
||||
"selectedGrayedForeground": "#ffffff",
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"background": "#003745",
|
||||
"foreground": "#839496",
|
||||
"infoForeground": "#586e75",
|
||||
"matchForeground": "#d336822",
|
||||
"matchForeground": "#d33682",
|
||||
"matchSelectionForeground": "#d33682",
|
||||
"nonFocusedState": "false",
|
||||
"selectedGrayedForeground": "#FFFFFF",
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"background": "#003745",
|
||||
"foreground": "#839496",
|
||||
"infoForeground": "#586e75",
|
||||
"matchForeground": "#d336822",
|
||||
"matchForeground": "#d33682",
|
||||
"matchSelectionForeground": "#d33682",
|
||||
"nonFocusedState": "false",
|
||||
"selectedGrayedForeground": "#FFFFFF",
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"background": "#F6F0DE",
|
||||
"foreground": "#586e75",
|
||||
"infoForeground": "#93a1a1",
|
||||
"matchForeground": "#d336822",
|
||||
"matchForeground": "#d33682",
|
||||
"matchSelectionForeground": "#d33682",
|
||||
"nonFocusedState": "false",
|
||||
"selectedGrayedForeground": "#002b36",
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"background": "#F6F0DE",
|
||||
"foreground": "#586e75",
|
||||
"infoForeground": "#93a1a1",
|
||||
"matchForeground": "#d336822",
|
||||
"matchForeground": "#d33682",
|
||||
"matchSelectionForeground": "#d33682",
|
||||
"nonFocusedState": "false",
|
||||
"selectedGrayedForeground": "#002b36",
|
||||
|
||||
@@ -26,7 +26,7 @@ build script:
|
||||
|
||||
groupId: com.formdev
|
||||
artifactId: flatlaf-jide-oss
|
||||
version: 0.23
|
||||
version: 0.24
|
||||
|
||||
Otherwise download `flatlaf-jide-oss-<version>.jar` here:
|
||||
|
||||
|
||||
@@ -46,6 +46,11 @@ public class FlatJideOssDefaultsAddon
|
||||
return super.getDefaults( lafClass );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPriority() {
|
||||
return 11;
|
||||
}
|
||||
|
||||
//---- class FlatJideUIDefaultsCustomizer ---------------------------------
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,7 +33,7 @@ build script:
|
||||
|
||||
groupId: com.formdev
|
||||
artifactId: flatlaf-swingx
|
||||
version: 0.23
|
||||
version: 0.24
|
||||
|
||||
Otherwise download `flatlaf-swingx-<version>.jar` here:
|
||||
|
||||
|
||||
@@ -29,4 +29,8 @@ import com.formdev.flatlaf.FlatDefaultsAddon;
|
||||
public class FlatSwingXDefaultsAddon
|
||||
extends FlatDefaultsAddon
|
||||
{
|
||||
@Override
|
||||
public int getPriority() {
|
||||
return 10;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.awt.datatransfer.StringSelection;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.*;
|
||||
import com.formdev.flatlaf.icons.FlatMenuArrowIcon;
|
||||
import net.miginfocom.swing.*;
|
||||
|
||||
/**
|
||||
@@ -70,6 +71,18 @@ public class FlatComponents2Test
|
||||
}
|
||||
}
|
||||
|
||||
private void tableHeaderButtonChanged() {
|
||||
boolean show = tableHeaderButtonCheckBox.isSelected();
|
||||
JButton button = null;
|
||||
if( show ) {
|
||||
button = new JButton( new FlatMenuArrowIcon() );
|
||||
button.addActionListener( e -> {
|
||||
JOptionPane.showMessageDialog( this, "hello" );
|
||||
} );
|
||||
}
|
||||
scrollPane5.setCorner( JScrollPane.UPPER_TRAILING_CORNER, button );
|
||||
}
|
||||
|
||||
@SuppressWarnings( { "unchecked", "rawtypes" } )
|
||||
private void initComponents() {
|
||||
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
|
||||
@@ -87,9 +100,10 @@ public class FlatComponents2Test
|
||||
JScrollPane scrollPane4 = new JScrollPane();
|
||||
tree2 = new JTree();
|
||||
JLabel tableLabel = new JLabel();
|
||||
JScrollPane scrollPane5 = new JScrollPane();
|
||||
scrollPane5 = new JScrollPane();
|
||||
table1 = new JTable();
|
||||
dndCheckBox = new JCheckBox();
|
||||
tableHeaderButtonCheckBox = new JCheckBox();
|
||||
|
||||
//======== this ========
|
||||
setLayout(new MigLayout(
|
||||
@@ -102,7 +116,7 @@ public class FlatComponents2Test
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[::200]" +
|
||||
"[::150]" +
|
||||
"[150,grow]" +
|
||||
"[]"));
|
||||
|
||||
//---- textFieldLabel ----
|
||||
@@ -293,6 +307,11 @@ public class FlatComponents2Test
|
||||
dndCheckBox.setMnemonic('D');
|
||||
dndCheckBox.addActionListener(e -> dndChanged());
|
||||
add(dndCheckBox, "cell 0 4 3 1");
|
||||
|
||||
//---- tableHeaderButtonCheckBox ----
|
||||
tableHeaderButtonCheckBox.setText("show button in table header");
|
||||
tableHeaderButtonCheckBox.addActionListener(e -> tableHeaderButtonChanged());
|
||||
add(tableHeaderButtonCheckBox, "cell 0 4 3 1");
|
||||
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
||||
|
||||
((JComboBox)((DefaultCellEditor)table1.getColumnModel().getColumn( 3 ).getCellEditor()).getComponent()).setEditable( true );
|
||||
@@ -303,8 +322,10 @@ public class FlatComponents2Test
|
||||
private JList<String> list2;
|
||||
private JTree tree1;
|
||||
private JTree tree2;
|
||||
private JScrollPane scrollPane5;
|
||||
private JTable table1;
|
||||
private JCheckBox dndCheckBox;
|
||||
private JCheckBox tableHeaderButtonCheckBox;
|
||||
// JFormDesigner - End of variables declaration //GEN-END:variables
|
||||
|
||||
//---- class DummyTransferHandler -----------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
JFDML JFormDesigner: "7.0.0.0.194" Java: "11.0.2" encoding: "UTF-8"
|
||||
JFDML JFormDesigner: "7.0.0.0.194" Java: "13.0.1" encoding: "UTF-8"
|
||||
|
||||
new FormModel {
|
||||
contentType: "form/swing"
|
||||
@@ -9,7 +9,7 @@ new FormModel {
|
||||
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "ltr,insets dialog,hidemode 3"
|
||||
"$columnConstraints": "[][200][200]"
|
||||
"$rowConstraints": "[][][::200][::150][]"
|
||||
"$rowConstraints": "[][][::200][150,grow][]"
|
||||
} ) {
|
||||
name: "this"
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
@@ -135,6 +135,9 @@ new FormModel {
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
|
||||
name: "scrollPane5"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
add( new FormComponent( "javax.swing.JTable" ) {
|
||||
name: "table1"
|
||||
"model": new com.jformdesigner.model.SwingTableModel( new java.util.Vector {
|
||||
@@ -282,6 +285,16 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 4 3 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "tableHeaderButtonCheckBox"
|
||||
"text": "show button in table header"
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tableHeaderButtonChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 4 3 1"
|
||||
} )
|
||||
}, new FormLayoutConstraints( null ) {
|
||||
"location": new java.awt.Point( 0, 0 )
|
||||
"size": new java.awt.Dimension( 790, 715 )
|
||||
|
||||
@@ -61,7 +61,9 @@ public class FlatComponentsTest
|
||||
JLabel label2 = new JLabel();
|
||||
JLabel buttonLabel = new JLabel();
|
||||
JButton button1 = new JButton();
|
||||
JButton button17 = new JButton();
|
||||
JButton button2 = new JButton();
|
||||
JButton button18 = new JButton();
|
||||
FlatComponentsTest.TestDefaultButton button5 = new FlatComponentsTest.TestDefaultButton();
|
||||
JButton button3 = new JButton();
|
||||
JButton button12 = new JButton();
|
||||
@@ -71,9 +73,13 @@ public class FlatComponentsTest
|
||||
JButton button16 = new JButton();
|
||||
JLabel toggleButtonLabel = new JLabel();
|
||||
JToggleButton toggleButton1 = new JToggleButton();
|
||||
JToggleButton toggleButton9 = new JToggleButton();
|
||||
JToggleButton toggleButton2 = new JToggleButton();
|
||||
JToggleButton toggleButton10 = new JToggleButton();
|
||||
JToggleButton toggleButton3 = new JToggleButton();
|
||||
JToggleButton toggleButton4 = new JToggleButton();
|
||||
JToggleButton toggleButton5 = new JToggleButton();
|
||||
JToggleButton toggleButton8 = new JToggleButton();
|
||||
JLabel checkBoxLabel = new JLabel();
|
||||
JCheckBox checkBox1 = new JCheckBox();
|
||||
JCheckBox checkBox2 = new JCheckBox();
|
||||
@@ -162,14 +168,7 @@ public class FlatComponentsTest
|
||||
JToggleButton toggleButton7 = new JToggleButton();
|
||||
JLabel scrollBarLabel = new JLabel();
|
||||
JScrollBar scrollBar1 = new JScrollBar();
|
||||
JLabel label4 = new JLabel();
|
||||
JScrollBar scrollBar4 = new JScrollBar();
|
||||
JPanel panel3 = new JPanel();
|
||||
JLabel label3 = new JLabel();
|
||||
JScrollPane scrollPane15 = new JScrollPane();
|
||||
JEditorPane editorPane6 = new JEditorPane();
|
||||
JScrollPane scrollPane16 = new JScrollPane();
|
||||
JTextPane textPane6 = new JTextPane();
|
||||
JScrollBar scrollBar5 = new JScrollBar();
|
||||
JScrollBar scrollBar6 = new JScrollBar();
|
||||
JLabel separatorLabel = new JLabel();
|
||||
@@ -256,6 +255,12 @@ public class FlatComponentsTest
|
||||
button1.setToolTipText("This button is enabled.");
|
||||
add(button1, "cell 1 1");
|
||||
|
||||
//---- button17 ----
|
||||
button17.setText("square");
|
||||
button17.putClientProperty("JButton.buttonType", "square");
|
||||
button17.putClientProperty("JComponent.minimumWidth", 0);
|
||||
add(button17, "cell 1 1");
|
||||
|
||||
//---- button2 ----
|
||||
button2.setText("disabled");
|
||||
button2.setDisplayedMnemonicIndex(0);
|
||||
@@ -263,6 +268,13 @@ public class FlatComponentsTest
|
||||
button2.setToolTipText("This button is disabled.");
|
||||
add(button2, "cell 2 1");
|
||||
|
||||
//---- button18 ----
|
||||
button18.setText("square");
|
||||
button18.putClientProperty("JButton.buttonType", "square");
|
||||
button18.setEnabled(false);
|
||||
button18.putClientProperty("JComponent.minimumWidth", 0);
|
||||
add(button18, "cell 2 1");
|
||||
|
||||
//---- button5 ----
|
||||
button5.setText("default");
|
||||
button5.setDisplayedMnemonicIndex(0);
|
||||
@@ -304,11 +316,22 @@ public class FlatComponentsTest
|
||||
toggleButton1.setText("enabled");
|
||||
add(toggleButton1, "cell 1 2");
|
||||
|
||||
//---- toggleButton9 ----
|
||||
toggleButton9.setText("square");
|
||||
toggleButton9.putClientProperty("JButton.buttonType", "square");
|
||||
add(toggleButton9, "cell 1 2");
|
||||
|
||||
//---- toggleButton2 ----
|
||||
toggleButton2.setText("disabled");
|
||||
toggleButton2.setEnabled(false);
|
||||
add(toggleButton2, "cell 2 2");
|
||||
|
||||
//---- toggleButton10 ----
|
||||
toggleButton10.setText("square");
|
||||
toggleButton10.putClientProperty("JButton.buttonType", "square");
|
||||
toggleButton10.setEnabled(false);
|
||||
add(toggleButton10, "cell 2 2");
|
||||
|
||||
//---- toggleButton3 ----
|
||||
toggleButton3.setText("selected");
|
||||
toggleButton3.setSelected(true);
|
||||
@@ -320,6 +343,19 @@ public class FlatComponentsTest
|
||||
toggleButton4.setSelected(true);
|
||||
add(toggleButton4, "cell 4 2");
|
||||
|
||||
//---- toggleButton5 ----
|
||||
toggleButton5.setText("underline");
|
||||
toggleButton5.putClientProperty("JButton.buttonType", "underline");
|
||||
toggleButton5.setSelected(true);
|
||||
add(toggleButton5, "cell 5 2");
|
||||
|
||||
//---- toggleButton8 ----
|
||||
toggleButton8.setText("underline");
|
||||
toggleButton8.putClientProperty("JButton.buttonType", "underline");
|
||||
toggleButton8.setEnabled(false);
|
||||
toggleButton8.setSelected(true);
|
||||
add(toggleButton8, "cell 5 2");
|
||||
|
||||
//---- checkBoxLabel ----
|
||||
checkBoxLabel.setText("JCheckBox");
|
||||
add(checkBoxLabel, "cell 0 3");
|
||||
@@ -806,53 +842,11 @@ public class FlatComponentsTest
|
||||
scrollBar1.setOrientation(Adjustable.HORIZONTAL);
|
||||
add(scrollBar1, "cell 1 14,growx");
|
||||
|
||||
//---- label4 ----
|
||||
label4.setText("HTML:");
|
||||
add(label4, "cell 5 14");
|
||||
|
||||
//---- scrollBar4 ----
|
||||
scrollBar4.setOrientation(Adjustable.HORIZONTAL);
|
||||
scrollBar4.setEnabled(false);
|
||||
add(scrollBar4, "cell 1 15,growx");
|
||||
|
||||
//======== panel3 ========
|
||||
{
|
||||
panel3.setOpaque(false);
|
||||
panel3.setLayout(new MigLayout(
|
||||
"ltr,insets 0,hidemode 3",
|
||||
// columns
|
||||
"[]",
|
||||
// rows
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]"));
|
||||
|
||||
//---- label3 ----
|
||||
label3.setText("<html>JLabel HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a></html>");
|
||||
panel3.add(label3, "cell 0 0");
|
||||
|
||||
//======== scrollPane15 ========
|
||||
{
|
||||
|
||||
//---- editorPane6 ----
|
||||
editorPane6.setContentType("text/html");
|
||||
editorPane6.setText("JEditorPane HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a>");
|
||||
scrollPane15.setViewportView(editorPane6);
|
||||
}
|
||||
panel3.add(scrollPane15, "cell 0 1,grow");
|
||||
|
||||
//======== scrollPane16 ========
|
||||
{
|
||||
|
||||
//---- textPane6 ----
|
||||
textPane6.setContentType("text/html");
|
||||
textPane6.setText("JTextPane HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a>");
|
||||
scrollPane16.setViewportView(textPane6);
|
||||
}
|
||||
panel3.add(scrollPane16, "cell 0 2,grow");
|
||||
}
|
||||
add(panel3, "cell 5 15 1 9,aligny top,grow 100 0");
|
||||
|
||||
//---- scrollBar5 ----
|
||||
scrollBar5.setOrientation(Adjustable.HORIZONTAL);
|
||||
scrollBar5.putClientProperty("JScrollBar.showButtons", true);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
JFDML JFormDesigner: "7.0.0.0.194" Java: "11.0.2" encoding: "UTF-8"
|
||||
JFDML JFormDesigner: "7.0.0.0.194" Java: "13.0.1" encoding: "UTF-8"
|
||||
|
||||
new FormModel {
|
||||
contentType: "form/swing"
|
||||
@@ -47,6 +47,14 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
name: "button17"
|
||||
"text": "square"
|
||||
"$client.JButton.buttonType": "square"
|
||||
"$client.JComponent.minimumWidth": 0
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
name: "button2"
|
||||
"text": "disabled"
|
||||
@@ -56,6 +64,15 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
name: "button18"
|
||||
"text": "square"
|
||||
"$client.JButton.buttonType": "square"
|
||||
"enabled": false
|
||||
"$client.JComponent.minimumWidth": 0
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 1"
|
||||
} )
|
||||
add( new FormComponent( "com.formdev.flatlaf.testing.FlatComponentsTest$TestDefaultButton" ) {
|
||||
name: "button5"
|
||||
"text": "default"
|
||||
@@ -115,6 +132,13 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||
name: "toggleButton9"
|
||||
"text": "square"
|
||||
"$client.JButton.buttonType": "square"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||
name: "toggleButton2"
|
||||
"text": "disabled"
|
||||
@@ -122,6 +146,14 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||
name: "toggleButton10"
|
||||
"text": "square"
|
||||
"$client.JButton.buttonType": "square"
|
||||
"enabled": false
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||
name: "toggleButton3"
|
||||
"text": "selected"
|
||||
@@ -137,6 +169,23 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 4 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||
name: "toggleButton5"
|
||||
"text": "underline"
|
||||
"$client.JButton.buttonType": "underline"
|
||||
"selected": true
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 5 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
||||
name: "toggleButton8"
|
||||
"text": "underline"
|
||||
"$client.JButton.buttonType": "underline"
|
||||
"enabled": false
|
||||
"selected": true
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 5 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "checkBoxLabel"
|
||||
"text": "JCheckBox"
|
||||
@@ -756,12 +805,6 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 14,growx"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label4"
|
||||
"text": "HTML:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 5 14"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JScrollBar" ) {
|
||||
name: "scrollBar4"
|
||||
"orientation": 0
|
||||
@@ -769,42 +812,6 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 15,growx"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$columnConstraints": "[]"
|
||||
"$rowConstraints": "[][][]"
|
||||
"$layoutConstraints": "ltr,insets 0,hidemode 3"
|
||||
} ) {
|
||||
name: "panel3"
|
||||
"opaque": false
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label3"
|
||||
"text": "<html>JLabel HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a></html>"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
|
||||
name: "scrollPane15"
|
||||
add( new FormComponent( "javax.swing.JEditorPane" ) {
|
||||
name: "editorPane6"
|
||||
"contentType": "text/html"
|
||||
"text": "JEditorPane HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a>"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 1,grow"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
|
||||
name: "scrollPane16"
|
||||
add( new FormComponent( "javax.swing.JTextPane" ) {
|
||||
name: "textPane6"
|
||||
"contentType": "text/html"
|
||||
"text": "JTextPane HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a>"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 2,grow"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 5 15 1 9,aligny top,grow 100 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JScrollBar" ) {
|
||||
name: "scrollBar5"
|
||||
"orientation": 0
|
||||
@@ -977,7 +984,7 @@ new FormModel {
|
||||
} )
|
||||
}, new FormLayoutConstraints( null ) {
|
||||
"location": new java.awt.Point( 0, 0 )
|
||||
"size": new java.awt.Dimension( 865, 750 )
|
||||
"size": new java.awt.Dimension( 1005, 800 )
|
||||
} )
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,186 @@
|
||||
/*
|
||||
* Copyright 2020 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.testing;
|
||||
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
import com.formdev.flatlaf.util.UIScale;
|
||||
import net.miginfocom.swing.*;
|
||||
|
||||
/**
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
public class FlatHtmlTest
|
||||
extends FlatTestPanel
|
||||
{
|
||||
public static void main( String[] args ) {
|
||||
SwingUtilities.invokeLater( () -> {
|
||||
FlatTestFrame frame = FlatTestFrame.create( args, "FlatHtmlTest" );
|
||||
frame.showFrame( FlatHtmlTest::new );
|
||||
} );
|
||||
}
|
||||
|
||||
FlatHtmlTest() {
|
||||
initComponents();
|
||||
increaseFontSize();
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
|
||||
labelLabel = new JLabel();
|
||||
editorPaneLabel = new JLabel();
|
||||
textPaneLabel = new JLabel();
|
||||
toolTipLabel = new JLabel();
|
||||
label1 = new JLabel();
|
||||
scrollPane15 = new JScrollPane();
|
||||
editorPane1 = new JEditorPane();
|
||||
scrollPane16 = new JScrollPane();
|
||||
textPane1 = new JTextPane();
|
||||
toolTip1 = new JToolTip();
|
||||
label2 = new JLabel();
|
||||
scrollPane17 = new JScrollPane();
|
||||
editorPane2 = new JEditorPane();
|
||||
scrollPane18 = new JScrollPane();
|
||||
textPane2 = new JTextPane();
|
||||
toolTip2 = new JToolTip();
|
||||
|
||||
//======== this ========
|
||||
setLayout(new MigLayout(
|
||||
"ltr,insets dialog,hidemode 3",
|
||||
// columns
|
||||
"[fill]" +
|
||||
"[fill]" +
|
||||
"[fill]" +
|
||||
"[fill]",
|
||||
// rows
|
||||
"[]" +
|
||||
"[top]" +
|
||||
"[top]"));
|
||||
|
||||
//---- labelLabel ----
|
||||
labelLabel.setText("JLabel:");
|
||||
add(labelLabel, "cell 0 0");
|
||||
|
||||
//---- editorPaneLabel ----
|
||||
editorPaneLabel.setText("JEditorPane:");
|
||||
add(editorPaneLabel, "cell 1 0");
|
||||
|
||||
//---- textPaneLabel ----
|
||||
textPaneLabel.setText("JTextPane:");
|
||||
add(textPaneLabel, "cell 2 0");
|
||||
|
||||
//---- toolTipLabel ----
|
||||
toolTipLabel.setText("JToolTip:");
|
||||
add(toolTipLabel, "cell 3 0");
|
||||
|
||||
//---- label1 ----
|
||||
label1.setText("<html>HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p></html>");
|
||||
add(label1, "cell 0 1");
|
||||
|
||||
//======== scrollPane15 ========
|
||||
{
|
||||
|
||||
//---- editorPane1 ----
|
||||
editorPane1.setContentType("text/html");
|
||||
editorPane1.setText("HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p>");
|
||||
scrollPane15.setViewportView(editorPane1);
|
||||
}
|
||||
add(scrollPane15, "cell 1 1,grow");
|
||||
|
||||
//======== scrollPane16 ========
|
||||
{
|
||||
|
||||
//---- textPane1 ----
|
||||
textPane1.setContentType("text/html");
|
||||
textPane1.setText("HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p>");
|
||||
scrollPane16.setViewportView(textPane1);
|
||||
}
|
||||
add(scrollPane16, "cell 2 1");
|
||||
|
||||
//---- toolTip1 ----
|
||||
toolTip1.setTipText("<html>HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p></html>");
|
||||
add(toolTip1, "cell 3 1");
|
||||
|
||||
//---- label2 ----
|
||||
label2.setText("<html>HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p></html>");
|
||||
add(label2, "cell 0 2");
|
||||
|
||||
//======== scrollPane17 ========
|
||||
{
|
||||
|
||||
//---- editorPane2 ----
|
||||
editorPane2.setContentType("text/html");
|
||||
editorPane2.setText("HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p>");
|
||||
scrollPane17.setViewportView(editorPane2);
|
||||
}
|
||||
add(scrollPane17, "cell 1 2,grow");
|
||||
|
||||
//======== scrollPane18 ========
|
||||
{
|
||||
|
||||
//---- textPane2 ----
|
||||
textPane2.setContentType("text/html");
|
||||
textPane2.setText("HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p>");
|
||||
scrollPane18.setViewportView(textPane2);
|
||||
}
|
||||
add(scrollPane18, "cell 2 2");
|
||||
|
||||
//---- toolTip2 ----
|
||||
toolTip2.setTipText("<html>HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p></html>");
|
||||
add(toolTip2, "cell 3 2");
|
||||
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUI() {
|
||||
super.updateUI();
|
||||
|
||||
EventQueue.invokeLater( () -> {
|
||||
increaseFontSize();
|
||||
} );
|
||||
}
|
||||
|
||||
private void increaseFontSize() {
|
||||
increaseFontSize( label2, label1.getFont() );
|
||||
increaseFontSize( editorPane2, editorPane1.getFont() );
|
||||
increaseFontSize( textPane2, textPane1.getFont() );
|
||||
increaseFontSize( toolTip2, toolTip1.getFont() );
|
||||
}
|
||||
|
||||
private void increaseFontSize( JComponent c, Font baseFont ) {
|
||||
c.setFont( baseFont.deriveFont( Font.PLAIN, baseFont.getSize() + UIScale.scale( 10f ) ) );
|
||||
}
|
||||
|
||||
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
|
||||
private JLabel labelLabel;
|
||||
private JLabel editorPaneLabel;
|
||||
private JLabel textPaneLabel;
|
||||
private JLabel toolTipLabel;
|
||||
private JLabel label1;
|
||||
private JScrollPane scrollPane15;
|
||||
private JEditorPane editorPane1;
|
||||
private JScrollPane scrollPane16;
|
||||
private JTextPane textPane1;
|
||||
private JToolTip toolTip1;
|
||||
private JLabel label2;
|
||||
private JScrollPane scrollPane17;
|
||||
private JEditorPane editorPane2;
|
||||
private JScrollPane scrollPane18;
|
||||
private JTextPane textPane2;
|
||||
private JToolTip toolTip2;
|
||||
// JFormDesigner - End of variables declaration //GEN-END:variables
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
JFDML JFormDesigner: "7.0.0.0.194" Java: "13.0.1" encoding: "UTF-8"
|
||||
|
||||
new FormModel {
|
||||
contentType: "form/swing"
|
||||
root: new FormRoot {
|
||||
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "ltr,insets dialog,hidemode 3"
|
||||
"$columnConstraints": "[fill][fill][fill][fill]"
|
||||
"$rowConstraints": "[][top][top]"
|
||||
} ) {
|
||||
name: "this"
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "labelLabel"
|
||||
"text": "JLabel:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "editorPaneLabel"
|
||||
"text": "JEditorPane:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "textPaneLabel"
|
||||
"text": "JTextPane:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "toolTipLabel"
|
||||
"text": "JToolTip:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 3 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label1"
|
||||
"text": "<html>HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p></html>"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 1"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
|
||||
name: "scrollPane15"
|
||||
add( new FormComponent( "javax.swing.JEditorPane" ) {
|
||||
name: "editorPane1"
|
||||
"contentType": "text/html"
|
||||
"text": "HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p>"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 1,grow"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
|
||||
name: "scrollPane16"
|
||||
add( new FormComponent( "javax.swing.JTextPane" ) {
|
||||
name: "textPane1"
|
||||
"contentType": "text/html"
|
||||
"text": "HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p>"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JToolTip" ) {
|
||||
name: "toolTip1"
|
||||
"tipText": "<html>HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p></html>"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 3 1"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "label2"
|
||||
"text": "<html>HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p></html>"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 2"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
|
||||
name: "scrollPane17"
|
||||
add( new FormComponent( "javax.swing.JEditorPane" ) {
|
||||
name: "editorPane2"
|
||||
"contentType": "text/html"
|
||||
"text": "HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p>"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 2,grow"
|
||||
} )
|
||||
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
|
||||
name: "scrollPane18"
|
||||
add( new FormComponent( "javax.swing.JTextPane" ) {
|
||||
name: "textPane2"
|
||||
"contentType": "text/html"
|
||||
"text": "HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p>"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JToolTip" ) {
|
||||
name: "toolTip2"
|
||||
"tipText": "<html>HTML<br>Sample <b>content</b><br> <u>text</u> with <a href=\"#\">link</a><h1>Header 1</h1><h2>Header 2</h2><h3>Header 3</h3><h4>Header 4</h4><h5>Header 5</h5><h6>Header 6</h6><p>Paragraph</p></html>"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 3 2"
|
||||
} )
|
||||
}, new FormLayoutConstraints( null ) {
|
||||
"location": new java.awt.Point( 0, 0 )
|
||||
"size": new java.awt.Dimension( 695, 755 )
|
||||
} )
|
||||
}
|
||||
}
|
||||
@@ -245,12 +245,8 @@ public class FlatInspector
|
||||
}
|
||||
|
||||
private String buildToolTipText( Component c ) {
|
||||
String name = c.getClass().getSimpleName();
|
||||
if( name.isEmpty() ) {
|
||||
// anonymous class
|
||||
name = c.getClass().getName();
|
||||
name = name.substring( name.lastIndexOf( '.' ) + 1 );
|
||||
}
|
||||
String name = c.getClass().getName();
|
||||
name = name.substring( name.lastIndexOf( '.' ) + 1 );
|
||||
|
||||
String text =
|
||||
"Class: " + name + " (" + c.getClass().getPackage().getName() + ")\n" +
|
||||
|
||||
Reference in New Issue
Block a user