[Japi-cvs] SF.net SVN: japi: [56] trunk/src/app/net/sf/japi/swing
Status: Beta
Brought to you by:
christianhujer
From: <chr...@us...> - 2006-04-14 16:49:31
|
Revision: 56 Author: christianhujer Date: 2006-04-14 09:49:22 -0700 (Fri, 14 Apr 2006) ViewCVS: http://svn.sourceforge.net/japi/?rev=56&view=rev Log Message: ----------- Renamed FileField to JFileField Added Paths: ----------- trunk/src/app/net/sf/japi/swing/JFileField.java Removed Paths: ------------- trunk/src/app/net/sf/japi/swing/FileField.java Deleted: trunk/src/app/net/sf/japi/swing/FileField.java =================================================================== --- trunk/src/app/net/sf/japi/swing/FileField.java 2006-04-14 16:35:28 UTC (rev 55) +++ trunk/src/app/net/sf/japi/swing/FileField.java 2006-04-14 16:49:22 UTC (rev 56) @@ -1,76 +0,0 @@ -/* 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; - -import java.awt.BorderLayout; -import java.io.File; -import javax.swing.JComponent; -import javax.swing.JTextField; -import javax.swing.JFileChooser; - -/** A class that displays a textfield for a file and a button for choosing the file. - * TODO - * @author <a href="mailto:Chr...@it...">Christian Hujer</a> - */ -public final class FileField extends JComponent { - - /** The JTextField used to display the filename. - * @serial include - */ - private final JTextField textField; - - /** Create a FileField. - * @param size Number of columns for the textfield part. - */ - public FileField(final int size) { - textField = new JTextField(size); - final JFileChooserButton button = new JFileChooserButton(textField, JFileChooser.FILES_ONLY); - setLayout(new BorderLayout()); - add(textField, BorderLayout.CENTER); - add(button, BorderLayout.LINE_END); - } - - /** Create a FileField. - * @param size Number of columns for the textfield part. - */ - public FileField(final JFileChooser fileChooser, final int size) { - textField = new JTextField(size); - final JFileChooserButton button = new JFileChooserButton(fileChooser, textField, JFileChooser.FILES_ONLY); - setLayout(new BorderLayout()); - add(textField, BorderLayout.CENTER); - add(button, BorderLayout.LINE_END); - } - - /** Return the selected file. - * @return selected file - */ - public File getSelectedFile() { - return new File(textField.getText()); - } - - /** Return the selected filename. - * @return selected filename - */ - public String getSelectedFilename() { - return textField.getText(); - } - -} // class FileField Copied: trunk/src/app/net/sf/japi/swing/JFileField.java (from rev 54, trunk/src/app/net/sf/japi/swing/FileField.java) =================================================================== --- trunk/src/app/net/sf/japi/swing/JFileField.java (rev 0) +++ trunk/src/app/net/sf/japi/swing/JFileField.java 2006-04-14 16:49:22 UTC (rev 56) @@ -0,0 +1,75 @@ +/* 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; + +import java.awt.BorderLayout; +import java.io.File; +import javax.swing.JComponent; +import javax.swing.JTextField; +import javax.swing.JFileChooser; + +/** A class that displays a textfield for a file and a button for choosing the file. + * @author <a href="mailto:Chr...@it...">Christian Hujer</a> + */ +public final class JFileField extends JComponent { + + /** The JTextField used to display the filename. + * @serial include + */ + private final JTextField textField; + + /** Create a FileField. + * @param size Number of columns for the textfield part. + */ + public JFileField(final int size) { + textField = new JTextField(size); + final JFileChooserButton button = new JFileChooserButton(textField, JFileChooser.FILES_ONLY); + setLayout(new BorderLayout()); + add(textField, BorderLayout.CENTER); + add(button, BorderLayout.LINE_END); + } + + /** Create a FileField. + * @param size Number of columns for the textfield part. + */ + public JFileField(final JFileChooser fileChooser, final int size) { + textField = new JTextField(size); + final JFileChooserButton button = new JFileChooserButton(fileChooser, textField, JFileChooser.FILES_ONLY); + setLayout(new BorderLayout()); + add(textField, BorderLayout.CENTER); + add(button, BorderLayout.LINE_END); + } + + /** Return the selected file. + * @return selected file + */ + public File getSelectedFile() { + return new File(textField.getText()); + } + + /** Return the selected filename. + * @return selected filename + */ + public String getSelectedFilename() { + return textField.getText(); + } + +} // class FileField Property changes on: trunk/src/app/net/sf/japi/swing/JFileField.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |