Java Code Examples for javax.swing.JTextField#setName()

The following examples show how to use javax.swing.JTextField#setName() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: dummydroid   File: PropertyForm.java    License: Apache License 2.0 6 votes vote down vote up
public PropertyForm(NavigateAction forwardAction, NavigateAction backwardAction) {
	super(forwardAction, backwardAction);
	setLayout(new GridBagLayout());

	GridBagConstraints gbc = new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST,
			GridBagConstraints.NONE, new Insets(4, 4, 4, 4), 4, 4);

	for (String name : listProperties()) {
		gbc.gridx = 0;
		gbc.fill = GridBagConstraints.NONE;
		add(new JLabel(getDisplayName(name)), gbc);

		gbc.gridx = 1;
		gbc.fill = GridBagConstraints.HORIZONTAL;
		JTextField entry = new JTextField(20);
		entry.setName(name);
		add(entry, gbc);
		gbc.gridy++;
	}
	gbc.weightx = 1;
	gbc.weighty = 1;
	gbc.gridwidth = 2;
	gbc.gridy++;
	gbc.gridx = 0;
	add(new JLabel(""), gbc);
}
 
Example 2
private JPanel createParameterPanel() {
    final JLabel label = new JLabel("Parameters:");

    parameters = new JTextField(10);
    parameters.setName(WebDriverSampler.PARAMETERS);
    label.setLabelFor(parameters);

    final JPanel parameterPanel = new JPanel(new BorderLayout(5, 0));
    parameterPanel.add(label, BorderLayout.WEST);
    parameterPanel.add(parameters, BorderLayout.CENTER);

    return parameterPanel;
}
 
Example 3
Source Project: ermasterr   File: CustomCellEditor.java    License: Apache License 2.0 5 votes vote down vote up
public CustomCellEditor(final JTable table) {
    super(new JTextField());

    final JTextField component = (JTextField) getComponent();
    component.setName("Table.editor");

    component.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(final KeyEvent e) {
            if ((e.getModifiers() & InputEvent.CTRL_MASK) != 0) {
                if (e.getKeyCode() == ';') {
                    final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
                    component.setText(format.format(new Date()));

                } else if (e.getKeyCode() == 'v' || e.getKeyCode() == 'V') {
                    component.paste();

                } else if (e.getKeyCode() == 'c' || e.getKeyCode() == 'C') {
                    component.copy();

                } else if (e.getKeyCode() == 'x' || e.getKeyCode() == 'X') {
                    component.cut();

                }
            }

            super.keyPressed(e);
        }

    });

    component.setComponentPopupMenu(new TextFieldPopupMenu());
}
 
Example 4
private void addStatementSeparatorTextField(JPanel panel, int col, int row)
{
	GridBagConstraints c = new GridBagConstraints();
	c.gridx = col;
	c.gridy = row;
	c.ipadx = 40; // Increases component width by 40 pixels
	c.insets = new Insets(5, 5, 0, 0);
	c.anchor = GridBagConstraints.WEST;
	statementSeparatorTextField = new JTextField(10);
	statementSeparatorTextField.setName("statementSeparatorTextField");

	statementSeparatorTextField.setHorizontalAlignment(JTextField.RIGHT);
	statementSeparatorTextField.setToolTipText(i18n.STMT_SEP_LABEL_TT);
	panel.add(statementSeparatorTextField, c);
}
 
Example 5
private void addLineCommentTextField(JPanel panel, int col, int row)
{
	GridBagConstraints c = new GridBagConstraints();
	c.gridx = col;
	c.gridy = row;
	c.ipadx = 40; // Increases component width by 40 pixels
	c.insets = new Insets(5, 5, 0, 0);
	c.anchor = GridBagConstraints.WEST;
	lineCommentTextField = new JTextField(10);
	lineCommentTextField.setName("lineCommentTextField");
	lineCommentTextField.setHorizontalAlignment(JTextField.RIGHT);
	lineCommentTextField.setToolTipText(i18n.LINE_COMMENT_LABEL_TT);
	panel.add(lineCommentTextField, c);
}
 
Example 6
Source Project: erflute   File: CustomCellEditor.java    License: Apache License 2.0 5 votes vote down vote up
public CustomCellEditor(final JTable table) {
    super(new JTextField());

    final JTextField component = (JTextField) getComponent();
    component.setName("Table.editor");

    component.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {
            if ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0) {
                if (e.getKeyCode() == ';') {
                    final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
                    component.setText(format.format(new Date()));
                } else if (e.getKeyCode() == 'v' || e.getKeyCode() == 'V') {
                    component.paste();
                } else if (e.getKeyCode() == 'c' || e.getKeyCode() == 'C') {
                    component.copy();
                } else if (e.getKeyCode() == 'x' || e.getKeyCode() == 'X') {
                    component.cut();
                }
            }

            super.keyPressed(e);
        }
    });

    component.setComponentPopupMenu(new TextFieldPopupMenu());
}
 
Example 7
Source Project: opensim-gui   File: MeasurementSetPanel.java    License: Apache License 2.0 5 votes vote down vote up
public void updateContent() {
   // Currently only supports updating names
   for(int i=0; i<measurementSetModel.getMeasurementSet().getSize(); i++) {
      JTextField textField = getMeasurementNameTextField(i);
      textField.setName(measurementSetModel.getMeasurementSet().get(i).getName());
   }
}
 
Example 8
private JPanel createPortPanel() {
    portField = new JTextField(HttpSimpleTableControl.DEFAULT_PORT_S, 8);
    portField.setName(HttpSimpleTableControl.PORT);

    JLabel label = new JLabel(JMeterUtils.getResString("port")); 
    label.setLabelFor(portField);

    datasetDirectoryField = new JTextField(
            HttpSimpleTableControl.DEFAULT_DATA_DIR, 8);
    datasetDirectoryField.setName(HttpSimpleTableControl.DATA_DIR);

    JLabel ddLabel = new JLabel("Dataset directory:"); 
    ddLabel.setLabelFor(datasetDirectoryField);

    timestampChkBox = new JCheckBox();
    timestampChkBox.setSelected(HttpSimpleTableControl.DEFAULT_TIMESTAMP);
    timestampChkBox.setName(HttpSimpleTableControl.TIMESTAMP);

    JLabel tsLabel = new JLabel("Timestamp:"); 
    tsLabel.setLabelFor(timestampChkBox);

    HorizontalPanel panel = new HorizontalPanel();
    panel.setBorder(BorderFactory.createTitledBorder(
            BorderFactory.createEtchedBorder(), "Settings")); 

    panel.add(label);
    panel.add(portField);

    panel.add(ddLabel);
    panel.add(datasetDirectoryField);

    panel.add(tsLabel);
    panel.add(timestampChkBox);

    panel.add(Box.createHorizontalStrut(10));

    return panel;
}
 
Example 9
Source Project: ermaster-b   File: CustomCellEditor.java    License: Apache License 2.0 5 votes vote down vote up
public CustomCellEditor(final JTable table) {
	super(new JTextField());

	final JTextField component = (JTextField) getComponent();
	component.setName("Table.editor");

	component.addKeyListener(new KeyAdapter() {

		@Override
		public void keyPressed(KeyEvent e) {
			if ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0) {
				if (e.getKeyCode() == ';') {
					SimpleDateFormat format = new SimpleDateFormat(
							"yyyy-MM-dd HH:mm:ss.SSS");
					component.setText(format.format(new Date()));

				} else if (e.getKeyCode() == 'v' || e.getKeyCode() == 'V') {
					component.paste();

				} else if (e.getKeyCode() == 'c' || e.getKeyCode() == 'C') {
					component.copy();

				} else if (e.getKeyCode() == 'x' || e.getKeyCode() == 'X') {
					component.cut();

				}
			}

			super.keyPressed(e);
		}

	});

	component.setComponentPopupMenu(new TextFieldPopupMenu());
}
 
Example 10
/**
 * Creates a new Options object.
 */
public Options ()
{
    // Preload constant units
    UnitManager.getInstance().preLoadUnits();

    frame = new JFrame();
    frame.setName("optionsFrame");
    frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    JComponent framePane = (JComponent) frame.getContentPane();
    framePane.setLayout(new BorderLayout());

    InputMap inputMap = framePane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    ActionMap actionMap = framePane.getActionMap();

    JToolBar toolBar = new JToolBar(JToolBar.HORIZONTAL);
    framePane.add(toolBar, BorderLayout.NORTH);

    // Dump button
    JButton dumpButton = new JButton(dumping);
    dumpButton.setName("optionsDumpButton");
    toolBar.add(dumpButton);

    // Check button
    JButton checkButton = new JButton(checking);
    checkButton.setName("optionsCheckButton");
    toolBar.add(checkButton);

    // Reset button
    JButton resetButton = new JButton(resetting);
    resetButton.setName("optionsResetButton");
    toolBar.add(resetButton);

    // Some space
    toolBar.add(Box.createHorizontalStrut(100));

    toolBar.add(new JLabel("Search:"));

    // Back button
    JButton backButton = new JButton(backSearch);
    backButton.setName("optionsBackButton");
    toolBar.add(backButton);
    inputMap.put(KeyStroke.getKeyStroke("shift F3"), "backSearch");
    actionMap.put("backSearch", backSearch);

    // Search entry
    searchField = new JTextField();
    searchField.setMaximumSize(new Dimension(200, 28));
    searchField.setName("optionsSearchField");
    searchField.setHorizontalAlignment(JTextField.LEFT);
    toolBar.add(searchField);
    inputMap.put(KeyStroke.getKeyStroke("ctrl F"), "find");
    actionMap.put("find", find);
    searchField.getDocument().addDocumentListener(docListener);

    // Forward button
    JButton forwardButton = new JButton(forwardSearch);
    forwardButton.setName("optionsForwardButton");
    toolBar.add(forwardButton);

    // Some space, message field
    toolBar.add(Box.createHorizontalStrut(10));
    toolBar.add(msgLabel);

    // TreeTable
    UnitModel unitModel = new UnitModel();
    unitTreeTable = new UnitTreeTable(unitModel);
    framePane.add(new JScrollPane(unitTreeTable), BorderLayout.CENTER);

    // Needed to process user input when RETURN/ENTER is pressed
    inputMap.put(KeyStroke.getKeyStroke("ENTER"), "forwardSearch");
    inputMap.put(KeyStroke.getKeyStroke("F3"), "forwardSearch");
    actionMap.put("forwardSearch", forwardSearch);

    // Resources injection
    ResourceMap resource = Application.getInstance().getContext().getResourceMap(getClass());
    resource.injectComponents(frame);

    // Make sure the search entry field gets the focus at creation time
    frame.addWindowListener(new WindowAdapter()
    {
        @Override
        public void windowOpened (WindowEvent e)
        {
            searchField.requestFocus();
        }
    });
}
 
Example 11
private void fillUi(JPanel canvas) {
  JLabel projectDataDirLabel = new JBLabel("Project data directory:");

  canvas.setPreferredSize(ProjectViewUi.getContainerSize());

  projectDataDirField = new TextFieldWithBrowseButton();
  projectDataDirField.setName("project-data-dir-field");
  projectDataDirField.addBrowseFolderListener(
      "",
      buildSystemName + " project data directory",
      null,
      PROJECT_FOLDER_DESCRIPTOR,
      TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT,
      false);
  final String dataDirToolTipText = "Directory in which to store the project's metadata.";
  projectDataDirField.setToolTipText(dataDirToolTipText);
  projectDataDirLabel.setToolTipText(dataDirToolTipText);

  canvas.add(projectDataDirLabel, UiUtil.getLabelConstraints(0));
  canvas.add(projectDataDirField, UiUtil.getFillLineConstraints(0));

  JLabel projectNameLabel = new JLabel("Project name:");
  projectNameField = new JTextField();
  final String projectNameToolTipText = "Project display name.";
  projectNameField.setToolTipText(projectNameToolTipText);
  projectNameField.setName("project-name-field");
  projectNameLabel.setToolTipText(projectNameToolTipText);
  canvas.add(projectNameLabel, UiUtil.getLabelConstraints(0));
  canvas.add(projectNameField, UiUtil.getFillLineConstraints(0));

  JLabel defaultNameLabel = new JLabel("Infer name from:");
  workspaceDefaultNameOption = new JRadioButton("Workspace");
  branchDefaultNameOption = new JRadioButton("Branch");
  importDirectoryDefaultNameOption = new JRadioButton("Import Directory");

  workspaceDefaultNameOption.setToolTipText("Infer default name from the workspace name");
  branchDefaultNameOption.setToolTipText(
      "Infer default name from the current branch of your workspace");
  importDirectoryDefaultNameOption.setToolTipText(
      "Infer default name from the directory used to import your project view");

  workspaceDefaultNameOption.addItemListener(e -> inferDefaultNameModeSelectionChanged());
  branchDefaultNameOption.addItemListener(e -> inferDefaultNameModeSelectionChanged());
  importDirectoryDefaultNameOption.addItemListener(e -> inferDefaultNameModeSelectionChanged());
  ButtonGroup buttonGroup = new ButtonGroup();
  buttonGroup.add(workspaceDefaultNameOption);
  buttonGroup.add(branchDefaultNameOption);
  buttonGroup.add(importDirectoryDefaultNameOption);
  canvas.add(defaultNameLabel, UiUtil.getLabelConstraints(0));
  canvas.add(workspaceDefaultNameOption, UiUtil.getLabelConstraints(0));
  canvas.add(branchDefaultNameOption, UiUtil.getLabelConstraints(0));
  canvas.add(importDirectoryDefaultNameOption, UiUtil.getLabelConstraints(0));
  canvas.add(new JPanel(), UiUtil.getFillLineConstraints(0));

  projectViewUi.fillUi(canvas);
}
 
Example 12
Source Project: azure-devops-intellij   File: CheckoutForm.java    License: MIT License 4 votes vote down vote up
/**
 * Method generated by IntelliJ IDEA GUI Designer
 * >>> IMPORTANT!! <<<
 * DO NOT edit this method OR call it in your code!
 *
 * @noinspection ALL
 */
private void $$$setupUI$$$() {
    createUIComponents();
    contentPanel = new JPanel();
    contentPanel.setLayout(new GridLayoutManager(10, 3, new Insets(0, 0, 0, 0), -1, -1));
    contentPanel.setName("");
    final JLabel label1 = new JLabel();
    this.$$$loadLabelText$$$(label1, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("VsoCheckoutForm.SelectRepository"));
    contentPanel.add(label1, new GridConstraints(1, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    repositoryFilter = new JTextField();
    repositoryFilter.setName("");
    contentPanel.add(repositoryFilter, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
    final JLabel label2 = new JLabel();
    this.$$$loadLabelText$$$(label2, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("VsoCheckoutForm.ParentDirectory"));
    contentPanel.add(label2, new GridConstraints(5, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    final JLabel label3 = new JLabel();
    this.$$$loadLabelText$$$(label3, ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("VsoCheckoutForm.DirectoryName"));
    contentPanel.add(label3, new GridConstraints(7, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    directoryName = new JTextField();
    directoryName.setName("");
    contentPanel.add(directoryName, new GridConstraints(8, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
    contentPanel.add(userAccountPanel, new GridConstraints(0, 0, 1, 3, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
    repositoryTableScrollPane = new JScrollPane();
    contentPanel.add(repositoryTableScrollPane, new GridConstraints(3, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
    repositoryTable = new JTable();
    repositoryTable.setFillsViewportHeight(true);
    repositoryTable.setName("");
    repositoryTable.setShowHorizontalLines(false);
    repositoryTable.setShowVerticalLines(false);
    repositoryTableScrollPane.setViewportView(repositoryTable);
    parentDirectory = new TextFieldWithBrowseButton();
    contentPanel.add(parentDirectory, new GridConstraints(6, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
    helpPanel = new HelpPanel();
    helpPanel.setHelpText(ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("VsoLookupHelp.helpText"));
    helpPanel.setPopupText(ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("VsoLookupHelp.Instructions"));
    contentPanel.add(helpPanel, new GridConstraints(4, 0, 1, 3, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
    advancedCheckBox = new JCheckBox();
    advancedCheckBox.setText("example text");
    contentPanel.add(advancedCheckBox, new GridConstraints(9, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
    busySpinner = new BusySpinnerPanel();
    contentPanel.add(busySpinner, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
    refreshButton.setToolTipText(ResourceBundle.getBundle("com/microsoft/alm/plugin/idea/ui/tfplugin").getString("CheckoutDialog.RefreshButton.ToolTip"));
    contentPanel.add(refreshButton, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, 1, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
}
 
Example 13
Source Project: seaglass   File: SeaGlassComboBoxUI.java    License: Apache License 2.0 4 votes vote down vote up
public SynthComboBoxEditor() {
    editor = new JTextField("", 9);
    editor.setName("ComboBox.textField");
}
 
Example 14
/**
 * Creates a new Options object.
 */
public Options ()
{
    // Preload constant units
    UnitManager.getInstance()
            .preLoadUnits(Main.class.getName());

    frame = new JFrame();
    frame.setName("optionsFrame");
    frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    frame.getContentPane()
            .setLayout(new BorderLayout());

    JToolBar toolBar = new JToolBar(JToolBar.HORIZONTAL);
    frame.add(toolBar, BorderLayout.NORTH);

    // Dump button
    JButton dumpButton = new JButton(dumping);
    dumpButton.setName("optionsDumpButton");
    toolBar.add(dumpButton);

    // Check button
    JButton checkButton = new JButton(checking);
    checkButton.setName("optionsCheckButton");
    toolBar.add(checkButton);

    // Reset button
    JButton resetButton = new JButton(resetting);
    resetButton.setName("optionsResetButton");
    toolBar.add(resetButton);

    // Some space
    toolBar.add(Box.createHorizontalStrut(100));

    toolBar.add(new JLabel("Search:"));

    // Back button
    JButton backButton = new JButton(backSearch);
    backButton.setName("optionsBackButton");
    toolBar.add(backButton);

    // Search entry
    searchField = new JTextField();
    searchField.setMaximumSize(new Dimension(200, 28));
    searchField.setName("optionsSearchField");
    searchField.setHorizontalAlignment(JTextField.LEFT);
    toolBar.add(searchField);

    // Forward button
    JButton forwardButton = new JButton(forwardSearch);
    forwardButton.setName("optionsForwardButton");
    toolBar.add(forwardButton);

    // TreeTable
    UnitModel unitModel = new UnitModel();
    unitTreeTable = new UnitTreeTable(unitModel);
    frame.add(new JScrollPane(unitTreeTable), BorderLayout.CENTER);

    // Needed to process user input when RETURN/ENTER is pressed
    toolBar.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT)
            .put(KeyStroke.getKeyStroke("ENTER"), "EnterAction");
    toolBar.getActionMap()
            .put("EnterAction", forwardSearch);

    // Resources injection
    ResourceMap resource = Application.getInstance()
            .getContext()
            .getResourceMap(getClass());
    resource.injectComponents(frame);

    // Make sure the search entry field gets the focus at creation time
    frame.addWindowListener(
            new WindowAdapter()
    {
        @Override
        public void windowOpened (WindowEvent e)
        {
            searchField.requestFocus();
        }
    });
}
 
Example 15
Source Project: WhiteRabbit   File: FilterDialog.java    License: Apache License 2.0 4 votes vote down vote up
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();
}
 
Example 16
/**
 * Create "server URL" text field.
 *
 * @return created text field.
 */
private JTextField createServerUrlField() {
  JTextField field = new JTextField();
  field.setName( ComponentLookup.SERVER_URL_FIELD.name() );
  return field;
}
 
Example 17
/**
 * Create "path" test field.
 *
 * @return created text field.
 */
private JTextField createPathField() {
  JTextField field = new JTextField();
  field.setName( ComponentLookup.PATH_FIELD.name() );
  return field;
}