A
A
Alexander Interesting2021-10-08 19:00:25
Java
Alexander Interesting, 2021-10-08 19:00:25

Change edge color in JMenu?

I created a JMenuBar and JMenu in it, added all the necessary styles, but bad luck - the top and bottom gaps are white:
61606b08d92e6713788204.png

How to remove this?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sergey, 2021-10-08
@Swimergg

"look and fill " is responsible for the borders
https://docs.oracle.com/javase/tutorial/uiswing/lo...
https://progi.pro/swing-lf-import-i-realizaciya-6...

O
Odissey Nemo, 2021-10-17
@odissey_nemo

Try calling this method:

/**
     * Sets the current system look and feel properties
     */
    public static void setSystemLookAndFeel() {
        /* Get the default operation system style */
        final String uiName = UIManager.getSystemLookAndFeelClassName();
        /* Set this default current style for our task */
        try {
            UIManager.setLookAndFeel( uiName );
        } catch ( Exception ex ) {
            System.err.printf( "--- Can't set GUI default system style (%s):%s%n", uiName, ex.getMessage() );
        }
    }

Somewhere at the beginning of the JFrame constructor of the program's main window.
Maybe the problem will disappear and everything will be fine.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question