import java.awt.GridLayout;
import java.lang.reflect.InvocationTargetException;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

public class JDK_8300269 {

    public static JFrame frame;

    public static void main(String[] args) throws
            InterruptedException, InvocationTargetException {
        SwingUtilities.invokeAndWait(() -> createTestUI());
    }

    public static void createTestUI() {

        String lafName = "com.apple.laf.AquaLookAndFeel";
        try {
            UIManager.setLookAndFeel(lafName);
        } catch (UnsupportedLookAndFeelException ignored) {
            System.out.println("Ignoring Unsupported L&F: " + lafName);
        } catch (ClassNotFoundException | InstantiationException
                | IllegalAccessException e) {
            throw new RuntimeException(e);
        }

        frame = new JFrame("JDK-8300269");

        JButton button = new JButton("Button");
        button.addActionListener((e) -> {
            System.out.println("Hello from Button-1");
        });
        button.setBorder(BorderFactory.createTitledBorder("Button title"));

        JButton button2 = new JButton("Button-2");
        button2.addActionListener((e) -> {
            System.out.println("Hello from Button-2");
        });

        String[] comboStrings = {"This", "has", "a titled", "border"};

        JComboBox comboNonEditable = new JComboBox(comboStrings);
        comboNonEditable.setEditable(true);
        comboNonEditable.setBorder(BorderFactory.createTitledBorder(
                "Editable JComboBox"));

        JComboBox comboEditable = new JComboBox(comboStrings);
        comboEditable.setEditable(true);

        JPanel panel = new JPanel();
        GridLayout gridLayout = new GridLayout(2, 2);
        gridLayout.setVgap(5);
        gridLayout.setHgap(5);
        panel.setLayout(gridLayout);
        panel.add(button);
        panel.add(button2);
        panel.add(comboNonEditable);
        panel.add(comboEditable);

        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        frame.getContentPane().add(panel);
        frame.setLocationRelativeTo(null);
        // frame.setSize(300,300);
        frame.pack();
        frame.setVisible(true);
    }
}
