private class UserInputPanel.SearchField
extends java.lang.Object
implements java.awt.event.ActionListener
Modifier and Type | Field and Description |
---|---|
private javax.swing.JButton |
autodetectButton |
private javax.swing.JButton |
browseButton |
private java.lang.String |
checkFilename |
private java.lang.String |
filename |
private InstallerFrame |
parent |
private javax.swing.JComboBox |
pathComboBox |
static int |
RESULT_DIRECTORY
used in constructor - result of search is the directory.
|
static int |
RESULT_FILE
used in constructor - result of search is the whole file name.
|
static int |
RESULT_PARENTDIR
used in constructor - result of search is the parent directory.
|
private int |
resultType |
private int |
searchType |
static int |
TYPE_DIRECTORY
used in constructor - we search for a directory.
|
static int |
TYPE_FILE
used in constructor - we search for a file.
|
Constructor and Description |
---|
UserInputPanel.SearchField(java.lang.String filename,
java.lang.String checkFilename,
InstallerFrame parent,
javax.swing.JComboBox combobox,
javax.swing.JButton autobutton,
javax.swing.JButton browsebutton,
int search_type,
int result_type)
Constructor - initializes the object, adds it as action listener to the "autodetect"
button.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent event)
This is called if one of the buttons has bee pressed.
|
boolean |
autodetect()
perform autodetection
|
boolean |
belongsTo(javax.swing.JComboBox combobox)
Check whether the given combobox belongs to this searchfield.
|
java.lang.String |
getResult()
Return the result of the search according to result type.
|
private boolean |
pathMatches(java.lang.String path)
check whether the given path matches
|
public static final int TYPE_DIRECTORY
public static final int TYPE_FILE
public static final int RESULT_DIRECTORY
public static final int RESULT_FILE
public static final int RESULT_PARENTDIR
private java.lang.String filename
private java.lang.String checkFilename
private javax.swing.JButton autodetectButton
private javax.swing.JButton browseButton
private javax.swing.JComboBox pathComboBox
private int searchType
private int resultType
private InstallerFrame parent
public UserInputPanel.SearchField(java.lang.String filename, java.lang.String checkFilename, InstallerFrame parent, javax.swing.JComboBox combobox, javax.swing.JButton autobutton, javax.swing.JButton browsebutton, int search_type, int result_type)
filename
- the name of the file to search for (might be null for searching
directories)checkFilename
- the name of the file to check when searching for directories (the
checkFilename is appended to a found directory to figure out whether it is the right
directory)combobox
- the JComboBox
holding the list of choices; it should be
editable and contain only Stringsautobutton
- the autodetection button for triggering autodetectionbrowsebutton
- the browse button to look for the filesearch_type
- what to search for - TYPE_FILE or TYPE_DIRECTORYresult_type
- what to return as the result - RESULT_FILE or RESULT_DIRECTORY or
RESULT_PARENTDIRpublic boolean belongsTo(javax.swing.JComboBox combobox)
private boolean pathMatches(java.lang.String path)
public boolean autodetect()
public void actionPerformed(java.awt.event.ActionEvent event)
actionPerformed
in interface java.awt.event.ActionListener
public java.lang.String getResult()