Index

Java Swing

updating a component in already visible Container:
frame.getContentPane().validate();
frame.getContentPane().repaint();
getting the active window (or null if application is not selected)
Window active = FocusManager.getCurrentManager().getActiveWindow();

components

JTable

adding a mouse double click listener
mytable.addMouseListener(new MouseAdapter() {
    public void mousePressed(MouseEvent event) {
        JTable table = (JTable) event.getSource();
        int row = table.rowAtPoint(event.getPoint());
        if (event.getClickCount() == 2 && table.getSelectedRow() != -1) {
            // todo: code goes here
        }
    }
});

borders

add border to component
component.setBorder(BorderFactory.createLineBorder(Color.white))
add border with padding to component
component.setBorder(BorderFactory.createCompoundBorder(new LineBorder(Color.red), new EmptyBorder(10, 10, 10, 10)));

UIManager / look and feel

set a global UI property
UIManager.getLookAndFeelDefaults().put("[key]", [value]));
list all keys for current look and feel
UIDefaults defaults = UIManager.getDefaults();
        Enumeration<?> e = defaults.keys();
        while (e.hasMoreElements()) {
            Object key = e.nextElement();
            Object current = defaults.get(key);
            String value = current == null ? "" : current.getClass().toString();
            System.out.println(key + "=" + value);
        }
ideas for colors
https://colorhunt.co/palettes
hex to RGB
https://duckduckgo.com/?t=ffsb&q=hex+to+rgb&ia=answer