Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Icon-only button is always made square #110

Closed
stanio opened this issue Jun 3, 2020 · 5 comments
Closed

Icon-only button is always made square #110

stanio opened this issue Jun 3, 2020 · 5 comments
Milestone

Comments

@stanio
Copy link

stanio commented Jun 3, 2020

package net.example;

import java.awt.FlowLayout;
import javax.swing.*;

public class ButtonTest extends JFrame {

    ButtonTest() {
        super("Button Test");
        super.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        super.setLayout(new FlowLayout());

        ImageIcon tallIcon = new ImageIcon(ButtonTest.class.getResource("20x60.png"));
        super.add(new JButton(tallIcon));
        super.add(new JToggleButton(tallIcon));
    }

    public static void main(String[] args) {
        SwingUtilities.invokeLater(() -> {
            try {
                UIManager.setLookAndFeel("com.formdev.flatlaf.FlatLightLaf");
            } catch (Exception e) {
                e.printStackTrace();
            }
            JFrame frame = new ButtonTest();
            frame.pack();
            frame.setVisible(true);
        });
    }

}

I guess this likely assumes icon-only buttons are small toolbar buttons, but such are also vertical-label buttons – they should not extend in width just because they are taller.

@DevCharly
Copy link
Collaborator

Yes, agree with you. This is now changed in master branch.

Please try the latest snapshot 0.36-SNAPSHOT (or build from master)
https://github.com/JFormDesigner/FlatLaf#snapshots

PS don't forget to "star" FlatLaf here on github 😉

@DevCharly DevCharly added this to the 0.36 milestone Jun 3, 2020
@stanio
Copy link
Author

stanio commented Jun 4, 2020

Tried with flatlaf-0.36-20200603.140243-14.jar – it looks just fine now:

vertical-button demo

@stanio
Copy link
Author

stanio commented Jun 5, 2020

I think FlatLaf just rocks!

@DevCharly
Copy link
Collaborator

I think FlatLaf just rocks!

That was the plan 😉
Thanks @stanio 😄

@DevCharly
Copy link
Collaborator

released in 0.36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants