Skip to content

Commit

Permalink
DarkLAF, further steps
Browse files Browse the repository at this point in the history
  • Loading branch information
Wisser committed Jun 24, 2024
1 parent c0ad6b0 commit e2f774d
Show file tree
Hide file tree
Showing 14 changed files with 109 additions and 38 deletions.
6 changes: 4 additions & 2 deletions src/main/gui/net/sf/jailer/ui/Colors.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ private static void initColors() {

Color_NeigbBG.init(new Color(255, 255, 255, 200), new Color(31, 39, 42));

Color_ExportDialogModifiedPropertiesBackGround.init(new Color(255, 255, 180), new Color(90, 90, 0));


// TODO
// TODO check "tranparent" todos

Expand Down Expand Up @@ -244,7 +247,6 @@ private static void initColors() {
Color_255_255_176.init(new Color(255, 255, 176));
Color_255_255_204.init(new Color(255, 255, 204));
Color_255_255_205.init(new Color(255, 255, 205));
Color_255_255_210.init(new Color(255, 255, 210));
Color_255_255_220.init(new Color(255, 255, 220));
Color_255_255_236.init(new Color(255, 255, 236));
Color_255_255_240.init(new Color(255, 255, 240));
Expand Down Expand Up @@ -408,7 +410,7 @@ private static void initColors() {
public static LAFAwareColor Color_255_255_176 = new LAFAwareColor();
public static LAFAwareColor Color_255_255_204 = new LAFAwareColor();
public static LAFAwareColor Color_255_255_205 = new LAFAwareColor();
public static LAFAwareColor Color_255_255_210 = new LAFAwareColor();
public static LAFAwareColor Color_ExportDialogModifiedPropertiesBackGround = new LAFAwareColor();
public static LAFAwareColor Color_255_255_220 = new LAFAwareColor();
public static LAFAwareColor Color_255_255_230 = new LAFAwareColor();
public static LAFAwareColor Color_255_255_236 = new LAFAwareColor();
Expand Down
4 changes: 2 additions & 2 deletions src/main/gui/net/sf/jailer/ui/ExportDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ private void update() {
@Override
protected void onModification(JComponent component) {
boolean defaultValue = component == sortedCheckBox;
Color bg = Colors.Color_255_255_210;
Color bg = Colors.Color_ExportDialogModifiedPropertiesBackGround;
for (JCheckBox comp: new JCheckBox[] {
unicode,
sortedCheckBox,
Expand Down Expand Up @@ -770,7 +770,7 @@ public void actionPerformed(ActionEvent arg0) {
@SuppressWarnings({ "unchecked" })
private void initTargetDBMS(Session session) {
resetTargetButton.setVisible(false);
resetTargetButton.setBackground(Colors.Color_255_255_210);
resetTargetButton.setBackground(Colors.Color_ExportDialogModifiedPropertiesBackGround);
resetTargetButton.setIcon(resetIcon);
if (scriptFormat == ScriptFormat.SQL) {
DefaultComboBoxModel<DBMS> aModel = new DefaultComboBoxModel<DBMS>(DBMS.values());
Expand Down
14 changes: 7 additions & 7 deletions src/main/gui/net/sf/jailer/ui/ExtractionModelFrame.form
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,13 @@
<Property name="text" type="java.lang.String" value="Settings"/>
</Properties>
<SubComponents>
<Menu class="javax.swing.JMenu" name="plafMenu">
<Properties>
<Property name="text" type="java.lang.String" value="Theme (Look and Feel)"/>
</Properties>
</Menu>
<MenuItem class="javax.swing.JPopupMenu$Separator" name="jSeparator6">
</MenuItem>
<MenuItem class="javax.swing.JCheckBoxMenuItem" name="horizontalLayoutMenuItem">
<Properties>
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
Expand Down Expand Up @@ -587,13 +594,6 @@
</MenuItem>
</SubComponents>
</Menu>
<MenuItem class="javax.swing.JPopupMenu$Separator" name="jSeparator6">
</MenuItem>
<Menu class="javax.swing.JMenu" name="plafMenu">
<Properties>
<Property name="text" type="java.lang.String" value="Themes (Look and Feel)"/>
</Properties>
</Menu>
</SubComponents>
</Menu>
<Menu class="javax.swing.JMenu" name="jMenu2">
Expand Down
12 changes: 6 additions & 6 deletions src/main/gui/net/sf/jailer/ui/ExtractionModelFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,8 @@ private void initComponents() {
renderHtml1 = new javax.swing.JMenuItem();
consistencyCheckMenuItem = new javax.swing.JMenuItem();
jMenu5 = new javax.swing.JMenu();
plafMenu = new javax.swing.JMenu();
jSeparator6 = new javax.swing.JPopupMenu.Separator();
horizontalLayoutMenuItem = new javax.swing.JCheckBoxMenuItem();
jMenu4 = new javax.swing.JMenu();
steptime10 = new javax.swing.JRadioButtonMenuItem();
Expand All @@ -491,8 +493,6 @@ private void initComponents() {
steptime100 = new javax.swing.JRadioButtonMenuItem();
steptime200 = new javax.swing.JRadioButtonMenuItem();
steptime300 = new javax.swing.JRadioButtonMenuItem();
jSeparator6 = new javax.swing.JPopupMenu.Separator();
plafMenu = new javax.swing.JMenu();
jMenu2 = new javax.swing.JMenu();
helpContent = new javax.swing.JMenuItem();
tutorial = new javax.swing.JMenuItem();
Expand Down Expand Up @@ -977,6 +977,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {

jMenu5.setText("Settings");

plafMenu.setText("Theme (Look and Feel)");
jMenu5.add(plafMenu);
jMenu5.add(jSeparator6);

horizontalLayoutMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I, java.awt.event.InputEvent.CTRL_DOWN_MASK));
horizontalLayoutMenuItem.setSelected(true);
horizontalLayoutMenuItem.setText("Horizontal layout");
Expand Down Expand Up @@ -1062,10 +1066,6 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenu4.add(steptime300);

jMenu5.add(jMenu4);
jMenu5.add(jSeparator6);

plafMenu.setText("Themes (Look and Feel)");
jMenu5.add(plafMenu);

jMenuBar2.add(jMenu5);

Expand Down
15 changes: 15 additions & 0 deletions src/main/gui/net/sf/jailer/ui/UIUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -1700,6 +1700,21 @@ public void actionPerformed(ActionEvent e) {
});
plafMenu.add(item);
}

if (plafMenu.getComponentCount() < 5) {
// TODO
Container p = plafMenu.getParent();
if (p instanceof JPopupMenu) {
for (int i = 0; i < ((JPopupMenu) p).getComponentCount(); ++i) {
Component comp = ((JPopupMenu) p).getComponent(i);
if (comp == plafMenu) {
for (int pmi = 0; pmi < plafMenu.getComponentCount(); ++pmi) {
((JPopupMenu) p).add(plafMenu.getComponent(pmi), i + pmi);
}
}
}
}
}
}

public static String format(long number) {
Expand Down
14 changes: 7 additions & 7 deletions src/main/gui/net/sf/jailer/ui/databrowser/DataBrowser.form
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,13 @@
<Property name="text" type="java.lang.String" value="Settings"/>
</Properties>
<SubComponents>
<Menu class="javax.swing.JMenu" name="plafMenu">
<Properties>
<Property name="text" type="java.lang.String" value="Theme (Look and Feel)"/>
</Properties>
</Menu>
<MenuItem class="javax.swing.JPopupMenu$Separator" name="jSeparator20">
</MenuItem>
<MenuItem class="javax.swing.JCheckBoxMenuItem" name="autoLayoutMenuItem">
<Properties>
<Property name="selected" type="boolean" value="true"/>
Expand Down Expand Up @@ -660,13 +667,6 @@
</MenuItem>
</SubComponents>
</Menu>
<MenuItem class="javax.swing.JPopupMenu$Separator" name="jSeparator20">
</MenuItem>
<Menu class="javax.swing.JMenu" name="plafMenu">
<Properties>
<Property name="text" type="java.lang.String" value="Themes (Look and Feel)"/>
</Properties>
</Menu>
</SubComponents>
</Menu>
<Menu class="javax.swing.JMenu" name="helpMenu">
Expand Down
12 changes: 6 additions & 6 deletions src/main/gui/net/sf/jailer/ui/databrowser/DataBrowser.java
Original file line number Diff line number Diff line change
Expand Up @@ -2491,6 +2491,8 @@ private void initComponents() {
jSeparator6 = new javax.swing.JPopupMenu.Separator();
view = new javax.swing.JMenu();
jMenu3 = new javax.swing.JMenu();
plafMenu = new javax.swing.JMenu();
jSeparator20 = new javax.swing.JPopupMenu.Separator();
autoLayoutMenuItem = new javax.swing.JCheckBoxMenuItem();
zoomWithMouseWheelMenuItem = new javax.swing.JCheckBoxMenuItem();
jSeparator16 = new javax.swing.JPopupMenu.Separator();
Expand All @@ -2503,8 +2505,6 @@ private void initComponents() {
steptime100 = new javax.swing.JRadioButtonMenuItem();
steptime200 = new javax.swing.JRadioButtonMenuItem();
steptime300 = new javax.swing.JRadioButtonMenuItem();
jSeparator20 = new javax.swing.JPopupMenu.Separator();
plafMenu = new javax.swing.JMenu();
helpMenu = new javax.swing.JMenu();
jMenuItem4 = new javax.swing.JMenuItem();
helpForum = new javax.swing.JMenuItem();
Expand Down Expand Up @@ -3697,6 +3697,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {

jMenu3.setText("Settings");

plafMenu.setText("Theme (Look and Feel)");
jMenu3.add(plafMenu);
jMenu3.add(jSeparator20);

autoLayoutMenuItem.setSelected(true);
autoLayoutMenuItem.setText("Automatic layout adjustment");
jMenu3.add(autoLayoutMenuItem);
Expand Down Expand Up @@ -3787,10 +3791,6 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
animationStepTimeMenu.add(steptime300);

jMenu3.add(animationStepTimeMenu);
jMenu3.add(jSeparator20);

plafMenu.setText("Themes (Look and Feel)");
jMenu3.add(plafMenu);

menuBar.add(jMenu3);

Expand Down
8 changes: 5 additions & 3 deletions src/main/gui/net/sf/jailer/ui/databrowser/DetailsView.java
Original file line number Diff line number Diff line change
Expand Up @@ -1219,7 +1219,7 @@ public void mouseClicked(MouseEvent e) {
maximizeButton.setText(null);
maximizeButton.setIcon(UIUtil.plaf == PLAF.FLATDARK? maximizeDarkIcon : maximizeIcon);

SmallButton closeButton = new SmallButton(closeIcon, closeOverIcon, false) {
SmallButton closeButton = new SmallButton(UIUtil.plaf == PLAF.FLATDARK? closeDarkIcon : closeIcon, closeOverIcon, false) {
@Override
protected void onClick(MouseEvent e) {
Window windowAncestor = SwingUtilities.getWindowAncestor(DetailsView.this);
Expand Down Expand Up @@ -1282,6 +1282,7 @@ public void restoreFromOld(DetailsView oldDv) {
private static ImageIcon editdetails;
private static ImageIcon pinIcon;
private static ImageIcon closeIcon;
private static ImageIcon closeDarkIcon;
private static ImageIcon closeOverIcon;
private static ImageIcon maximizeIcon;
private static ImageIcon maximizeDarkIcon;
Expand All @@ -1291,11 +1292,12 @@ public void restoreFromOld(DetailsView oldDv) {
// load images
editdetails = UIUtil.readImage("/editdetails.png");
pinIcon = UIUtil.readImage("/pin.png");
maximizeIcon = UIUtil.scaleIcon(new JLabel(""), UIUtil.readImage("/maximizec.png"));
maximizeIcon = UIUtil.scaleIcon(new JLabel(""), UIUtil.readImage("/maximize.png"));
unmaximizeIcon = UIUtil.scaleIcon(new JLabel(""), UIUtil.readImage("/unmaximize.png"));
maximizeDarkIcon = UIUtil.scaleIcon(new JLabel(""), UIUtil.readImage("/maximizec_dark.png"));
maximizeDarkIcon = UIUtil.scaleIcon(new JLabel(""), UIUtil.readImage("/maximize_dark.png"));
unmaximizeDarkIcon = UIUtil.scaleIcon(new JLabel(""), UIUtil.readImage("/unmaximize_dark.png"));
closeIcon = UIUtil.scaleIcon(new JLabel(""), UIUtil.readImage("/close.png"), 1.55);
closeDarkIcon = UIUtil.scaleIcon(new JLabel(""), UIUtil.readImage("/closedark.png"), 1.55);
closeOverIcon = UIUtil.scaleIcon(new JLabel(""), UIUtil.readImage("/close_over.png"), 1.55);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ private void initPopupView() {
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = GridBagConstraints.BOTH;
gridBagConstraints.anchor = GridBagConstraints.EAST;
popupTitelPanel.add(new SmallButton(UIUtil.plaf == PLAF.FLATDARK? closeDarkIcon : closeIcon, closeOverIcon, true) {
popupTitelPanel.add(new SmallButton(closeIcon, closeOverIcon, true) {
@Override
protected void onClick(MouseEvent e) {
Window window = SwingUtilities.getWindowAncestor(this);
Expand Down Expand Up @@ -2664,7 +2664,7 @@ public void acceptValue(Column column, String valAsString) {
private static ImageIcon nullIcon;
private static ImageIcon resetIcon;
private static ImageIcon closeIcon;
private static ImageIcon closeDarkIcon;
// private static ImageIcon closeDarkIcon;
private static ImageIcon closeOverIcon;
private static ImageIcon constraintPKIcon;
private static ImageIcon okIcon;
Expand All @@ -2681,7 +2681,7 @@ public void acceptValue(Column column, String valAsString) {
warnIcon = UIUtil.readImage("/wanr.png");
resetIcon = UIUtil.readImage("/reset.png");
closeIcon = UIUtil.scaleIcon(new JLabel(""), UIUtil.readImage("/close.png"), 1.4);
closeDarkIcon = UIUtil.scaleIcon(new JLabel(""), UIUtil.readImage("/closedark.png"), 1.4);
// closeDarkIcon = UIUtil.scaleIcon(new JLabel(""), UIUtil.readImage("/closedark.png"), 1.4);
closeOverIcon = UIUtil.scaleIcon(new JLabel(""), UIUtil.readImage("/close_over.png"), 1.4);
constraintPKIcon = UIUtil.scaleIcon(new JLabel(""), UIUtil.readImage("/constraint_pk.png"));
okIcon = UIUtil.readImage("/buttonok.png");
Expand Down
14 changes: 14 additions & 0 deletions src/main/gui/net/sf/jailer/ui/pathfinder/PathFinderView.java
Original file line number Diff line number Diff line change
Expand Up @@ -1384,3 +1384,17 @@ public void initFocus() {
private static final long serialVersionUID = 1L;

}


// TODO
// TODO check references of this SmallButton

//TODO
//TODO pathfinderview: icon "exclude all" is too saturated

//TODO
//TODO lupenstiel in dark nicht gut zu sehen

//TODO
//TODO DMMD: green for EMEditor: brighter?

Binary file modified src/main/gui/net/sf/jailer/ui/resource/history.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/gui/net/sf/jailer/ui/resource/sort123.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/main/gui/net/sf/jailer/ui/resource/sortabc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 40 additions & 2 deletions src/main/gui/net/sf/jailer/ui/util/SmallButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@

import net.sf.jailer.ui.Colors;
import net.sf.jailer.ui.UIUtil;
import net.sf.jailer.ui.UIUtil.PLAF;
import net.sf.jailer.ui.UIUtil.PlafAware;

public abstract class SmallButton extends JLabel {
public abstract class SmallButton extends JLabel implements PlafAware {

private final boolean borderStyle;
private static final Color BORDER_LIGHT = Colors.Color_192_192_192;
Expand Down Expand Up @@ -89,22 +91,45 @@ private void doClick(MouseEvent e) {
});
}

@Override
public void onNewPlaf() {
onMouseExited();
}

protected abstract void onClick(MouseEvent e);

protected void onMouseExited() {
entered = false;
Icon theIcon = lafIcon();
setIcon(theIcon);
if (silent) {
return;
}
if (iconOver != null) {
setIcon(icon);
setIcon(theIcon);
} else if (borderStyle) {
setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED, BORDER_LIGHT, BORDER_SHADOW));
} else {
setEnabled(false);
}
}

private Icon lafIcon() {
if (icon == closeIcon && UIUtil.plaf == PLAF.FLATDARK) {
return closeDarkIcon;
}
if (icon == close16Icon && UIUtil.plaf == PLAF.FLATDARK) {
return close16darkIcon;
}
if (icon == closeDarkIcon && UIUtil.plaf != PLAF.FLATDARK) {
return closeIcon;
}
if (icon == close16darkIcon && UIUtil.plaf != PLAF.FLATDARK) {
return close16Icon;
}
return icon;
}

protected void onMouseEntered() {
entered = true;
if (silent) {
Expand All @@ -119,4 +144,17 @@ protected void onMouseEntered() {
}
}

private Icon closeIcon;
private Icon close16Icon;
private Icon close16darkIcon;
private Icon closeDarkIcon;
private Icon closeOverIcon;

{
closeIcon = UIUtil.scaleIcon(new JLabel(""), UIUtil.readImage("/close.png"), 1.4);
closeDarkIcon = UIUtil.scaleIcon(new JLabel(""), UIUtil.readImage("/closedark.png"), 1.4);
close16Icon = UIUtil.readImage("/Close-16-1.png");
close16darkIcon = UIUtil.readImage("/Close-16-1dark.png");
closeOverIcon = UIUtil.scaleIcon(new JLabel(""), UIUtil.readImage("/close_over.png"), 1.4);
}
}

0 comments on commit e2f774d

Please sign in to comment.