[Japi-cvs] SF.net SVN: japi: [188] libs/swing-prefs/trunk
Status: Beta
Brought to you by:
christianhujer
From: <chr...@us...> - 2006-10-14 12:50:33
|
Revision: 188 http://svn.sourceforge.net/japi/?rev=188&view=rev Author: christianhujer Date: 2006-10-14 05:50:10 -0700 (Sat, 14 Oct 2006) Log Message: ----------- Copied preferences classes from historic to swing-prefs subproject. Added Paths: ----------- libs/swing-prefs/trunk/src/ libs/swing-prefs/trunk/src/net/ libs/swing-prefs/trunk/src/net/sf/ libs/swing-prefs/trunk/src/net/sf/japi/ libs/swing-prefs/trunk/src/net/sf/japi/swing/ libs/swing-prefs/trunk/src/net/sf/japi/swing/prefs/ libs/swing-prefs/trunk/src/net/sf/japi/swing/prefs/AbstractPrefs.java libs/swing-prefs/trunk/src/net/sf/japi/swing/prefs/PreferencesGroup.java libs/swing-prefs/trunk/src/net/sf/japi/swing/prefs/PreferencesPane.java libs/swing-prefs/trunk/src/net/sf/japi/swing/prefs/Prefs.java libs/swing-prefs/trunk/src/net/sf/japi/swing/prefs/action.properties libs/swing-prefs/trunk/src/net/sf/japi/swing/prefs/action_de.properties libs/swing-prefs/trunk/src/net/sf/japi/swing/prefs/package.html Copied: libs/swing-prefs/trunk/src/net/sf/japi/swing/prefs/AbstractPrefs.java (from rev 181, historic/trunk/src/app/net/sf/japi/swing/prefs/AbstractPrefs.java) =================================================================== --- libs/swing-prefs/trunk/src/net/sf/japi/swing/prefs/AbstractPrefs.java (rev 0) +++ libs/swing-prefs/trunk/src/net/sf/japi/swing/prefs/AbstractPrefs.java 2006-10-14 12:50:10 UTC (rev 188) @@ -0,0 +1,145 @@ +/* JAPI - (Yet another (hopefully) useful) Java API + * + * Copyright (C) 2004-2006 Christian Hujer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +package net.sf.japi.swing.prefs; + +import java.net.URL; +import java.awt.LayoutManager; +import javax.swing.Icon; +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.BoxLayout; +import net.sf.japi.swing.ColumnLayout; + +/** Abstract preferences implementation. + * Subclass this. + * Build the panel in your constructor. + * The default layout of an AbstractPrefs is {@link BoxLayout} with {@link BoxLayout#Y_AXIS}. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public abstract class AbstractPrefs extends JPanel implements Prefs { + + /** The icon to be displayed in the list where the user can choose amongst preferences. + * @see #getListLabelIcon() + * @serial include + */ + private Icon listLabelIcon; + + /** The label text to be displayed in the list where the user can choose amongst preferences. + * @see #getListLabelText() + * @serial include + */ + private String listLabelText; + + /** The title text to be displayed as title for this prefs module. + * @see #getLabelText() + * @serial include + */ + private String labelText; + + /** The Help URL. + * @serial include + */ + private URL helpURL; + + /** The Help text (HTML). + * @serial include + */ + private String helpText; + + /** Constructor. */ + protected AbstractPrefs() { + super(new ColumnLayout()); + // setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); + } + + /** Constructor that allows setting the initial layout. + * @param layout Layout + */ + protected AbstractPrefs(final LayoutManager layout) { + super(layout); + } + + /** {@inheritDoc} */ + public final JComponent getEditComponent() { + return this; + } + + /** {@inheritDoc} */ + public final Icon getListLabelIcon() { + return listLabelIcon; + } + + /** Set the icon that is to be displayed in the list where the user can choose amongst preferences. + * @param listLabelIcon icon + */ + protected final void setListLabelIcon(final Icon listLabelIcon) { + this.listLabelIcon = listLabelIcon; + } + + /** {@inheritDoc} */ + public final String getListLabelText() { + return listLabelText; + } + + /** Set the label text that is to be displayed in the list where the user can choose amongst preferences. + * @param listLabelText text + */ + protected final void setListLabelText(final String listLabelText) { + this.listLabelText = listLabelText; + } + + /** {@inheritDoc} */ + public final String getLabelText() { + return labelText; + } + + /** Set the title text that is to be displayed as title for this prefs module. + * @param labelText text + */ + protected final void setLabelText(final String labelText) { + this.labelText = labelText; + } + + /** {@inheritDoc} */ + public final URL getHelpURL() { + return helpURL; + } + + /** Set the help URL. + * @param helpURL Help URL + */ + protected final void setHelpURL(final URL helpURL) { + this.helpURL = helpURL; + } + + /** {@inheritDoc} */ + public final String getHelpText() { + return helpText; + } + + /** Set the help text. + * @param helpText Help text + */ + protected final void setHelpText(final String helpText) { + this.helpText = helpText; + } + +} // class AbstractPrefs Copied: libs/swing-prefs/trunk/src/net/sf/japi/swing/prefs/PreferencesGroup.java (from rev 181, historic/trunk/src/app/net/sf/japi/swing/prefs/PreferencesGroup.java) =================================================================== --- libs/swing-prefs/trunk/src/net/sf/japi/swing/prefs/PreferencesGroup.java (rev 0) +++ libs/swing-prefs/trunk/src/net/sf/japi/swing/prefs/PreferencesGroup.java 2006-10-14 12:50:10 UTC (rev 188) @@ -0,0 +1,74 @@ +/* JAPI - (Yet another (hopefully) useful) Java API + * + * Copyright (C) 2004-2006 Christian Hujer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +package net.sf.japi.swing.prefs; + +import static java.util.Arrays.asList; +import java.util.Iterator; +import java.util.List; +import javax.swing.AbstractListModel; + +/** A PreferencesGroup is an ordered set of {@link Prefs}, for use with {@link PreferencesPane}. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class PreferencesGroup extends AbstractListModel implements Iterable<Prefs> { + + /** The preferences modules. + * @serial include + */ + private final List<Prefs> prefs; + + /** The preferences title. + * @serial include + */ + private final String title; + + /** Create a Preferences group. + * @param prefs Preferences modules to initially add + * @param title Title for Preferences + */ + public PreferencesGroup(final String title, final Prefs... prefs) { + this.title = title; + this.prefs = asList(prefs); + } + + /** Get the title. + * @return title + */ + public String getTitle() { + return title; + } + + /** {@inheritDoc} */ + public Iterator<Prefs> iterator() { + return prefs.iterator(); + } + + /** {@inheritDoc} */ + public int getSize() { + return prefs.size(); + } + + /** {@inheritDoc} */ + public Prefs getElementAt(final int index) { + return prefs.get(index); + } + +} // class PreferencesGroup Copied: libs/swing-prefs/trunk/src/net/sf/japi/swing/prefs/PreferencesPane.java (from rev 181, historic/trunk/src/app/net/sf/japi/swing/prefs/PreferencesPane.java) =================================================================== --- libs/swing-prefs/trunk/src/net/sf/japi/swing/prefs/PreferencesPane.java (rev 0) +++ libs/swing-prefs/trunk/src/net/sf/japi/swing/prefs/PreferencesPane.java 2006-10-14 12:50:10 UTC (rev 188) @@ -0,0 +1,290 @@ +/* JAPI - (Yet another (hopefully) useful) Java API + * + * Copyright (C) 2004-2006 Christian Hujer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +package net.sf.japi.swing.prefs; + +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Component; +import java.util.HashMap; +import java.util.Map; +import javax.swing.Action; +import static javax.swing.BorderFactory.createEmptyBorder; +import javax.swing.Box; +import javax.swing.DefaultListCellRenderer; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JDialog; +import javax.swing.JList; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.SwingConstants; +import javax.swing.border.Border; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import net.sf.japi.swing.ActionFactory; + +/** Panel to display preferences. + * @serial exclude This class is not intended to be serialized. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +@SuppressWarnings({"FieldAccessedSynchronizedAndUnsynchronized"}) +public final class PreferencesPane extends JOptionPane implements ListSelectionListener { + + /** Action Factory. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.japi.swing.prefs"); + + /** A map for DIALOGS that are already displaying. + * This map is used to prevent the dialog for the same PreferencesGroup be shown twice within the same application. + */ + private static final Map<PreferencesGroup,JDialog> DIALOGS = new HashMap<PreferencesGroup,JDialog>(); + + /** The group of preferences to display. */ + private final PreferencesGroup prefs; + + /** The currently selected preferences module. */ + private Prefs currentPref; + + /** Action for help. */ + private final Action helpAction = ACTION_FACTORY.createAction(false, "help" , this); + + /** Action for defaults. */ + private final Action defaultsAction = ACTION_FACTORY.createAction(false, "defaults", this); + + /** Action for ok. */ + private final Action okAction = ACTION_FACTORY.createAction(false, "ok" , this); + + /** Action for apply. */ + private final Action applyAction = ACTION_FACTORY.createAction(false, "apply" , this); + + /** Action for revert. */ + private final Action revertAction = ACTION_FACTORY.createAction(false, "revert" , this); + + /** Action for cancel. */ + private final Action cancelAction = ACTION_FACTORY.createAction(false, "cancel" , this); + + /** CardLayout for switching between prefs modules. + * @see #cardPanel + */ + private final CardLayout cards = new CardLayout(); + + /** Panel where the CardLayout for switching between prefs modules is used. + * @see #cards + */ + private final JPanel cardPanel = new JPanel(cards); + + /** Show Preferences. + * @param parentComponent determines the Frame in which the dialog is displayed; if <code>null</code>, or if the <code>parentComponent</code> has + * no <code>Frame</code>, a default <code>Frame</code> is used + * @param prefs PreferencesGroup to be displayed + * @param modal <code>true</code> if the displayed dialog should be modal, otherwise <code>false</code> + */ + public static void showPreferencesDialog(final Component parentComponent, final PreferencesGroup prefs, final boolean modal) { + synchronized (DIALOGS) { + if (DIALOGS.containsKey(prefs)) { + DIALOGS.get(prefs).toFront(); + } else { + final PreferencesPane pane = new PreferencesPane(prefs); + final JDialog dialog = pane.createDialog(parentComponent, prefs.getTitle()); + DIALOGS.put(prefs, dialog); + dialog.setResizable(true); + dialog.setModal(modal); + dialog.setVisible(true); + } + } + } + + /** Create a PreferencesPane. + * @param prefs PreferencesGroup to create panel for + */ + private PreferencesPane(final PreferencesGroup prefs) { + this.prefs = prefs; + setMessage(createMessage()); + setOptions(createOptions()); + } + + /** Create the Message. + * @return subpanel + */ + private JComponent createMessage() { + final JPanel panel = new JPanel(new BorderLayout()); + panel.add(createList(), BorderLayout.WEST); + panel.add(createPanel(), BorderLayout.CENTER); + return panel; + } + + /** Create the list. + * @return list + */ + private JComponent createList() { + final JList list = new JList(prefs); + list.setCellRenderer(new PrefsListCellRenderer()); + list.setSelectedIndex(0); + list.addListSelectionListener(this); + return new JScrollPane(list); + } + + /** Create the Panel. + * @return panel + */ + private JComponent createPanel() { + int index = 0; + for (final Prefs pref : prefs) { + cardPanel.add(Integer.toString(index++), pref.getEditComponent()); + } + currentPref = prefs.getElementAt(0); + return cardPanel; + } + + /** Create the Options. + * @return options + */ + private Object[] createOptions() { + return new Object[] { + new JButton(helpAction), + new JButton(defaultsAction), + Box.createHorizontalStrut(50), + new JButton(okAction), + new JButton(applyAction), + Box.createHorizontalStrut(50), + new JButton(revertAction), + new JButton(cancelAction), + }; + } + + /** {@inheritDoc} */ + public void valueChanged(final ListSelectionEvent e) { + if (e.getValueIsAdjusting()) { + return; + } + final int index = ((JList) e.getSource()).getSelectedIndex(); + final Prefs newPref = prefs.getElementAt(index); + //noinspection ObjectEquality + if (currentPref == newPref) { + return; + } + if (currentPref.isChanged()) { + final int result = ACTION_FACTORY.showConfirmDialog(this, YES_NO_CANCEL_OPTION, QUESTION_MESSAGE, "prefsChanged", currentPref.getListLabelText()); + switch (result) { + case CLOSED_OPTION: + case CANCEL_OPTION: + ((JList) e.getSource()).setSelectedValue(currentPref, true); + return; + case YES_OPTION: + currentPref.apply(); + break; + case NO_OPTION: + default: + } + } + currentPref = newPref; + cards.show(cardPanel, Integer.toString(index)); + } + + /** Action method for cancel. + * @used + */ + public void cancel() { + setValue(CANCEL_OPTION); + } + + /** {@inheritDoc} */ + @Override public void setValue(final Object newValue) { + super.setValue(newValue); + //noinspection ObjectEquality + if (newValue != null && newValue != UNINITIALIZED_VALUE) { + synchronized (DIALOGS) { + DIALOGS.remove(prefs).dispose(); + } + } + } + + /** Action method for defaults. + * @used + */ + public void defaults() { + currentPref.defaults(); + } + + /** Action method for help. + * @used + */ + public void help() { + // TODO + } + + /** Action method for ok. + * @used + */ + @SuppressWarnings({"InstanceMethodNamingConvention"}) + public void ok() { + apply(); + setValue(OK_OPTION); + } + + /** Action method for apply. + * @used + */ + public void apply() { + if (currentPref.isChanged()) { + currentPref.apply(); + } + } + + /** Action method for revert. + * @used + */ + public void revert() { + if (currentPref.isChanged()) { + currentPref.revert(); + } + } + + /** Class for rendering preferences list items. */ + private static final class PrefsListCellRenderer extends DefaultListCellRenderer { + + /** The border. + * For some reason it gets lost when set in the initializer, so we store it and set it each time the renderer is used. + */ + private Border border = createEmptyBorder(10, 10, 10, 10); + + /** Create a PrefsListCellRenderer. */ + PrefsListCellRenderer() { + setHorizontalTextPosition(SwingConstants.CENTER); + setVerticalTextPosition(SwingConstants.BOTTOM); + setHorizontalAlignment(SwingConstants.CENTER); + setVerticalAlignment(SwingConstants.CENTER); + } + + /** {@inheritDoc} */ + @SuppressWarnings({"ReturnOfThis"}) + @Override public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { + super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + setBorder(border); + final Prefs pref = (Prefs) value; + setText(pref.getListLabelText()); + setIcon(pref.getListLabelIcon()); + return this; + } + + } // class PrefsListCellRenderer + +} // class PreferencesPane Copied: libs/swing-prefs/trunk/src/net/sf/japi/swing/prefs/Prefs.java (from rev 181, historic/trunk/src/app/net/sf/japi/swing/prefs/Prefs.java) =================================================================== --- libs/swing-prefs/trunk/src/net/sf/japi/swing/prefs/Prefs.java (rev 0) +++ libs/swing-prefs/trunk/src/net/sf/japi/swing/prefs/Prefs.java 2006-10-14 12:50:10 UTC (rev 188) @@ -0,0 +1,85 @@ +/* JAPI - (Yet another (hopefully) useful) Java API + * + * Copyright (C) 2004-2006 Christian Hujer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +package net.sf.japi.swing.prefs; + +import java.net.URL; +import javax.swing.Icon; +import javax.swing.JComponent; + +/** Interface that is to be implemented by classes that provide preferences. + * <p /> + * Often, implementations of this interface will subclass JComponent or JPanel. + * In that case {@link #getEditComponent()} will <code>return this</code>. + * {@link AbstractPrefs} provides a useful basic implementation of this interface. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public interface Prefs { + + /** Apply the changes in the UI to get into effect / be stored. */ + void apply(); + + /** Revert the preferences to the default values. */ + void defaults(); + + /** Provide a component for editing the prefs. + * The edit component MUST NOT automatically change preferences itself. + * Preferences MUST only changed when the method {@link #apply()} is invoked. + * @return component for editing the prefs + */ + JComponent getEditComponent(); + + /** Provide help (HTML). + * This method will only be queried if {@link #getHelpURL()} returns <code>null</code>. + * This method may return <code>null</code> as well, which means that this prefs does not provide any help. + * @return help text (HTML) or <code>null</code> + */ + String getHelpText(); + + /** Provide help. + * This method may return <code>null</code> in which case the method {@link #getHelpText()} will be queried instead. + * @return help url or <code>null</code> + */ + URL getHelpURL(); + + /** Provide text to be displayed as title for this prefs module. + * @return title of this prefs module + */ + String getLabelText(); + + /** Provide an icon to be displayed in the list where the user can choose amongst preferences. + * @return icon to be displayed in the list or <code>null</code> if no icon is available + */ + Icon getListLabelIcon(); + + /** Provide a label to be displayed in the list where the user can choose amongst preferences. + * @return text to be displayed in the list + */ + String getListLabelText(); + + /** Check whether there are unsaved changes. + * @return <code>true</code> if there are unsaved changes, otherwise <code>false</code> + */ + boolean isChanged(); + + /** Revert the preferences to the previously stored settings. */ + void revert(); + +} // class Prefs Copied: libs/swing-prefs/trunk/src/net/sf/japi/swing/prefs/action.properties (from rev 181, historic/trunk/src/app/net/sf/japi/swing/prefs/action.properties) =================================================================== --- libs/swing-prefs/trunk/src/net/sf/japi/swing/prefs/action.properties (rev 0) +++ libs/swing-prefs/trunk/src/net/sf/japi/swing/prefs/action.properties 2006-10-14 12:50:10 UTC (rev 188) @@ -0,0 +1,29 @@ +# JAPI - (Yet another (hopefully) useful) Java API +# +# Copyright (C) 2004-2006 Christian Hujer +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. +# + + +help.text=Help +defaults.text=Defaults +ok.text=Ok +apply.text=Apply +revert.text=Revert +cancel.text=Cancel +prefsChanged.title=Prefs changed +prefsChanged.message=You have made changes to\nyour preferences for {0}.\n\nApply (keep) your changes? Copied: libs/swing-prefs/trunk/src/net/sf/japi/swing/prefs/action_de.properties (from rev 181, historic/trunk/src/app/net/sf/japi/swing/prefs/action_de.properties) =================================================================== --- libs/swing-prefs/trunk/src/net/sf/japi/swing/prefs/action_de.properties (rev 0) +++ libs/swing-prefs/trunk/src/net/sf/japi/swing/prefs/action_de.properties 2006-10-14 12:50:10 UTC (rev 188) @@ -0,0 +1,29 @@ +# JAPI - (Yet another (hopefully) useful) Java API +# +# Copyright (C) 2004-2006 Christian Hujer +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. +# + + +help.text=Hilfe +defaults.text=Voreinstellungen +ok.text=Ok +apply.text=Anwenden +revert.text=Zur\xFCcksetzen +cancel.text=Abbrechen +prefsChanged.title=Voreinstellungen ge\xE4ndert +prefsChanged.message=Sie haben Ihre Einstellungen\nzu {0} ge\xE4ndert.\n\n\xC4nderungen anwenden (behalten)? Copied: libs/swing-prefs/trunk/src/net/sf/japi/swing/prefs/package.html (from rev 181, historic/trunk/src/app/net/sf/japi/swing/prefs/package.html) =================================================================== --- libs/swing-prefs/trunk/src/net/sf/japi/swing/prefs/package.html (rev 0) +++ libs/swing-prefs/trunk/src/net/sf/japi/swing/prefs/package.html 2006-10-14 12:50:10 UTC (rev 188) @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- JAPI - (Yet another (hopefully) useful) Java API + - + - Copyright (C) 2004-2006 Christian Hujer + - + - This program is free software; you can redistribute it and/or + - modify it under the terms of the GNU General Public License as + - published by the Free Software Foundation; either version 2 of the + - License, or (at your option) any later version. + - + - This program is distributed in the hope that it will be useful, but + - WITHOUT ANY WARRANTY; without even the implied warranty of + - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + - General Public License for more details. + - + - You should have received a copy of the GNU General Public License + - along with this program; if not, write to the Free Software + - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + - 02111-1307, USA. + --> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de"> + <head> + <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> + <meta name="Date" content="$Date: 2006-04-03 23:00:14 +0200 (Mon, 03 Apr 2006) $" /> + <title>net.sf.japi.swing.prefs</title> + </head> + <body> + <p> + This package contains useful Swing extension classes about handling user interfaces to user preferences. + </p> + <p> + The recommended way in using this package is: + </p> + <ol> + <li> + Create instances of {@link net.sf.japi.swing.prefs.Prefs} + <p /> + For this, you can do either or both: + <ul> + <li>subclass {@link net.sf.japi.swing.prefs.AbstractPrefs}</li> + <li>implement {@link net.sf.japi.swing.prefs.Prefs}</li> + </ul> + The most important methods of {@link net.sf.japi.swing.prefs.Prefs} are {@link net.sf.japi.swing.prefs.Prefs#isChanged()}, + {@link net.sf.japi.swing.prefs.Prefs#defaults()}, {@link net.sf.japi.swing.prefs.Prefs#revert()} and + {@link net.sf.japi.swing.prefs.Prefs#apply()}. + You implement these methods to get notified about the user's wishes about his / her input. + </li> + <li> + Create a {@link net.sf.japi.swing.prefs.PreferencesGroup} that contains these Prefs objects. + </li> + <li> + Invoke + {@link net.sf.japi.swing.prefs.PreferencesPane#showPreferencesDialog(java.awt.Component,net.sf.japi.swing.prefs.PreferencesGroup,boolean)} + to let the user change the preferences. + </li> + </ol> + </body> +</html> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |