Hey guys,

I know this is off topic for this particular list, but since you all have been 
working on Retina support so much, I figured I bring it up here as well.

I just had a chance to try out 1.7.0_45 on Windows 7 (via Parallels 9). Java 
nicely takes advantage of the high resolution, however, it's not great.

When using Swing and the standard look and feel, everything is tiny, but 
proportions are correct (examples attached).
When using Swing and the Windows look and feel, fonts are scaled appropriately, 
but JTable rowHeight is still at 16 pixels and looks quite awkward.

So, the standard look and feel needs scaling, and the Windows look and feel 
needs some polishing. Other than that: neat!
Filed an Oracle bug 9008405—perhaps someone with access to the system wants to 
attach the screenshots.

Cheers,

-hendrik



Code:

import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import java.awt.*;

/**
 * Demo table to demonstrate bad row height on HiDPI displays.
 */
public class TableRowHeight {

    public static void main(String[] args) throws ClassNotFoundException, 
UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException 
{
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        final JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        final JTable table = new JTable();
        final DefaultTableModel dataModel = new DefaultTableModel(4, 1);
        dataModel.setValueAt("Some String", 0, 0);
        dataModel.setValueAt("Some String", 1, 0);
        dataModel.setValueAt("Some String", 2, 0);
        dataModel.setValueAt("Some String", 3, 0);
        table.setModel(dataModel);
        table.setAutoCreateColumnsFromModel(true);
        frame.getContentPane().setLayout(new BorderLayout());
        frame.getContentPane().add(table, BorderLayout.CENTER);
        frame.getContentPane().add(new JLabel("Label"), BorderLayout.NORTH);
        final JMenuBar menuBar = new JMenuBar();
        menuBar.add(new JMenu("Menu"));
        frame.setJMenuBar(menuBar);
        frame.setBounds(100, 100, 300, 300);
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                frame.setVisible(true);
            }
        });
    }

}

Reply via email to