Giter Site home page Giter Site logo

Comments (5)

DevCharly avatar DevCharly commented on May 29, 2024

Setting minimum height with client property JComponent.minimumHeight (or FlatClientProperties.MINIMUM_HEIGHT) is now implemented in master branch.

Do you think that a global value in the UI defaults is also necessary/useful?

from flatlaf.

Chrriis avatar Chrriis commented on May 29, 2024

I don't think it is necessary, and I don't know if it could be useful. Because underline is not the default style for a button, it requires code to activate it, so if someone wants a different height, they could make a factory method.

from flatlaf.

Chrriis avatar Chrriis commented on May 29, 2024

I just tried the code, but I would have thought the preferred size is the one that needs attention. How would you change my test case so that the button is taller (that means having the underline lower)?

from flatlaf.

DevCharly avatar DevCharly commented on May 29, 2024

Must admit that I've not tested the change with your code.

It does not work in your example because the JToggleButton is a child of a JToolBar and such children do not get "minimum preferred" width/height.

else if( !isToolBarButton( c ) && c.getBorder() instanceof FlatButtonBorder ) {
int focusWidth = getFocusWidth( c );
prefSize.width = Math.max( prefSize.width, scale( FlatUIUtils.minimumWidth( c, minimumWidth ) + (focusWidth * 2) ) );
prefSize.height = Math.max( prefSize.height, scale( FlatUIUtils.minimumHeight( c, 0 ) + (focusWidth * 2) ) );
}

The purpose of the "minimum preferred" width is that buttons with short text (e.g. "OK") or empty text fields have a useful width by default. If a button is in a toolbar, it should be smaller.

Anyway there is a better way to give the button a larger size:

button1.setMargin( new Insets( 10, 10, 10, 10 ) );

from flatlaf.

DevCharly avatar DevCharly commented on May 29, 2024

implemented in 0.26

from flatlaf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.