Jtable and look and feel

I have a small problem with changing the appearance of an object. In my application I have

public class JavaCommander extends JFrame

and in this class I have a JTable that is built with my own tabular model. Everything works fine, but, as I said, there is a problem when I want to change the look. In the menu bar, I have a menu with an accessible look.

menuBar=new JMenuBar();
    JMenu lookMenu=new JMenu("Look and Feel");

    UIManager.LookAndFeelInfo[] info= UIManager.getInstalledLookAndFeels();
    ButtonGroup group=new ButtonGroup();

    for (int i=0;i<info.length;++i)
    {
        JRadioButtonMenuItem but=new JRadioButtonMenuItem(info[i].getClassName());
        but.addActionListener(new ActionListener()
        {

            public void actionPerformed(ActionEvent e) 
            {
                try {
                    UIManager.setLookAndFeel(e.getActionCommand());
                    SwingUtilities.updateComponentTreeUI(JavaCommander.this);
                    table.setShowGrid(true);
                } catch (ClassNotFoundException e1) {
                    e1.printStackTrace();
                } catch (InstantiationException e1) {
                    e1.printStackTrace();
                } catch (IllegalAccessException e1) {
                    e1.printStackTrace();
                } catch (UnsupportedLookAndFeelException e1) {
                    e1.printStackTrace();
                }

            }

        });
        lookMenu.add(but);
        group.add(but);
    }
    menuBar.add(lookMenu);

so when I click on one of the buttons, this should change the look of my application. But when I do this, everything changes, but the grid around the elements in the table is missing, so I need to add

table.setShowGrid(true);

Is this normal behavior when the grid disappears after a change in appearance?

+1
source share
1 answer

Is this normal behavior when the grid disappears after a change in appearance?

Some PLAFs do not draw.


PLAF, . , , !

/ PLAF- Nimbus. Nimbus , PLAF .: (

+4

All Articles