use of com.intellij.ui.components.JBTextField in project intellij-community by JetBrains.
the class AbstractDescriptionAwareSchemesPanel method createInfoComponent.
@NotNull
@Override
protected JPanel createInfoComponent() {
JPanel panel = new JPanel();
myLayout = new CardLayout();
panel.setLayout(myLayout);
myDescriptionTextField = new JBTextField();
myDescriptionTextField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
applyDescription();
}
});
myDescriptionTextField.registerKeyboardAction(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
showDescription();
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
IdeFocusManager.getGlobalInstance().requestFocus(getConfigurableFocusComponent(), true);
});
}
}, ESC_KEY_STROKE, JComponent.WHEN_FOCUSED);
myDescriptionTextField.registerKeyboardAction(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
applyDescription();
IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
IdeFocusManager.getGlobalInstance().requestFocus(getConfigurableFocusComponent(), true);
});
}
}, ENTER_KEY_STROKE, JComponent.WHEN_FOCUSED);
myDescriptionLabel = new DescriptionLabel();
new ClickListener() {
@Override
public boolean onClick(@NotNull MouseEvent event, int clickCount) {
if (clickCount != 2) {
return false;
}
editDescription(myDescriptionLabel.getText());
return true;
}
}.installOn(myDescriptionLabel);
myWarningLabel = new JLabel();
panel.add(myDescriptionTextField, EDIT_DESCRIPTION_CARD);
panel.add(myDescriptionLabel, SHOW_DESCRIPTION_CARD);
panel.add(myWarningLabel, ERROR_CARD);
myLayout.show(panel, ERROR_CARD);
return panel;
}
use of com.intellij.ui.components.JBTextField in project intellij-plugins by JetBrains.
the class KarmaRunConfigurationEditor method createBrowsersTextField.
@NotNull
private static JTextField createBrowsersTextField() {
JBTextField browsers = new JBTextField();
StatusText emptyStatusText = browsers.getEmptyText();
emptyStatusText.setText("comma-separated list of browsers (e.g. Chrome,ChromeCanary,Firefox)");
return browsers;
}
use of com.intellij.ui.components.JBTextField in project google-cloud-intellij by GoogleCloudPlatform.
the class ProjectSelectionDialog method createUIComponents.
@VisibleForTesting
void createUIComponents() {
addAccountButton = new JButton();
addAccountButton.addActionListener((event) -> Services.getLoginService().logIn());
// prepare table model and rendering.
projectListTable = new JBTable();
projectListTableModel = new ProjectListTableModel();
projectListTable.setModel(projectListTableModel);
projectListTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
projectListTable.getSelectionModel().addListSelectionListener(e -> validateProjectSelection());
FilteredTextTableCellRenderer filterRenderer = new FilteredTextTableCellRenderer();
projectListTable.setDefaultRenderer(Object.class, filterRenderer);
DoubleClickListener tableDoubleClickListener = new DoubleClickListener() {
@Override
protected boolean onDoubleClick(MouseEvent event) {
dialogWrapper.clickDefaultButton();
return true;
}
};
tableDoubleClickListener.installOn(projectListTable);
// filter rows based on text field content.
filterTextField = new JBTextField();
TableRowSorter<TableModel> sorter = new TableRowSorter<>(projectListTableModel);
projectListTable.setRowSorter(sorter);
GeneralFilter filter = new GeneralFilter() {
@Override
protected boolean include(Entry value, int index) {
return value.getStringValue(index).toLowerCase().contains(filterTextField.getText().toLowerCase());
}
};
sorter.setRowFilter(filter);
// on filter types, update row filter and renderer.
filterTextField.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
sorter.allRowsChanged();
filterRenderer.setFilterText(filterTextField.getText());
}
});
refreshAction = new RefreshAction();
// prepare account combobox model and rendering.
accountComboBox = new ComboBox<>();
accountComboBox.setRenderer(new AccountComboBoxRenderer());
accountComboBox.addActionListener((event) -> refreshProjectListUi((CredentialedUser) accountComboBox.getSelectedItem()));
progressBar = new JBProgressBar();
progressBar.setIndeterminate(true);
progressBar.setVisible(false);
// wrapper for center panel that holds either project selection or sign in screen.
centerPanelWrapper = new JPanel(new BorderLayout());
}
use of com.intellij.ui.components.JBTextField in project yii2support by nvlad.
the class MigrationCommandDialog method initComponents.
private void initComponents() {
myPanel = new JPanel(new VerticalLayout(5));
Dimension dimension = new Dimension(500, -1);
myPanel.setMinimumSize(dimension);
myPanel.add(new JLabel("Command Name"));
myCommandField = new JBTextField("migrate");
myPanel.add(myCommandField);
myPanel.add(new JLabel("Table"));
myTableField = new JBTextField("{{%migration}}");
myPanel.add(myTableField);
myPanel.add(new JLabel("Database Component"));
myDbField = new JBTextField("db");
myPanel.add(myDbField);
MigrationService service = MigrationService.getInstance(myProject);
service.sync();
List<String> migrationPaths = MigrationUtil.migrationPaths(service.getMigrations());
Collections.sort(migrationPaths);
myMigrationPathPanel = new StringListEditPanel("Migration Path", migrationPaths);
myMigrationPathPanel.setPreferredSize(new Dimension(-1, 140));
myMigrationPathPanel.getData().add(new TableModelStringEntity("app/migrations"));
myPanel.add(myMigrationPathPanel);
List<String> namespaces = MigrationUtil.migrationPaths(service.getMigrations());
Collections.sort(namespaces);
myMigrationNamespacesPanel = new StringListEditPanel("Migration Namespaces", namespaces);
myMigrationNamespacesPanel.setPreferredSize(new Dimension(-1, 140));
myPanel.add(myMigrationNamespacesPanel);
myUseTablePrefixCheckBox = new JBCheckBox("Use table prefix", false);
myPanel.add(myUseTablePrefixCheckBox);
myIsDefaultCheckBox = new JBCheckBox("Default migration command", false);
myPanel.add(myIsDefaultCheckBox);
}
use of com.intellij.ui.components.JBTextField in project StringManipulation by krasa.
the class AlignToColumnsForm method addTextField.
private JBTextField addTextField(final String lastSeparator) {
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
final JBTextField tf = new JBTextField(lastSeparator);
tf.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
updateComponents();
}
});
tf.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
tf.selectAll();
}
});
}
});
tf.setMaximumSize(new Dimension(Integer.MAX_VALUE, tf.getMinimumSize().height));
tf.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void changedUpdate(DocumentEvent e) {
add();
}
@Override
public void removeUpdate(DocumentEvent e) {
add();
}
@Override
public void insertUpdate(DocumentEvent e) {
add();
}
public void add() {
if (isNotEmpty(tf.getText()) && isLast(panel)) {
addTextField(null);
}
}
});
JButton remove = new JButton(StringManipulationBundle.message("remove"));
remove.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (textfields.getComponentCount() == 1) {
tf.setText("");
} else {
textfields.remove(panel);
textfields.revalidate();
textfields.repaint();
}
submitRenderPreview();
}
});
panel.add(tf);
panel.add(remove);
textfields.add(panel);
textfields.revalidate();
textfields.repaint();
return tf;
}
Aggregations