rbEmbedInTiles.setSelected(embed && rbEmbedInTiles.isSelected());
    private void init() {        // Create primitives        cbBinaryEncode = new JCheckBox(BINARY_ENCODE_CHECKBOX);        cbCompressLayerData = new JCheckBox(COMPRESS_LAYER_DATA_CHECKBOX);        cbEmbedImages = new JCheckBox(EMBED_IMAGES_CHECKBOX);        cbReportIOWarnings = new JCheckBox(REPORT_IO_WARNINGS_CHECKBOX);        rbEmbedInTiles = new JRadioButton(EMBED_IN_TILES_CHECKBOX);        rbEmbedInSet = new JRadioButton(EMBED_IN_SET_CHECKBOX);        ButtonGroup bg = new ButtonGroup();        bg.add(rbEmbedInTiles);        bg.add(rbEmbedInSet);        undoDepth = new IntegerSpinner();        cbGridAA = new JCheckBox(ANTIALIASING_CHECKBOX);        gridOpacitySlider = new JSlider(0, 255, 255);        //gridColor = new JColorChooser();        // Set up the layout        /* LAYER OPTIONS */        JPanel layerOps = new VerticalStaticJPanel();        layerOps.setLayout(new GridBagLayout());        layerOps.setBorder(BorderFactory.createCompoundBorder(                    BorderFactory.createTitledBorder(LAYER_OPTIONS_TITLE),                    BorderFactory.createEmptyBorder(0, 5, 5, 5)));        GridBagConstraints c = new GridBagConstraints();        c.anchor = GridBagConstraints.EAST;        c.fill = GridBagConstraints.NONE;        c.gridy = 1;        c.fill = GridBagConstraints.HORIZONTAL;        c.gridx = 1; c.gridy = 0; c.weightx = 1;        layerOps.add(cbBinaryEncode, c);        c.gridy = 1; c.insets = new Insets(0, 10, 0, 0);        layerOps.add(cbCompressLayerData, c);        /* GENERAL OPTIONS */        JPanel generalOps = new VerticalStaticJPanel();        generalOps.setLayout(new GridBagLayout());        generalOps.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));        c = new GridBagConstraints();        c.anchor = GridBagConstraints.NORTH;        c.fill = GridBagConstraints.NONE;        generalOps.add(new JLabel(UNDO_DEPTH_LABEL), c);        c.fill = GridBagConstraints.HORIZONTAL;        c.gridx = 1; c.weightx = 1;        generalOps.add(undoDepth, c);        c.gridy = 1;        c.gridx = 0;        generalOps.add(cbReportIOWarnings, c);        /* TILESET OPTIONS */        JPanel tilesetOps = new VerticalStaticJPanel();        tilesetOps.setLayout(new GridBagLayout());        tilesetOps.setBorder(BorderFactory.createCompoundBorder(                    BorderFactory.createTitledBorder(TILESET_OPTIONS_TITLE),                    BorderFactory.createEmptyBorder(0, 5, 5, 5)));        c = new GridBagConstraints();        c.fill = GridBagConstraints.HORIZONTAL;        c.gridx = 1; c.gridy = 0; c.weightx = 1;        tilesetOps.add(cbEmbedImages, c);        c.gridy = 1; c.insets = new Insets(0, 10, 0, 0);        tilesetOps.add(rbEmbedInTiles, c);        c.gridy = 2; c.insets = new Insets(0, 10, 0, 0);        tilesetOps.add(rbEmbedInSet, c);        /* GRID OPTIONS */        JPanel gridOps = new VerticalStaticJPanel();        gridOps.setLayout(new GridBagLayout());        gridOps.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));        c = new GridBagConstraints();        c.insets = new Insets(0, 0, 0, 5);        gridOps.add(new JLabel(OPACITY_LABEL), c);        c.insets = new Insets(0, 0, 0, 0);        c.weightx = 1; c.gridx = 1;        c.fill = GridBagConstraints.HORIZONTAL;        gridOps.add(gridOpacitySlider, c);        c.gridwidth = 2; c.gridy = 1; c.gridx = 0;        gridOps.add(cbGridAA, c);        //c.gridy = 2; c.weightx = 0;        //gridOps.add(new JLabel("Color: "), c);        //c.gridx = 1;        //gridOps.add(gridColor, c);        JButton exportButton = new JButton(EXPORT_BUTTON);        exportButton.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent actionEvent) {                doExport();            }        });        JButton importButton = new JButton(IMPORT_BUTTON);        exportButton.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent actionEvent) {                doImport();            }        });        JButton closeButton = new JButton(CLOSE_BUTTON);        closeButton.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent actionEvent) {                dispose();            }        });        /* BUTTONS PANEL */        JPanel buttons = new VerticalStaticJPanel();        buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));        /*        // todo: add once import/export feature file choosers        buttons.add(exportButton);        buttons.add(Box.createRigidArea(new Dimension(5, 5)));        buttons.add(importButton);        buttons.add(Box.createRigidArea(new Dimension(5, 5)));        */        buttons.add(Box.createGlue());        buttons.add(closeButton);        JPanel saving = new JPanel();        saving.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));        saving.setLayout(new BoxLayout(saving, BoxLayout.Y_AXIS));        saving.add(layerOps);        saving.add(tilesetOps);        JPanel general = new JPanel();        general.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));        general.setLayout(new BoxLayout(general, BoxLayout.Y_AXIS));        general.add(generalOps);        JPanel grid = new JPanel();        grid.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));        grid.setLayout(new BoxLayout(grid, BoxLayout.Y_AXIS));        grid.add(gridOps);        // Put together the tabs        JTabbedPane perfs = new JTabbedPane();        perfs.addTab(GENERAL_TAB, general);        perfs.addTab(SAVING_TAB, saving);        perfs.addTab(GRID_TAB, grid);        JPanel mainPanel = new JPanel();        mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.PAGE_AXIS));        mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));        mainPanel.add(perfs);        mainPanel.add(Box.createRigidArea(new Dimension(0, 5)));        mainPanel.add(buttons);        getContentPane().add(mainPanel);        getRootPane().setDefaultButton(closeButton);        // Associate listeners with the configuration widgets        cbBinaryEncode.addItemListener(new ItemListener() {            public void itemStateChanged(ItemEvent itemEvent) {                final boolean selected = cbBinaryEncode.isSelected();                savingPrefs.putBoolean("encodeLayerData", selected);                cbCompressLayerData.setEnabled(selected);            }        });        cbCompressLayerData.addItemListener(new ItemListener() {            public void itemStateChanged(ItemEvent itemEvent) {                savingPrefs.putBoolean("layerCompression",                        cbCompressLayerData.isSelected());            }        });        cbEmbedImages.addItemListener(new ItemListener() {            public void itemStateChanged(ItemEvent itemEvent) {                final boolean embed = cbEmbedImages.isSelected();                savingPrefs.putBoolean("embedImages", embed);                rbEmbedInTiles.setSelected(embed && rbEmbedInTiles.isSelected());                rbEmbedInTiles.setEnabled(embed);                rbEmbedInSet.setSelected(embed && rbEmbedInSet.isSelected());                rbEmbedInSet.setEnabled(embed);            }        });        cbReportIOWarnings.addItemListener(new ItemListener() {            public void itemStateChanged(ItemEvent itemEvent) {                ioPrefs.putBoolean("reportWarnings",                        cbReportIOWarnings.isSelected());            }        });        cbGridAA.addItemListener(new ItemListener() {            public void itemStateChanged(ItemEvent itemEvent) {                displayPrefs.putBoolean("gridAntialias", cbGridAA.isSelected());            }        });        undoDepth.addChangeListener(new ChangeListener() {            public void stateChanged(ChangeEvent changeEvent) {                prefs.putInt("undoDepth", undoDepth.intValue());            }        });        gridOpacitySlider.addChangeListener(new ChangeListener() {            public void stateChanged(ChangeEvent changeEvent) {                displayPrefs.putInt("gridOpacity", gridOpacitySlider.getValue());            }        });        //gridColor.addChangeListener(...);        rbEmbedInTiles.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent actionEvent) {                savingPrefs.putBoolean("embedImages",                        rbEmbedInTiles.isSelected());            }        });        rbEmbedInSet.addActionListener(new ActionListener() {            public void actionPerformed(ActionEvent actionEvent) {                savingPrefs.putBoolean("tileSetImages",                        rbEmbedInSet.isSelected());            }        });        rbEmbedInTiles.setEnabled(false);        rbEmbedInSet.setEnabled(false);        //gridColor.setName("tiled.grid.color");    }