diff --git a/src/main/java/cz/kamma/kfmanager/ui/MainWindow.java b/src/main/java/cz/kamma/kfmanager/ui/MainWindow.java index 14e6a92..c6b17be 100644 --- a/src/main/java/cz/kamma/kfmanager/ui/MainWindow.java +++ b/src/main/java/cz/kamma/kfmanager/ui/MainWindow.java @@ -501,7 +501,8 @@ public class MainWindow extends JFrame { toolBar.removeAll(); // Refresh button - JButton btnRefresh = new JButton("↻"); + JButton btnRefresh = new JButton(); + btnRefresh.setIcon(createToolbarRefreshIcon()); setupMainToolbarButton(btnRefresh, "Refresh active panel", new Color(140, 190, 140)); btnRefresh.addActionListener(e -> { if (activePanel != null && activePanel.getCurrentDirectory() != null) { @@ -512,7 +513,8 @@ public class MainWindow extends JFrame { toolBar.addSeparator(); // Button for BRIEF mode - JButton btnBrief = new JButton("☰"); + JButton btnBrief = new JButton(); + btnBrief.setIcon(createToolbarBriefIcon()); setupMainToolbarButton(btnBrief, "Brief mode - multiple columns (Ctrl+F1)", new Color(230, 180, 130)); btnBrief.addActionListener(e -> { if (activePanel != null) { @@ -521,7 +523,8 @@ public class MainWindow extends JFrame { }); // Button for FULL mode - JButton btnFull = new JButton("▤"); + JButton btnFull = new JButton(); + btnFull.setIcon(createToolbarFullIcon()); setupMainToolbarButton(btnFull, "Full mode - full information (Ctrl+F2)", new Color(140, 170, 220)); btnFull.addActionListener(e -> { if (activePanel != null) { @@ -535,13 +538,15 @@ public class MainWindow extends JFrame { toolBar.addSeparator(); // Search button - JButton btnSearch = new JButton("🔍"); + JButton btnSearch = new JButton(); + btnSearch.setIcon(createToolbarSearchIcon()); setupMainToolbarButton(btnSearch, "Search files (Alt+F7)", new Color(200, 160, 200)); btnSearch.addActionListener(e -> showSearchDialog()); toolBar.add(btnSearch); // Sync button - JButton btnSync = new JButton("⚖"); + JButton btnSync = new JButton(); + btnSync.setIcon(createToolbarCompareIcon()); setupMainToolbarButton(btnSync, "Compare directories", new Color(150, 200, 200)); btnSync.addActionListener(e -> showSyncDialog()); toolBar.add(btnSync); @@ -713,6 +718,191 @@ public class MainWindow extends JFrame { return new ImageIcon(img.getScaledInstance(width, height, Image.SCALE_SMOOTH)); } + private Icon createToolbarSearchIcon() { + return new Icon() { + private final int w = 16; + private final int h = 16; + + @Override + public int getIconWidth() { + return w; + } + + @Override + public int getIconHeight() { + return h; + } + + @Override + public void paintIcon(Component c, Graphics g, int x, int y) { + Graphics2D g2 = (Graphics2D) g.create(); + try { + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2.setColor(c != null ? c.getForeground() : Color.DARK_GRAY); + g2.setStroke(new BasicStroke(2f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); + + int cx = x + 6; + int cy = y + 6; + int r = 4; + + g2.drawOval(cx - r, cy - r, r * 2, r * 2); + g2.drawLine(cx + r - 1, cy + r - 1, x + 14, y + 14); + } finally { + g2.dispose(); + } + } + }; + } + + private Icon createToolbarRefreshIcon() { + return new Icon() { + private final int w = 16; + private final int h = 16; + + @Override + public int getIconWidth() { + return w; + } + + @Override + public int getIconHeight() { + return h; + } + + @Override + public void paintIcon(Component c, Graphics g, int x, int y) { + Graphics2D g2 = (Graphics2D) g.create(); + try { + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2.setColor(c != null ? c.getForeground() : Color.DARK_GRAY); + g2.setStroke(new BasicStroke(2f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); + + g2.drawArc(x + 2, y + 2, 10, 10, 35, 255); + g2.drawLine(x + 11, y + 2, x + 14, y + 3); + g2.drawLine(x + 11, y + 2, x + 12, y + 5); + } finally { + g2.dispose(); + } + } + }; + } + + private Icon createToolbarBriefIcon() { + return new Icon() { + private final int w = 16; + private final int h = 16; + + @Override + public int getIconWidth() { + return w; + } + + @Override + public int getIconHeight() { + return h; + } + + @Override + public void paintIcon(Component c, Graphics g, int x, int y) { + Graphics2D g2 = (Graphics2D) g.create(); + try { + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2.setColor(c != null ? c.getForeground() : Color.DARK_GRAY); + g2.setStroke(new BasicStroke(2f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); + + // Three vertical columns to represent compact brief layout. + int colW = 3; + int gap = 2; + int startX = x + 1; + int top = y + 2; + int height = 12; + for (int i = 0; i < 3; i++) { + int cx = startX + i * (colW + gap); + g2.drawRoundRect(cx, top, colW, height, 2, 2); + } + } finally { + g2.dispose(); + } + } + }; + } + + private Icon createToolbarFullIcon() { + return new Icon() { + private final int w = 16; + private final int h = 16; + + @Override + public int getIconWidth() { + return w; + } + + @Override + public int getIconHeight() { + return h; + } + + @Override + public void paintIcon(Component c, Graphics g, int x, int y) { + Graphics2D g2 = (Graphics2D) g.create(); + try { + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2.setColor(c != null ? c.getForeground() : Color.DARK_GRAY); + g2.setStroke(new BasicStroke(2f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); + + // List rows with a side column to represent full-detail table layout. + g2.drawRoundRect(x + 1, y + 2, 4, 12, 2, 2); + g2.drawLine(x + 7, y + 4, x + 14, y + 4); + g2.drawLine(x + 7, y + 8, x + 14, y + 8); + g2.drawLine(x + 7, y + 12, x + 14, y + 12); + } finally { + g2.dispose(); + } + } + }; + } + + private Icon createToolbarCompareIcon() { + return new Icon() { + private final int w = 16; + private final int h = 16; + + @Override + public int getIconWidth() { + return w; + } + + @Override + public int getIconHeight() { + return h; + } + + @Override + public void paintIcon(Component c, Graphics g, int x, int y) { + Graphics2D g2 = (Graphics2D) g.create(); + try { + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2.setColor(c != null ? c.getForeground() : Color.DARK_GRAY); + g2.setStroke(new BasicStroke(2f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND)); + + // Two panes side by side with opposing arrows: directory compare. + g2.drawRoundRect(x + 1, y + 2, 5, 11, 2, 2); + g2.drawRoundRect(x + 10, y + 2, 5, 11, 2, 2); + + g2.drawLine(x + 7, y + 6, x + 9, y + 6); + g2.drawLine(x + 8, y + 5, x + 9, y + 6); + g2.drawLine(x + 8, y + 7, x + 9, y + 6); + + g2.drawLine(x + 9, y + 10, x + 7, y + 10); + g2.drawLine(x + 8, y + 9, x + 7, y + 10); + g2.drawLine(x + 8, y + 11, x + 7, y + 10); + } finally { + g2.dispose(); + } + } + }; + } + private void setupMainToolbarButton(JButton btn, String tooltip, Color color) { int btnSize = config != null ? config.getToolbarButtonSize() : 35; if (btnSize < 35) btnSize = 35;