// Path: src/main/java/bdsup2sub/gui/support/RequestFocusListener.java
// public class RequestFocusListener implements AncestorListener
// {
//     private boolean removeListener;
// 
//     /*
//      *  Convenience constructor. The listener is only used once and then it is
//      *  removed from the component.
//      */
//     public RequestFocusListener() {
//         this(true);
//     }
// 
//     /*
//      *  Constructor that controls whether this listen can be used once or
//      *  multiple times.
//      *
//      *  @param removeListener when true this listener is only invoked once
//      *                        otherwise it can be invoked multiple times.
//      */
//     public RequestFocusListener(boolean removeListener) {
//         this.removeListener = removeListener;
//     }
// 
//     @Override
//     public void ancestorAdded(AncestorEvent e) {
//         JComponent component = e.getComponent();
//         component.requestFocusInWindow();
//         if (removeListener) {
//             component.removeAncestorListener(this);
//         }
//     }
// 
//     @Override
//     public void ancestorMoved(AncestorEvent e) {
//     }
// 
//     @Override
//     public void ancestorRemoved(AncestorEvent e) {
//     }
// }
// 
// Path: src/main/java/bdsup2sub/gui/support/GuiUtils.java
// public static void centerRelativeToOwner(Window window) {
//     Window owner = window.getOwner();
//     Point p = owner.getLocation();
//     window.setLocation(p.x + owner.getWidth() / 2 - window.getWidth() / 2, p.y + owner.getHeight() / 2 - window.getHeight() / 2);
// }


import bdsup2sub.gui.support.RequestFocusListener;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.MouseListener;
import java.awt.image.BufferedImage;
import static bdsup2sub.gui.support.GuiUtils.centerRelativeToOwner;
        centerRelativeToOwner(this);
    }

    private JPanel getJContentPane() {
        if(jContentPane == null) {
            JLabel lblColor = new JLabel();
            jContentPane = new JPanel();
            jContentPane.setLayout(null);
            lblColor.setText("Choose Color");
            lblColor.setBounds(15, 9, 80, 16);
            jContentPane.add(lblColor, null);
            jContentPane.add(getJButtonOk(), null);
            jContentPane.add(getJButtonCancel(), null);
            jContentPane.add(getJButtonDefault(), null);
            jContentPane.add(getJButtonColor(), null);
            jContentPane.add(getJButtonSave(), null);
            jContentPane.add(getJButtonLoad(), null);
            jContentPane.add(getJScrollPane(), null);
            initColorList();
        }
        return jContentPane;
    }

    private JButton getJButtonOk() {
        if (jButtonOk == null) {
            jButtonOk = new JButton();
            jButtonOk.setBounds(280, 162, 66, 20);
            jButtonOk.setText("OK");
            jButtonOk.setToolTipText("Apply changes and return");
            jButtonOk.setMnemonic('o');
// Path: src/main/java/bdsup2sub/gui/support/RequestFocusListener.java
// public class RequestFocusListener implements AncestorListener
// {
//     private boolean removeListener;
// 
//     /*
//      *  Convenience constructor. The listener is only used once and then it is
//      *  removed from the component.
//      */
//     public RequestFocusListener() {
//         this(true);
//     }
// 
//     /*
//      *  Constructor that controls whether this listen can be used once or
//      *  multiple times.
//      *
//      *  @param removeListener when true this listener is only invoked once
//      *                        otherwise it can be invoked multiple times.
//      */
//     public RequestFocusListener(boolean removeListener) {
//         this.removeListener = removeListener;
//     }
// 
//     @Override
//     public void ancestorAdded(AncestorEvent e) {
//         JComponent component = e.getComponent();
//         component.requestFocusInWindow();
//         if (removeListener) {
//             component.removeAncestorListener(this);
//         }
//     }
// 
//     @Override
//     public void ancestorMoved(AncestorEvent e) {
//     }
// 
//     @Override
//     public void ancestorRemoved(AncestorEvent e) {
//     }
// }
// 
// Path: src/main/java/bdsup2sub/gui/support/GuiUtils.java
// public static void centerRelativeToOwner(Window window) {
//     Window owner = window.getOwner();
//     Point p = owner.getLocation();
//     window.setLocation(p.x + owner.getWidth() / 2 - window.getWidth() / 2, p.y + owner.getHeight() / 2 - window.getHeight() / 2);
// }


// Path: src/main/java/bdsup2sub/gui/palette/DvdPaletteDialogView.java
import bdsup2sub.gui.support.RequestFocusListener;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.MouseListener;
import java.awt.image.BufferedImage;
import static bdsup2sub.gui.support.GuiUtils.centerRelativeToOwner;

        centerRelativeToOwner(this);
    }

    private JPanel getJContentPane() {
        if(jContentPane == null) {
            JLabel lblColor = new JLabel();
            jContentPane = new JPanel();
            jContentPane.setLayout(null);
            lblColor.setText("Choose Color");
            lblColor.setBounds(15, 9, 80, 16);
            jContentPane.add(lblColor, null);
            jContentPane.add(getJButtonOk(), null);
            jContentPane.add(getJButtonCancel(), null);
            jContentPane.add(getJButtonDefault(), null);
            jContentPane.add(getJButtonColor(), null);
            jContentPane.add(getJButtonSave(), null);
            jContentPane.add(getJButtonLoad(), null);
            jContentPane.add(getJScrollPane(), null);
            initColorList();
        }
        return jContentPane;
    }

    private JButton getJButtonOk() {
        if (jButtonOk == null) {
            jButtonOk = new JButton();
            jButtonOk.setBounds(280, 162, 66, 20);
            jButtonOk.setText("OK");
            jButtonOk.setToolTipText("Apply changes and return");
            jButtonOk.setMnemonic('o');
            jButtonOk.addAncestorListener(new RequestFocusListener());