Browse Source

formatting.

pull/170/head
weisj 5 years ago
parent
commit
54d3579dae
  1. 43
      windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java

43
windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java

@ -35,6 +35,8 @@ import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.plaf.UIResource;
import sun.awt.SunToolkit;
import com.github.weisj.darklaf.icons.ScaledIcon;
import com.github.weisj.darklaf.icons.ToggleIcon;
import com.github.weisj.darklaf.platform.decorations.CustomTitlePane;
@ -43,8 +45,6 @@ import com.github.weisj.darklaf.platform.windows.PointerUtil;
import com.github.weisj.darklaf.util.PropertyKey;
import com.github.weisj.darklaf.util.Scale;
import sun.awt.SunToolkit;
/**
* @author Konstantin Bulenkov
* @author Jannis Weis
@ -71,8 +71,7 @@ public class WindowsTitlePane extends CustomTitlePane {
}
@Override
public void componentRemoved(final ContainerEvent e) {
}
public void componentRemoved(final ContainerEvent e) {}
};
private boolean oldResizable;
private PropertyChangeListener propertyChangeListener;
@ -292,21 +291,21 @@ public class WindowsTitlePane extends CustomTitlePane {
private void determineColors() {
switch (getDecorationStyle()) {
case JRootPane.ERROR_DIALOG:
case JRootPane.ERROR_DIALOG :
activeBackground = UIManager.getColor("Windows.OptionPane.errorDialog.titlePane.background");
activeForeground = UIManager.getColor("Windows.OptionPane.errorDialog.titlePane.foreground");
break;
case JRootPane.QUESTION_DIALOG:
case JRootPane.COLOR_CHOOSER_DIALOG:
case JRootPane.FILE_CHOOSER_DIALOG:
case JRootPane.QUESTION_DIALOG :
case JRootPane.COLOR_CHOOSER_DIALOG :
case JRootPane.FILE_CHOOSER_DIALOG :
activeBackground = UIManager.getColor("Windows.OptionPane.questionDialog.titlePane.background");
activeForeground = UIManager.getColor("Windows.OptionPane.questionDialog.titlePane.foreground");
break;
case JRootPane.WARNING_DIALOG:
case JRootPane.WARNING_DIALOG :
activeBackground = UIManager.getColor("Windows.OptionPane.warningDialog.titlePane.background");
activeForeground = UIManager.getColor("Windows.OptionPane.warningDialog.titlePane.foreground");
break;
default: // JRootPane.Frame
default : // JRootPane.Frame
activeBackground = UIManager.getColor("Windows.TitlePane.background");
activeForeground = UIManager.getColor("Windows.TitlePane.foreground");
break;
@ -328,10 +327,10 @@ public class WindowsTitlePane extends CustomTitlePane {
windowIconButton.setComponentPopupMenu(createMenu());
windowIconButton.putClientProperty("JButton.variant", "onlyLabel");
windowIconButton.addActionListener(e -> windowIconButton
.getComponentPopupMenu()
.show(windowIconButton,
windowIconButton.getWidth() / 2,
windowIconButton.getHeight() / 2));
.getComponentPopupMenu()
.show(windowIconButton,
windowIconButton.getWidth() / 2,
windowIconButton.getHeight() / 2));
windowIconButton.setFocusable(false);
windowIconButton.setBorderPainted(false);
return windowIconButton;
@ -566,7 +565,7 @@ public class WindowsTitlePane extends CustomTitlePane {
protected boolean isLeftToRight(final Window window) {
return (window == null) ? getRootPane().getComponentOrientation().isLeftToRight()
: window.getComponentOrientation().isLeftToRight();
: window.getComponentOrientation().isLeftToRight();
}
private void updateSystemIcon() {
@ -587,11 +586,13 @@ public class WindowsTitlePane extends CustomTitlePane {
} else if (icons.size() == 1) {
systemIcon = new ScaledIcon(icons.get(0).getScaledInstance((int) Scale.scaleWidth(ICON_SIZE, gc),
(int) Scale.scaleHeight(ICON_SIZE, gc),
Image.SCALE_AREA_AVERAGING), this);
Image.SCALE_AREA_AVERAGING),
this);
} else {
systemIcon = new ScaledIcon(SunToolkit.getScaledIconImage(icons,
(int) Scale.scaleWidth(ICON_SIZE, gc),
(int) Scale.scaleHeight(ICON_SIZE, gc)), this);
(int) Scale.scaleHeight(ICON_SIZE, gc)),
this);
}
if (windowIconButton != null) {
windowIconButton.setIcon(systemIcon);
@ -667,11 +668,9 @@ public class WindowsTitlePane extends CustomTitlePane {
}
private class TitlePaneLayout implements LayoutManager {
public void addLayoutComponent(final String name, final Component c) {
}
public void addLayoutComponent(final String name, final Component c) {}
public void removeLayoutComponent(final Component c) {
}
public void removeLayoutComponent(final Component c) {}
@Override
public Dimension preferredLayoutSize(final Container parent) {
@ -706,7 +705,7 @@ public class WindowsTitlePane extends CustomTitlePane {
.getIconHeight(),
windowIconButton.getIcon()
.getIconWidth())
: ICON_WIDTH;
: ICON_WIDTH;
windowButtonWidth = Math.min(ICON_WIDTH, windowButtonWidth);
windowIconButton.setBounds(start + PAD, y, windowButtonWidth, height);
start += windowButtonWidth + 2 * PAD;

Loading…
Cancel
Save