javax.swing.JTextField#addFocusListener ( )源码实例Demo

下面列出了javax.swing.JTextField#addFocusListener ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: nanoleaf-desktop   文件: SingleEntryDialog.java
public SingleEntryDialog(Component parent, String entryLabel,
		String buttonLabel, ActionListener buttonListener)
{
	super();
	
	entry = new JTextField(entryLabel);
	entry.setForeground(Color.WHITE);
	entry.setBackground(Color.DARK_GRAY);
	entry.setBorder(new LineBorder(Color.GRAY));
	entry.setCaretColor(Color.WHITE);
	entry.setFont(new Font("Tahoma", Font.PLAIN, 22));
	entry.addFocusListener(new TextFieldFocusListener(entry));
	contentPanel.add(entry, "cell 0 1, grow, gapx 2 2");
	
	JButton btnConfirm = new ModernButton(buttonLabel);
	btnConfirm.setFont(new Font("Tahoma", Font.PLAIN, 18));
	btnConfirm.addActionListener(buttonListener);
	contentPanel.add(btnConfirm, "cell 0 3, alignx center");
	
	JLabel spacer = new JLabel(" ");
	contentPanel.add(spacer, "cell 0 4");
	
	finalize(parent);
	
	btnConfirm.requestFocus();
}
 
源代码2 项目: gcs   文件: Search.java
/**
 * Creates the search panel.
 *
 * @param target The search target.
 */
public Search(SearchTarget target) {
    mTarget = target;

    mFilterField = new JTextField(10);
    mFilterField.getDocument().addDocumentListener(this);
    mFilterField.addKeyListener(this);
    mFilterField.addFocusListener(this);
    mFilterField.setToolTipText(Text.wrapPlainTextForToolTip(I18n.Text("Enter text here and press RETURN to select all matching items")));
    // This client property is specific to Mac OS X
    mFilterField.putClientProperty("JTextField.variant", "search");
    mFilterField.setMinimumSize(new Dimension(60, mFilterField.getPreferredSize().height));
    add(mFilterField);

    mHits = new JLabel();
    mHits.setToolTipText(Text.wrapPlainTextForToolTip(I18n.Text("The number of matches found")));
    adjustHits();
    add(mHits);

    FlexRow row = new FlexRow();
    row.add(mFilterField);
    row.add(mHits);
    row.apply(this);
}
 
源代码3 项目: netbeans   文件: SpecialkeyPanel.java
/** Creates new form SpecialkeyPanel */
public SpecialkeyPanel(final Popupable parent, JTextField target) {
    this.parent = parent;
    this.target = target;
    initComponents();

    target.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(FocusEvent e) {
            parent.hidePopup();
        }
    });

    downButton.addActionListener(this);
    enterButton.addActionListener(this);
    escButton.addActionListener(this);
    leftButton.addActionListener(this);
    rightButton.addActionListener(this);
    tabButton.addActionListener(this);
    upButton.addActionListener(this);
    wheelUpButton.addActionListener(this);
    wheelDownButton.addActionListener(this);
}
 
源代码4 项目: CodenameOne   文件: CellEditorAdapter.java
public CellEditorAdapter(PropertyEditor editor) {
  this.editor = editor;
  Component component = editor.getCustomEditor();
  if (component instanceof JTextField) {
    JTextField field = (JTextField)component;
    field.addFocusListener(new SelectOnFocus());
    field.addActionListener(new CommitEditing());
    field.registerKeyboardAction(
      new CancelEditing(),
      KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
      JComponent.WHEN_FOCUSED);
  }

  // when the editor notifies a change, commit the changes
  editor.addPropertyChangeListener(new PropertyChangeListener() {
    public void propertyChange(PropertyChangeEvent evt) {       
      stopCellEditing();
    }
  });
}
 
源代码5 项目: opt4j   文件: Query.java
/**
 * Create a single-line entry box with the specified name, label, default
 * value, and background color. To control the width of the box, call
 * setTextWidth() first.
 * 
 * @param name
 *            The name used to identify the entry (when accessing the
 *            entry).
 * @param label
 *            The label to attach to the entry.
 * @param defaultValue
 *            Default value to appear in the entry box.
 * @param background
 *            The background color.
 * @param foreground
 *            The foreground color.
 */
public void addLine(String name, String label, String defaultValue, Color background, Color foreground) {
	JLabel lbl = new JLabel(label + ": ");
	lbl.setBackground(_background);

	JTextField entryBox = new JTextField(defaultValue, _width);
	entryBox.setBackground(background);
	entryBox.setForeground(foreground);
	_addPair(name, lbl, entryBox, entryBox);

	// Add the listener last so that there is no notification
	// of the first value.
	entryBox.addActionListener(new QueryActionListener(name));

	// Add a listener for loss of focus. When the entry gains
	// and then loses focus, listeners are notified of an update,
	// but only if the value has changed since the last notification.
	// FIXME: Unfortunately, Java calls this listener some random
	// time after the window has been closed. It is not even a
	// a queued event when the window is closed. Thus, we have
	// a subtle bug where if you enter a value in a line, do not
	// hit return, and then click on the X to close the window,
	// the value is restored to the original, and then sometime
	// later, the focus is lost and the entered value becomes
	// the value of the parameter. I don't know of any workaround.
	entryBox.addFocusListener(new QueryFocusListener(name));
}
 
源代码6 项目: opt4j   文件: Query.java
public QueryColorChooser(String name, String defaultColor) {
	super(BoxLayout.X_AXIS);
	// _defaultColor = defaultColor;
	_entryBox = new JTextField(defaultColor, _width);

	JButton button = new JButton("Choose");
	button.addActionListener(this);
	add(_entryBox);
	add(button);

	// Add the listener last so that there is no notification
	// of the first value.
	_entryBox.addActionListener(new QueryActionListener(name));

	// Add a listener for loss of focus. When the entry gains
	// and then loses focus, listeners are notified of an update,
	// but only if the value has changed since the last notification.
	// FIXME: Unfortunately, Java calls this listener some random
	// time after the window has been closed. It is not even a
	// a queued event when the window is closed. Thus, we have
	// a subtle bug where if you enter a value in a line, do not
	// hit return, and then click on the X to close the window,
	// the value is restored to the original, and then sometime
	// later, the focus is lost and the entered value becomes
	// the value of the parameter. I don't know of any workaround.
	_entryBox.addFocusListener(new QueryFocusListener(name));

	_name = name;
}
 
源代码7 项目: netbeans   文件: ConfigurationsComboModel.java
@Override
public void actionPerformed(ActionEvent ae) {
    JComboBox combo = (JComboBox) ae.getSource();
    combo.setEditable(true);
    JTextField editorComponent = (JTextField) combo.getEditor().getEditorComponent();
    editorComponent.addFocusListener(this);
    editorComponent.addKeyListener(this);
    combo.setSelectedItem(lastSelected);
    combo.addPopupMenuListener(this);
}
 
源代码8 项目: netbeans   文件: ConfigurationsComboModel.java
@Override
public void actionPerformed(ActionEvent ae) {
    currentActiveItem = this;
    
    JComboBox combo = (JComboBox) ae.getSource();
    combo.setEditable(true);
    JTextField editorComponent = (JTextField) combo.getEditor().getEditorComponent();
    editorComponent.addFocusListener(this);
    editorComponent.addKeyListener(this);
    combo.setSelectedItem(lastSelected);
    combo.addPopupMenuListener(this);
}
 
源代码9 项目: gcs   文件: EquipmentModifierEditor.java
private void createWeightAdjustmentField(Container labelParent, Container fieldParent) {
    mWeightAmountField = new JTextField("-999,999,999.00");
    UIUtilities.setToPreferredSizeOnly(mWeightAmountField);
    mWeightAmountField.setText(mRow.getWeightAdjType().format(mRow.getWeightAdjAmount(), mRow.getDataFile().defaultWeightUnits(), true));
    mWeightAmountField.setToolTipText(I18n.Text("The weight modifier"));
    mWeightAmountField.setEnabled(mIsEditable);
    mWeightAmountField.addActionListener(this);
    mWeightAmountField.addFocusListener(this);
    labelParent.add(new LinkedLabel("", mWeightAmountField));
    fieldParent.add(mWeightAmountField);
}
 
源代码10 项目: gcs   文件: EquipmentEditor.java
private JTextField createWeightField(Container labelParent, Container fieldParent, String title, WeightValue value, String tooltip, int maxDigits) {
    JTextField field = new JTextField(Text.makeFiller(maxDigits, '9') + Text.makeFiller(maxDigits / 3, ',') + ".");
    UIUtilities.setToPreferredSizeOnly(field);
    field.setText(value.toString());
    field.setToolTipText(Text.wrapPlainTextForToolTip(tooltip));
    field.setEnabled(mIsEditable);
    field.addActionListener(this);
    field.addFocusListener(this);
    labelParent.add(new LinkedLabel(title, field));
    fieldParent.add(field);
    return field;
}
 
源代码11 项目: gcs   文件: EquipmentEditor.java
@SuppressWarnings("unused")
private JTextField createIntegerNumberField(Container labelParent, Container fieldParent, String title, int value, String tooltip, int maxDigits) {
    JTextField field = new JTextField(Text.makeFiller(maxDigits, '9') + Text.makeFiller(maxDigits / 3, ','));
    UIUtilities.setToPreferredSizeOnly(field);
    field.setText(Numbers.format(value));
    field.setToolTipText(Text.wrapPlainTextForToolTip(tooltip));
    field.setEnabled(mIsEditable);
    new NumberFilter(field, false, false, true, maxDigits);
    field.addActionListener(this);
    field.addFocusListener(this);
    labelParent.add(new LinkedLabel(title, field));
    fieldParent.add(field);
    return field;
}
 
源代码12 项目: FlatLaf   文件: FlatSpinnerUI.java
private void addEditorFocusListener( JComponent editor ) {
	JTextField textField = getEditorTextField( editor );
	if( textField != null )
		textField.addFocusListener( getHandler() );
}
 
源代码13 项目: jeveassets   文件: JTagsDialog.java
public JTagsDialog(Program program) {
	super(program, "", Images.TAG_GRAY.getImage());

	ListenerClass listener = new ListenerClass();

	JLabel jLabel = new JLabel(GuiShared.get().tagsNewMsg());

	jTextField = new JTextField();
	jTextField.addFocusListener(listener);
	jTextField.addCaretListener(listener);

	jColor = new JButton();

	colorPicker = new ColorPicker(getDialog(), jColor);
	jColor.addFocusListener(listener);
	jColor.setActionCommand(TagsDialogAction.SHOW_COLOR.name());
	jColor.addActionListener(listener);

	jOK = new JButton(GuiShared.get().ok());
	jOK.setActionCommand(TagsDialogAction.OK.name());
	jOK.addActionListener(listener);
	jOK.addFocusListener(listener);

	JButton jCancel = new JButton(GuiShared.get().cancel());
	jCancel.setActionCommand(TagsDialogAction.CANCEL.name());
	jCancel.addActionListener(listener);
	jCancel.addFocusListener(listener);

	layout.setHorizontalGroup(
		layout.createParallelGroup(GroupLayout.Alignment.CENTER)
			.addComponent(jLabel, 250, 250, Integer.MAX_VALUE)
			.addGroup(layout.createSequentialGroup()
				.addComponent(jTextField, 200, 200, 200)
				.addComponent(jColor, 30, 30, 30)
			)
			.addGroup(layout.createSequentialGroup()
				.addComponent(jOK, Program.getButtonsWidth(), Program.getButtonsWidth(), Program.getButtonsWidth())
				.addComponent(jCancel, Program.getButtonsWidth(), Program.getButtonsWidth(), Program.getButtonsWidth())
			)
	);
	layout.setVerticalGroup(
		layout.createSequentialGroup()
			.addComponent(jLabel, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
			.addGroup(layout.createParallelGroup()
				.addComponent(jTextField, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
				.addComponent(jColor, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
			)
			.addGroup(layout.createParallelGroup()
				.addComponent(jOK, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
				.addComponent(jCancel, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
			)
	);
}
 
源代码14 项目: jeveassets   文件: GeneralSettingsPanel.java
public GeneralSettingsPanel(final Program program, final SettingsDialog optionsDialog) {
	super(program, optionsDialog, DialoguesSettings.get().general(),  Images.DIALOG_SETTINGS.getIcon());

	jEnterFilters = new JCheckBox(DialoguesSettings.get().enterFilter());

	jHighlightSelectedRow = new JCheckBox(DialoguesSettings.get().highlightSelectedRow());

	jFocusEveOnline = new JCheckBox(DialoguesSettings.get().focusEveOnline());

	JLabel jFocusEveOnlineLinuxHelp = new JLabel(DialoguesSettings.get().focusEveOnlineLinuxHelp());
	jFocusEveOnlineLinuxHelp.setVisible(Platform.isLinux());
	JTextField jFocusEveOnlineLinuxCmd = new JTextField(DialoguesSettings.get().focusEveOnlineLinuxCmd());
	jFocusEveOnlineLinuxCmd.addFocusListener(new FocusAdapter() {
		@Override
		public void focusGained(FocusEvent e) {
			jFocusEveOnlineLinuxCmd.selectAll();
		}
	});
	jFocusEveOnlineLinuxCmd.setEditable(false);
	jFocusEveOnlineLinuxCmd.setVisible(Platform.isLinux());

	layout.setHorizontalGroup(
		layout.createParallelGroup(GroupLayout.Alignment.LEADING)
			.addComponent(jEnterFilters)
			.addComponent(jHighlightSelectedRow)
			.addComponent(jFocusEveOnline)
			.addGroup(layout.createSequentialGroup()
				.addGap(30)
				.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
					.addComponent(jFocusEveOnlineLinuxHelp)
					.addComponent(jFocusEveOnlineLinuxCmd)
				)
			)
	);
	layout.setVerticalGroup(
		layout.createSequentialGroup()
			.addComponent(jEnterFilters, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
			.addComponent(jHighlightSelectedRow, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
			.addComponent(jFocusEveOnline, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
			.addComponent(jFocusEveOnlineLinuxHelp, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
			.addComponent(jFocusEveOnlineLinuxCmd, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
	);
}
 
源代码15 项目: FoxTelem   文件: CameraTab.java
protected void addBottomFilter() {
		JLabel displayNumber1 = new JLabel("Displaying last");
		displayNumber2 = new JTextField();
		displayNumber2.setColumns(4);
		JLabel displayNumber3 = new JLabel("images decoded");
		displayNumber1.setFont(new Font("SansSerif", Font.PLAIN, 10));
		displayNumber3.setFont(new Font("SansSerif", Font.PLAIN, 10));
		displayNumber1.setBorder(new EmptyBorder(5, 2, 5, 10) ); // top left bottom right
		displayNumber3.setBorder(new EmptyBorder(5, 2, 5, 10) ); // top left bottom right
		//displayNumber2.setMinimumSize(new Dimension(50, 14));
		//displayNumber2.setMaximumSize(new Dimension(50, 14));
		displayNumber2.setText(Integer.toString(maxThumbnails));
		displayNumber2.addActionListener(this);
		bottomPanel.add(displayNumber1);
		bottomPanel.add(displayNumber2);
		bottomPanel.add(displayNumber3);
		
		lblFromReset = new JLabel("   from Reset  ");
		lblFromReset.setFont(new Font("SansSerif", Font.PLAIN, 10));
		bottomPanel.add(lblFromReset);
		
		textFromReset = new JTextField();
		bottomPanel.add(textFromReset);
		textFromReset.setText(Integer.toString(START_RESET));

		textFromReset.setColumns(8);
		textFromReset.addActionListener(this);
		textFromReset.addFocusListener(this);
		
		lblFromUptime = new JLabel("   from Uptime  ");
		lblFromUptime.setFont(new Font("SansSerif", Font.PLAIN, 10));
		bottomPanel.add(lblFromUptime);
		
		textFromUptime = new JTextField();
		bottomPanel.add(textFromUptime);

		textFromUptime.setText(Long.toString(START_UPTIME));
		textFromUptime.setColumns(8);
//		textFromUptime.setPreferredSize(new Dimension(50,14));
		textFromUptime.addActionListener(this);
		textFromUptime.addFocusListener(this);
		
	}
 
源代码16 项目: jeveassets   文件: AccountSeparatorTableCell.java
public AccountSeparatorTableCell(final AccountManagerDialog accountManagerDialog, final ActionListener actionListener, final JTable jTable, final SeparatorList<OwnerType> separatorList) {
	super(jTable, separatorList);
	this.accountManagerDialog = accountManagerDialog;

	defaultColor = jPanel.getBackground();

	ListenerClass listener = new ListenerClass();

	jSeparatorLabel = new JLabel();
	jSeparatorLabel.setBackground(jTable.getBackground());
	jSeparatorLabel.setOpaque(true);
	jSeparatorLabel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, jTable.getGridColor()));
	jAccountType = new JLabel();

	jEdit = new JButton(DialoguesAccount.get().edit());
	jEdit.setOpaque(false);
	jEdit.setActionCommand(AccountCellAction.EDIT.name());
	jEdit.addActionListener(actionListener);

	jMigrate = new JButton(DialoguesAccount.get().migrate());
	jMigrate.setOpaque(false);
	jMigrate.setActionCommand(AccountCellAction.MIGRATE.name());
	jMigrate.addActionListener(actionListener);

	jDelete = new JButton(DialoguesAccount.get().delete());
	jDelete.setOpaque(false);
	jDelete.setActionCommand(AccountCellAction.DELETE.name());
	jDelete.addActionListener(actionListener);

	jAccountName = new JTextField();
	jAccountName.addFocusListener(listener);
	jAccountName.setBorder(null);
	jAccountName.setOpaque(false);
	jAccountName.setActionCommand(AccountCellAction.ACCOUNT_NAME.name());
	jAccountName.addActionListener(listener);

	jInvalidLabel = new JLabel(DialoguesAccount.get().accountInvalid());

	jExpiredLabel = new JLabel(DialoguesAccount.get().accountExpired());

	jMigratedLabel = new JLabel(DialoguesAccount.get().accountMigrated());

	jCanMigrateLabel = new JLabel(DialoguesAccount.get().accountCanMigrate());

	jSpaceLabel = new JLabel();

	layout.setHorizontalGroup(
		layout.createParallelGroup()
			.addComponent(jSeparatorLabel, 0, 0, Integer.MAX_VALUE)
			.addGroup(layout.createSequentialGroup()
				.addComponent(jExpand)
				.addGap(1)
				.addComponent(jEdit, Program.getButtonsWidth(), Program.getButtonsWidth(), Program.getButtonsWidth())
				.addComponent(jMigrate, Program.getButtonsWidth(), Program.getButtonsWidth(), Program.getButtonsWidth())
				.addComponent(jDelete, Program.getButtonsWidth(), Program.getButtonsWidth(), Program.getButtonsWidth())
				.addGap(5)
				.addComponent(jAccountType)
				.addGap(5)
				.addComponent(jAccountName, 20, 20, Integer.MAX_VALUE)
				.addGap(10)
				.addComponent(jExpiredLabel)
				.addComponent(jInvalidLabel)
				.addComponent(jMigratedLabel)
				.addComponent(jCanMigrateLabel)
				.addComponent(jSpaceLabel, 20, 20, Integer.MAX_VALUE)
			)
	);
	layout.setVerticalGroup(
		layout.createSequentialGroup()
			.addComponent(jSeparatorLabel, jTable.getRowHeight(), jTable.getRowHeight(), jTable.getRowHeight())
			.addGap(1)
			.addGroup(layout.createParallelGroup()
				.addComponent(jExpand, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
				.addComponent(jAccountType, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
				.addComponent(jEdit, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
				.addComponent(jMigrate, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
				.addComponent(jDelete, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
				.addComponent(jAccountName, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
				.addComponent(jInvalidLabel, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
				.addComponent(jExpiredLabel, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
				.addComponent(jMigratedLabel, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
				.addComponent(jCanMigrateLabel, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
				.addComponent(jSpaceLabel, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight())
			)
			.addGap(2)
	);
}
 
源代码17 项目: netbeans   文件: NameChangeSupport.java
public NameChangeSupport(JTextField control) {
    this.control = control;
    control.getDocument().addDocumentListener(this);
    control.addFocusListener(this);
}
 
源代码18 项目: netbeans   文件: NewConnectionPanel.java
public FocusAdapter(String targetToken, JTextField textField) {
    this.targetToken = targetToken;
    textField.addFocusListener(this);
}
 
源代码19 项目: netbeans   文件: DataViewUI.java
private void initToolbarWest(JToolBar toolbar, ActionListener outputListener, boolean nbOutputComponent) {

        if (!nbOutputComponent) {
            JButton[] btns = getEditButtons();
            for (JButton btn : btns) {
                if (btn != null) {
                    toolbar.add(btn);
                }
            }
        }

        toolbar.addSeparator(new Dimension(10, 10));

        //add refresh button
        URL url = getClass().getResource(IMG_PREFIX + "refresh.png"); // NOI18N
        refreshButton = new JButton(new ImageIcon(url));
        refreshButton.setToolTipText(NbBundle.getMessage(DataViewUI.class, "TOOLTIP_refresh"));
        refreshButton.addActionListener(outputListener);
        processButton(refreshButton);

        toolbar.add(refreshButton);

        //add limit row label
        limitRow = new JLabel(NbBundle.getMessage(DataViewUI.class, "LBL_max_rows"));
        limitRow.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 8));
        toolbar.add(limitRow);

        //add refresh text field
        refreshField = new JTextField(5);
        refreshField.setMinimumSize(refreshField.getPreferredSize());
        refreshField.setMaximumSize(refreshField.getPreferredSize());
        refreshField.addFocusListener(new FocusAdapter() {
            @Override
            public void focusGained(FocusEvent e) {
                refreshField.selectAll();
            }
        });
        refreshField.addActionListener(outputListener);
        toolbar.add(refreshField);
        toolbar.addSeparator(new Dimension(10, 10));

        JLabel fetchedRowsNameLabel = new JLabel(NbBundle.getMessage(DataViewUI.class, "LBL_fetched_rows"));
        fetchedRowsNameLabel.getAccessibleContext().setAccessibleName(NbBundle.getMessage(DataViewUI.class, "LBL_fetched_rows"));
        fetchedRowsNameLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
        toolbar.add(fetchedRowsNameLabel);
        fetchedRowsLabel = new JLabel();
        toolbar.add(fetchedRowsLabel);

        toolbar.addSeparator(new Dimension(10, 10));
    }
 
源代码20 项目: WhiteRabbit   文件: FilterDialog.java
public FilterDialog(Window parentWindow){
	
	super(parentWindow,"Filter",ModalityType.MODELESS);		
	this.setResizable(false);
	this.setLocation(parentWindow.getX()+parentWindow.getWidth()/2, parentWindow.getY()+100);

	contentPane.setLayout(layout);
	sourceSearchField = new JTextField(30);
	sourceSearchField.setName("Source");
	
	targetSearchField = new JTextField(30);
	targetSearchField.setName("Target");

	
	// Add key listener to send search string as it's being typed
	sourceSearchField.addKeyListener(new SearchListener() );
	sourceSearchField.addFocusListener(new SearchFocusListener());		
	JLabel sourceLabel = new JLabel("Filter Source:",JLabel.TRAILING);
	JButton sourceClearBtn = new JButton("Clear");
	contentPane.add(sourceLabel);
	contentPane.add(sourceSearchField);
	sourceClearBtn.addActionListener(this);
	sourceClearBtn.setActionCommand("Clear Source");
	sourceClearBtn.setFocusable(false);
	contentPane.add(sourceClearBtn);
	
	targetSearchField.addKeyListener(new SearchListener() );
	targetSearchField.addFocusListener(new SearchFocusListener());
	JLabel targetLabel = new JLabel("Filter Target:",JLabel.TRAILING);
	JButton targetClearBtn = new JButton("Clear");
	contentPane.add(targetLabel);
	contentPane.add(targetSearchField);		
	targetClearBtn.addActionListener(this);
	targetClearBtn.setActionCommand("Clear Target");
	targetClearBtn.setFocusable(false);
	contentPane.add(targetClearBtn);
	
	layout.putConstraint(SpringLayout.WEST, sourceLabel, 5, SpringLayout.WEST, contentPane);
	layout.putConstraint(SpringLayout.NORTH, sourceLabel, 5, SpringLayout.NORTH, contentPane);
	
	layout.putConstraint(SpringLayout.WEST, sourceSearchField, 5, SpringLayout.EAST, sourceLabel);
	layout.putConstraint(SpringLayout.NORTH, sourceSearchField, 5, SpringLayout.NORTH, contentPane);
	
	layout.putConstraint(SpringLayout.WEST, sourceClearBtn, 5, SpringLayout.EAST, sourceSearchField);
	layout.putConstraint(SpringLayout.NORTH, sourceClearBtn, 5, SpringLayout.NORTH, contentPane);
	
	layout.putConstraint(SpringLayout.WEST, targetLabel, 5, SpringLayout.WEST, contentPane);
	layout.putConstraint(SpringLayout.NORTH, targetLabel, 10, SpringLayout.SOUTH, sourceLabel);
		
	layout.putConstraint(SpringLayout.WEST, targetSearchField, 0, SpringLayout.WEST, sourceSearchField);
	layout.putConstraint(SpringLayout.NORTH, targetSearchField, 0, SpringLayout.NORTH, targetLabel);
	
	layout.putConstraint(SpringLayout.WEST, targetClearBtn, 5, SpringLayout.EAST, targetSearchField);
	layout.putConstraint(SpringLayout.NORTH, targetClearBtn, 0, SpringLayout.NORTH, targetSearchField);		

	
	layout.putConstraint(SpringLayout.SOUTH, contentPane, 5, SpringLayout.SOUTH, targetLabel);
	layout.putConstraint(SpringLayout.NORTH, contentPane, 5, SpringLayout.NORTH, sourceLabel);
	layout.putConstraint(SpringLayout.WEST, contentPane, 5, SpringLayout.WEST, sourceLabel);
	layout.putConstraint(SpringLayout.EAST, contentPane, 5, SpringLayout.EAST, targetClearBtn);
	
	this.pack();
}