001    
002    /*****************************************************************************
003     *
004     * jBudget.
005     * Copyright (C) 2006  Dmitri Petrov
006     *
007     * This program is free software: you can redistribute it and/or modify
008     * it under the terms of the GNU General Public License as published by
009     * the Free Software Foundation, either version 3 of the License, or
010     * (at your option) any later version.
011     *
012     * This program is distributed in the hope that it will be useful,
013     * but WITHOUT ANY WARRANTY; without even the implied warranty of
014     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
015     * GNU General Public License for more details.
016     *
017     * You should have received a copy of the GNU General Public License
018     * along with this program.  If not, see <http://www.gnu.org/licenses/>.
019     *
020     *****************************************************************************/
021    
022    
023    /*
024     * PreferencesEditorDialog.java
025     *
026     * Created on August 30, 2007, 10:59 PM
027     */
028    
029    package org.jbudget.gui;
030    
031    import java.awt.BorderLayout;
032    import java.awt.Dimension;
033    import javax.swing.JComponent;
034    import javax.swing.JFrame;
035    import javax.swing.SwingUtilities;
036    
037    /**
038     * @author petrov
039     */
040    public class PreferencesEditorDialog extends BasicDialog
041    {
042      /** Editor component. */
043      private final PreferencesEditorPanel preferencesEditor = 
044                                         new PreferencesEditorPanel();
045      
046      private final JFrame parent;
047      
048      /** Creates a new instance of PreferencesEditorDialog */
049      public PreferencesEditorDialog(JFrame parent, boolean modular)
050      {
051        super(parent, modular);
052        this.parent = parent;
053        inputPanel.add(preferencesEditor, BorderLayout.CENTER);
054        setPreferredSize(new Dimension(500, 600));
055        pack();
056        setLocationRelativeTo(parent);
057        setVisible(true);
058      }
059      
060      /** Action that occurs when the OK button is pressed. */
061      public boolean okAction() throws Exception
062      {
063        preferencesEditor.applySelections();
064        if (parent != null)
065          SwingUtilities.updateComponentTreeUI(parent);
066        return true;
067      }
068      
069    }