Browse Source

Renamed table border.

Fixed frame too large if maximized on Windows.
Use parent component background if disabled (ComboBox, Spinner, TextComponent).
pull/139/head
weisj 5 years ago
parent
commit
bd8f2ccb12
  1. 61
      core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboBoxBorder.java
  2. 84
      core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboBoxUI.java
  3. 27
      core/src/main/java/com/github/weisj/darklaf/ui/label/DarkLabelUI.java
  4. 24
      core/src/main/java/com/github/weisj/darklaf/ui/spinner/DarkSpinnerUI.java
  5. 13
      core/src/main/java/com/github/weisj/darklaf/ui/table/DarkTableHeaderBorder.java
  6. 11
      core/src/main/java/com/github/weisj/darklaf/ui/table/DarkTableHeaderUI.java
  7. 12
      core/src/main/java/com/github/weisj/darklaf/ui/table/DarkTableScrollPaneBorder.java
  8. 49
      core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextUI.java
  9. 3
      core/src/main/resources/com/github/weisj/darklaf/properties/ui/table.properties
  10. 16
      core/src/test/java/ui/table/TableDemo.java
  11. 21
      windows/src/main/cpp/Decorations.cpp

61
core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboBoxBorder.java

@ -23,17 +23,16 @@
*/
package com.github.weisj.darklaf.ui.combobox;
import com.github.weisj.darklaf.ui.cell.CellUtil;
import com.github.weisj.darklaf.util.DarkUIUtil;
import com.github.weisj.darklaf.util.GraphicsContext;
import java.awt.*;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.plaf.InsetsUIResource;
import javax.swing.plaf.UIResource;
import java.awt.*;
import java.awt.geom.Area;
import java.awt.geom.RoundRectangle2D;
import com.github.weisj.darklaf.ui.cell.CellUtil;
import com.github.weisj.darklaf.util.DarkUIUtil;
import com.github.weisj.darklaf.util.GraphicsContext;
public class DarkComboBoxBorder implements Border, UIResource {
@ -43,9 +42,6 @@ public class DarkComboBoxBorder implements Border, UIResource {
protected final int borderSize;
protected final int arcSize;
protected final Color focusBorderColor;
protected final Color inactiveBackground;
protected final Color arrowBackground;
protected final Color background;
protected final Color borderColor;
protected final Color inactiveBorderColor;
@ -54,12 +50,9 @@ public class DarkComboBoxBorder implements Border, UIResource {
arcSize = UIManager.getInt("ComboBox.arc");
boxPadding = UIManager.getInsets("ComboBox.insets");
borderSize = UIManager.getInt("ComboBox.borderThickness");
background = UIManager.getColor("ComboBox.activeBackground");
inactiveBackground = UIManager.getColor("ComboBox.inactiveBackground");
focusBorderColor = UIManager.getColor("ComboBox.focusBorderColor");
borderColor = UIManager.getColor("ComboBox.activeBorderColor");
inactiveBorderColor = UIManager.getColor("ComboBox.inactiveBorderColor");
arrowBackground = UIManager.getColor("ComboBox.arrowBackground");
cellPadding = UIManager.getInsets("ComboBox.cellEditorInsets");
if (boxPadding == null) boxPadding = new Insets(0, 0, 0, 0);
if (cellPadding == null) cellPadding = new Insets(0, 0, 0, 0);
@ -86,11 +79,6 @@ public class DarkComboBoxBorder implements Border, UIResource {
Color borderColor = getBorderColor(c);
if (comboBox.isEditable()) {
paintArrowBackground(width, height, comboBox, arrowButton, isCellEditor,
bSize, arcSize, g, borderColor);
}
if (!isCellEditor) {
if (ui.getHasFocus()) {
DarkUIUtil.paintFocusBorder(g, width, height, arcSize, borderSize);
@ -104,37 +92,18 @@ public class DarkComboBoxBorder implements Border, UIResource {
paintCellBorder(c, width, height, isTableCellEditor, g, borderColor);
}
g.translate(-x, -y);
config.restore();
}
public void paintArrowBackground(final int width, final int height, final JComboBox<?> comboBox,
final AbstractButton arrowButton, final boolean isCellEditor,
final int bSize, final int arc,
final Graphics2D g, final Color borderColor) {
if (comboBox.isEditable()) {
Rectangle arrowBounds = arrowButton.getBounds();
boolean leftToRight = comboBox.getComponentOrientation().isLeftToRight();
int off = leftToRight ? arrowBounds.x : arrowBounds.x + arrowBounds.width;
Area rect;
Area iconRect = new Area(new Rectangle(off, 0, width, height));
if (!isCellEditor) {
rect = new Area(new RoundRectangle2D.Double(bSize - 1, bSize - 1, width - 2 * bSize + 1,
height - 2 * bSize + 1, arc, arc));
} else {
rect = new Area(new Rectangle(0, 0, width, height));
}
if (leftToRight) {
rect.intersect(iconRect);
} else {
rect.subtract(iconRect);
}
g.setPaint(getArrowBackground(comboBox));
g.fill(rect);
g.setColor(borderColor);
g.fillRect(off, bSize - 1, 1, height - 2 * bSize + 1);
}
g.translate(-x, -y);
config.restore();
}
protected void paintCellBorder(final Component c, final int width, final int height,
final boolean isTableCellEditor, final Graphics2D g, final Color borderColor) {
g.setColor(borderColor);
@ -147,22 +116,16 @@ public class DarkComboBoxBorder implements Border, UIResource {
}
}
protected Color getArrowBackground(final JComboBox<?> c) {
if (!c.isEnabled()) return inactiveBackground;
if (c.isEditable()) return arrowBackground;
return background;
}
protected Color getBorderColor(final Component c) {
return c.isEnabled() ? borderColor : inactiveBorderColor;
}
@Override
public Insets getBorderInsets(final Component c) {
if (ComboBoxConstants.isTreeOrTableCellEditor(c)) {
return CellUtil.adjustEditorInsets(new InsetsUIResource(cellPadding.top, cellPadding.left,
cellPadding.bottom, cellPadding.right), c);
cellPadding.bottom, cellPadding.right),
c);
}
if (c.getComponentOrientation().isLeftToRight()) {
return new InsetsUIResource(boxPadding.top, boxPadding.left, boxPadding.bottom, borderSize);

84
core/src/main/java/com/github/weisj/darklaf/ui/combobox/DarkComboBoxUI.java

@ -23,11 +23,13 @@
*/
package com.github.weisj.darklaf.ui.combobox;
import com.github.weisj.darklaf.components.ArrowButton;
import com.github.weisj.darklaf.decorators.LayoutManagerDelegate;
import com.github.weisj.darklaf.ui.list.DarkListCellRenderer;
import com.github.weisj.darklaf.util.DarkUIUtil;
import com.github.weisj.darklaf.util.PropertyKey;
import java.awt.*;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.geom.Area;
import java.awt.geom.RoundRectangle2D;
import javax.swing.*;
import javax.swing.border.Border;
@ -35,11 +37,12 @@ import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.UIResource;
import javax.swing.plaf.basic.BasicComboBoxUI;
import javax.swing.plaf.basic.ComboPopup;
import java.awt.*;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import com.github.weisj.darklaf.components.ArrowButton;
import com.github.weisj.darklaf.decorators.LayoutManagerDelegate;
import com.github.weisj.darklaf.ui.list.DarkListCellRenderer;
import com.github.weisj.darklaf.util.DarkUIUtil;
import com.github.weisj.darklaf.util.PropertyKey;
/**
* @author Konstantin Bulenkov
@ -55,9 +58,6 @@ public class DarkComboBoxUI extends BasicComboBoxUI implements ComboBoxConstants
protected Color editBackground;
protected Color inactiveBackground;
protected Color inactiveForeground;
protected Color focusBorderColor;
protected Color borderColor;
protected Color inactiveBorderColor;
protected Color arrowBackground;
private Insets boxPadding;
@ -77,9 +77,6 @@ public class DarkComboBoxUI extends BasicComboBoxUI implements ComboBoxConstants
editBackground = UIManager.getColor("ComboBox.editBackground");
inactiveBackground = UIManager.getColor("ComboBox.inactiveBackground");
inactiveForeground = UIManager.getColor("ComboBox.disabledForeground");
focusBorderColor = UIManager.getColor("ComboBox.focusBorderColor");
borderColor = UIManager.getColor("ComboBox.activeBorderColor");
inactiveBorderColor = UIManager.getColor("ComboBox.inactiveBorderColor");
arrowBackground = UIManager.getColor("ComboBox.arrowBackground");
if (boxPadding == null) boxPadding = new Insets(0, 0, 0, 0);
}
@ -142,6 +139,7 @@ public class DarkComboBoxUI extends BasicComboBoxUI implements ComboBoxConstants
final ComboBoxEditor comboBoxEditor = super.createEditor();
Component comp = comboBoxEditor.getEditorComponent();
comp.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(final KeyEvent e) {
process(e);
@ -160,6 +158,7 @@ public class DarkComboBoxUI extends BasicComboBoxUI implements ComboBoxConstants
}
});
comp.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(final FocusEvent e) {
comboBox.revalidate();
@ -198,10 +197,14 @@ public class DarkComboBoxUI extends BasicComboBoxUI implements ComboBoxConstants
private void paintBackground(final Graphics g, final JComponent c, final int width, final int height) {
final Container parent = c.getParent();
if (parent != null && parent.isOpaque()) {
if (parent != null && parent.isOpaque() && !c.isEnabled()) {
g.setColor(parent.getBackground());
g.fillRect(0, 0, c.getWidth(), c.getHeight());
return;
}
boolean isCellEditor = ComboBoxConstants.isTreeOrTableCellEditor(c);
if (comboBox.isEditable() && comboBox.getEditor() != null) {
Component editorComp = comboBox.getEditor().getEditorComponent();
if (comboBox.isEnabled()) {
@ -212,13 +215,42 @@ public class DarkComboBoxUI extends BasicComboBoxUI implements ComboBoxConstants
} else {
g.setColor(getBackground(comboBox));
}
if (!ComboBoxConstants.isTreeOrTableCellEditor(c)) {
if (!isCellEditor) {
DarkUIUtil.fillRoundRect((Graphics2D) g, borderSize, borderSize,
width - 2 * borderSize, height - 2 * borderSize,
arcSize);
} else {
g.fillRect(0, 0, width, height);
}
if (comboBox.isEditable()) {
int bSize = !isCellEditor ? borderSize : 0;
paintArrowBackground(width, height, comboBox, arrowButton, isCellEditor,
bSize, arcSize, (Graphics2D) g);
}
}
public void paintArrowBackground(final int width, final int height, final JComboBox<?> comboBox,
final AbstractButton arrowButton, final boolean isCellEditor,
final int bSize, final int arc,
final Graphics2D g) {
Rectangle arrowBounds = arrowButton.getBounds();
boolean leftToRight = comboBox.getComponentOrientation().isLeftToRight();
int off = leftToRight ? arrowBounds.x : arrowBounds.x + arrowBounds.width;
Area rect;
Area iconRect = new Area(new Rectangle(off, 0, width, height));
if (!isCellEditor) {
rect = new Area(new RoundRectangle2D.Double(bSize - 1, bSize - 1, width - 2 * bSize + 1,
height - 2 * bSize + 1, arc, arc));
} else {
rect = new Area(new Rectangle(0, 0, width, height));
}
if (leftToRight) {
rect.intersect(iconRect);
} else {
rect.subtract(iconRect);
}
g.setPaint(getArrowBackground(comboBox));
g.fill(rect);
}
protected Color getBackground(final JComboBox<?> c) {
@ -227,9 +259,16 @@ public class DarkComboBoxUI extends BasicComboBoxUI implements ComboBoxConstants
return background;
}
protected Color getArrowBackground(final JComboBox<?> c) {
if (!c.isEnabled()) return inactiveBackground;
if (c.isEditable()) return arrowBackground;
return background;
}
@Override
protected LayoutManager createLayoutManager() {
return new LayoutManagerDelegate(super.createLayoutManager()) {
@Override
public void layoutContainer(final Container parent) {
super.layoutContainer(parent);
@ -260,13 +299,13 @@ public class DarkComboBoxUI extends BasicComboBoxUI implements ComboBoxConstants
}
Dimension size = getDisplaySize();
Insets insets = getInsets();
//calculate the width and height of the button
// calculate the width and height of the button
int buttonHeight = size.height;
int buttonWidth = squareButton
? buttonHeight
: arrowButton.getPreferredSize().width
+ arrowButton.getInsets().left + arrowButton.getInsets().right;
//adjust the size based on the button width
// adjust the size based on the button width
size.height += insets.top + insets.bottom;
size.width += insets.left + insets.right + buttonWidth;
@ -299,13 +338,14 @@ public class DarkComboBoxUI extends BasicComboBoxUI implements ComboBoxConstants
if (hasFocus && !isPopupVisible(comboBox)) {
c.setForeground(listBox.getForeground());
c.setBackground(listBox.getBackground());
} else {
} else if (comboBox.isEnabled()) {
c.setForeground(getForeground());
c.setBackground(getBackground(comboBox));
}
// paint selection in table-cell-editor mode correctly
boolean changeOpaque = c.isOpaque() && ComboBoxConstants.isTreeOrTableCellEditor(comboBox);
boolean changeOpaque = c.isOpaque() && (!comboBox.isEnabled()
|| ComboBoxConstants.isTreeOrTableCellEditor(comboBox));
if (changeOpaque) {
((JComponent) c).setOpaque(false);
}

27
core/src/main/java/com/github/weisj/darklaf/ui/label/DarkLabelUI.java

@ -23,21 +23,23 @@
*/
package com.github.weisj.darklaf.ui.label;
import com.github.weisj.darklaf.ui.cell.CellUtil;
import com.github.weisj.darklaf.util.DarkUIUtil;
import com.github.weisj.darklaf.util.GraphicsContext;
import com.github.weisj.darklaf.util.GraphicsUtil;
import com.github.weisj.darklaf.util.PropertyKey;
import sun.swing.SwingUtilities2;
import java.awt.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.*;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicHTML;
import javax.swing.plaf.basic.BasicLabelUI;
import javax.swing.text.View;
import java.awt.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import com.github.weisj.darklaf.ui.cell.CellUtil;
import com.github.weisj.darklaf.util.DarkUIUtil;
import com.github.weisj.darklaf.util.GraphicsContext;
import com.github.weisj.darklaf.util.GraphicsUtil;
import com.github.weisj.darklaf.util.PropertyKey;
import sun.swing.SwingUtilities2;
/**
* @author Jannis Weis
@ -66,7 +68,12 @@ public class DarkLabelUI extends BasicLabelUI implements PropertyChangeListener
@Override
public void installUI(final JComponent c) {
if (c != null) super.installUI(c);
//Ensure colors are up to date.
}
@Override
protected void installDefaults(final JLabel c) {
super.installDefaults(c);
LookAndFeel.installProperty(c, PropertyKey.OPAQUE, false);
inactiveForeground = UIManager.getColor("Label.inactiveForeground");
cellForegroundNoFocus = UIManager.getColor("Label.cellForegroundNoFocus");
cellInactiveForeground = UIManager.getColor("Label.cellInactiveForeground");

24
core/src/main/java/com/github/weisj/darklaf/ui/spinner/DarkSpinnerUI.java

@ -23,10 +23,9 @@
*/
package com.github.weisj.darklaf.ui.spinner;
import com.github.weisj.darklaf.components.ArrowButton;
import com.github.weisj.darklaf.decorators.LayoutManagerDelegate;
import com.github.weisj.darklaf.util.DarkUIUtil;
import com.github.weisj.darklaf.util.PropertyKey;
import java.awt.*;
import java.awt.geom.Area;
import java.awt.geom.RoundRectangle2D;
import javax.swing.*;
import javax.swing.border.Border;
@ -35,9 +34,11 @@ import javax.swing.border.EmptyBorder;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.UIResource;
import javax.swing.plaf.basic.BasicSpinnerUI;
import java.awt.*;
import java.awt.geom.Area;
import java.awt.geom.RoundRectangle2D;
import com.github.weisj.darklaf.components.ArrowButton;
import com.github.weisj.darklaf.decorators.LayoutManagerDelegate;
import com.github.weisj.darklaf.util.DarkUIUtil;
import com.github.weisj.darklaf.util.PropertyKey;
/**
* @author Konstantin Bulenkov
@ -235,6 +236,13 @@ public class DarkSpinnerUI extends BasicSpinnerUI implements SpinnerConstants {
@Override
public void paint(final Graphics g, final JComponent c) {
final Container parent = c.getParent();
if (parent != null && parent.isOpaque() && !c.isEnabled()) {
g.setColor(parent.getBackground());
g.fillRect(0, 0, c.getWidth(), c.getHeight());
return;
}
int size = borderSize;
int width = c.getWidth();
int height = c.getHeight();
@ -244,7 +252,7 @@ public class DarkSpinnerUI extends BasicSpinnerUI implements SpinnerConstants {
editorComponent.setBackground(getBackground(c));
g.setColor(editorComponent.getBackground());
} else {
((Graphics2D) g).setPaint(getBackground(c));
g.setColor(getBackground(c));
}
if (!SpinnerConstants.isTreeOrTableCellEditor(c)) {
DarkUIUtil.fillRoundRect((Graphics2D) g, size, size, width - 2 * size, height - 2 * size, arc);

13
core/src/main/java/com/github/weisj/darklaf/ui/table/DarkTableHeaderBorder.java

@ -23,14 +23,15 @@
*/
package com.github.weisj.darklaf.ui.table;
import com.github.weisj.darklaf.components.border.MutableLineBorder;
import com.github.weisj.darklaf.util.DarkUIUtil;
import java.awt.*;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import javax.swing.plaf.UIResource;
import java.awt.*;
import com.github.weisj.darklaf.components.border.MutableLineBorder;
import com.github.weisj.darklaf.util.DarkUIUtil;
/**
* @author Jannis Weis
@ -55,12 +56,6 @@ public class DarkTableHeaderBorder extends MutableLineBorder implements UIResour
return super.getBorderInsets(c, insets);
}
@Override
public Insets getBorderInsets(final Component c) {
adjustTop(c);
return super.getBorderInsets(c);
}
protected void adjustTop(final Component c) {
Component parent = DarkUIUtil.getUnwrappedParent(c.getParent());
top = 0;

11
core/src/main/java/com/github/weisj/darklaf/ui/table/DarkTableHeaderUI.java

@ -23,8 +23,7 @@
*/
package com.github.weisj.darklaf.ui.table;
import com.github.weisj.darklaf.util.DarkUIUtil;
import com.github.weisj.darklaf.util.GraphicsContext;
import java.awt.*;
import javax.swing.*;
import javax.swing.plaf.ComponentUI;
@ -33,7 +32,9 @@ import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import java.awt.*;
import com.github.weisj.darklaf.util.DarkUIUtil;
import com.github.weisj.darklaf.util.GraphicsContext;
/**
* @author Jannis Weis
@ -113,8 +114,8 @@ public class DarkTableHeaderUI extends DarkTableHeaderUIBridge {
cMax = cm.getColumnCount() - 1;
}
Color borderColor = c.getBorder() instanceof DarkTableBorder
? ((DarkTableBorder) c.getBorder()).getBorderColor()
Color borderColor = c.getBorder() instanceof DarkTableScrollPaneBorder
? ((DarkTableScrollPaneBorder) c.getBorder()).getBorderColor()
: getBorderColor();
g.setColor(borderColor);

12
core/src/main/java/com/github/weisj/darklaf/ui/table/DarkTableBorder.java → core/src/main/java/com/github/weisj/darklaf/ui/table/DarkTableScrollPaneBorder.java

@ -23,20 +23,20 @@
*/
package com.github.weisj.darklaf.ui.table;
import com.github.weisj.darklaf.components.border.MutableLineBorder;
import java.awt.*;
import javax.swing.*;
import javax.swing.plaf.UIResource;
import java.awt.*;
import com.github.weisj.darklaf.components.border.MutableLineBorder;
/**
* @author Jannis Weis
*/
public class DarkTableBorder extends MutableLineBorder implements UIResource {
public class DarkTableScrollPaneBorder extends MutableLineBorder implements UIResource {
public DarkTableBorder() {
super(1, 1, 1, 1, null);
setColor(UIManager.getColor("TableHeader.borderColor"));
public DarkTableScrollPaneBorder() {
super(1, 1, 1, 1, UIManager.getColor("TableHeader.borderColor"));
}
public Color getBorderColor() {

49
core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextUI.java

@ -23,6 +23,21 @@
*/
package com.github.weisj.darklaf.ui.text;
import java.awt.*;
import java.awt.event.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.HashSet;
import java.util.Set;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.plaf.ActionMapUIResource;
import javax.swing.plaf.ComponentInputMapUIResource;
import javax.swing.plaf.InputMapUIResource;
import javax.swing.plaf.basic.BasicTextUI;
import javax.swing.text.*;
import com.github.weisj.darklaf.ui.list.DarkListUI;
import com.github.weisj.darklaf.ui.table.DarkTableCellBorder;
import com.github.weisj.darklaf.ui.table.DarkTableUI;
@ -31,23 +46,10 @@ import com.github.weisj.darklaf.util.DarkSwingUtil;
import com.github.weisj.darklaf.util.DarkUIUtil;
import com.github.weisj.darklaf.util.GraphicsContext;
import com.github.weisj.darklaf.util.GraphicsUtil;
import sun.awt.SunToolkit;
import sun.swing.DefaultLookup;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.plaf.ActionMapUIResource;
import javax.swing.plaf.ComponentInputMapUIResource;
import javax.swing.plaf.InputMapUIResource;
import javax.swing.plaf.basic.BasicTextUI;
import javax.swing.text.*;
import java.awt.*;
import java.awt.event.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.HashSet;
import java.util.Set;
/**
* @author Jannis Weis
*/
@ -151,8 +153,14 @@ public abstract class DarkTextUI extends BasicTextUI implements PropertyChangeLi
@Override
protected void paintBackground(final Graphics g) {
final Container parent = getRelevantParent(editor);
if (parent != null && parent.isOpaque() && !editor.isEnabled()) {
g.setColor(parent.getBackground());
g.fillRect(0, 0, editor.getWidth(), editor.getHeight());
return;
}
if (editor.isOpaque()) {
Container parent = editor.getParent();
if (DarkUIUtil.isInCell(editor)) {
g.setColor(getBackground(editor));
g.fillRect(0, 0, editor.getWidth(), editor.getHeight());
@ -181,6 +189,17 @@ public abstract class DarkTextUI extends BasicTextUI implements PropertyChangeLi
}
}
protected Container getRelevantParent(final Component c) {
Container parent = editor.getParent();
if (parent instanceof JSpinner.DefaultEditor) {
JSpinner spinner = DarkUIUtil.getParentOfType(JSpinner.class, c);
if (spinner != null) parent = spinner.getParent();
} else if (parent instanceof JComboBox) {
parent = parent.getParent();
}
return parent;
}
@Override
protected void paintSafely(final Graphics g) {
GraphicsContext config = GraphicsUtil.setupAntialiasing(g);

3
core/src/main/resources/com/github/weisj/darklaf/properties/ui/table.properties

@ -37,7 +37,8 @@ Table.cellNoFocusBorder = com.github.weisj.darklaf.ui.table.DarkT
Table.focusCellHighlightBorder = com.github.weisj.darklaf.ui.table.DarkTableCellFocusBorder
Table.focusSelectedCellHighlightBorder = com.github.weisj.darklaf.ui.table.DarkTableCellFocusBorder
Table.cellEditorBorder = com.github.weisj.darklaf.ui.table.DarkTableCellBorder
Table.scrollPaneBorder = com.github.weisj.darklaf.ui.table.DarkTableBorder
Table.scrollPaneBorder = com.github.weisj.darklaf.ui.table.DarkTableScrollPaneBorder
Table.border = com.github.weisj.darklaf.ui.table.DarkTableBorder
Table.background = %backgroundContainer
Table.focusBorderColor = %borderFocus
Table.focusRowBorderColor = %borderFocus

16
core/src/test/java/ui/table/TableDemo.java

@ -23,18 +23,20 @@
*/
package ui.table;
import java.awt.*;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.swing.*;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableCellEditor;
import com.github.weisj.darklaf.ui.table.DarkTableCellEditor;
import com.github.weisj.darklaf.ui.table.DarkTableUI;
import com.github.weisj.darklaf.util.PropertyKey;
import ui.ComponentDemo;
import ui.DemoPanel;
import javax.swing.*;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableCellEditor;
import java.awt.*;
import java.util.concurrent.atomic.AtomicBoolean;
public class TableDemo implements ComponentDemo {
public static void main(final String[] args) {
@ -73,7 +75,7 @@ public class TableDemo implements ComponentDemo {
};
JTableHeader header = table.getTableHeader();
DemoPanel panel = new DemoPanel(new JScrollPane(table));
DemoPanel panel = new DemoPanel(new JScrollPane(table), new BorderLayout(), 10);
JPanel controlPanel = panel.addControls(3);
controlPanel.add(new JCheckBox("enabled") {{

21
windows/src/main/cpp/Decorations.cpp

@ -135,6 +135,27 @@ LRESULT CALLBACK WindowWrapper::WindowProc(_In_ HWND hwnd, _In_ UINT uMsg, _In_
FillRect(hdc, &clientRect, wrapper->bgBrush);
if (uMsg == WM_ERASEBKGND) return TRUE;
}
else if (uMsg == WM_GETMINMAXINFO)
{
HMONITOR hPrimaryMonitor = MonitorFromWindow(nullptr, MONITOR_DEFAULTTOPRIMARY);
HMONITOR hTargetMonitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
MONITORINFO primaryMonitorInfo{sizeof(MONITORINFO)};
MONITORINFO targetMonitorInfo{sizeof(MONITORINFO)};
GetMonitorInfo(hPrimaryMonitor, &primaryMonitorInfo);
GetMonitorInfo(hTargetMonitor, &targetMonitorInfo);
MINMAXINFO *min_max_info = reinterpret_cast<MINMAXINFO *>(lParam);
RECT max_rect = primaryMonitorInfo.rcWork;
RECT target_rect = targetMonitorInfo.rcWork;
int indent = 2;
min_max_info->ptMaxSize.x = target_rect.right - target_rect.left - 2 * indent;
min_max_info->ptMaxSize.y = target_rect.bottom - target_rect.top - 2 + indent;
min_max_info->ptMaxPosition.x = max_rect.left + indent;
min_max_info->ptMaxPosition.y = max_rect.top + indent;
return FALSE;
}
return CallWindowProc(wrapper->prev_proc, hwnd, uMsg, wParam, lParam);
}

Loading…
Cancel
Save