/** * Factory method. It creates panel with dialog options. Options panel is located at the * center of the dialog's content pane. The implementation can return <code>null</code> * value. In this case there will be no options panel. * * @return center panel */ @Nullable @Override protected JComponent createCenterPanel() { final JPanel centerPanel = new JPanel(new BorderLayout()); centerPanel.setPreferredSize(new Dimension(600, 300)); previewDocument = EditorFactory.getInstance().createDocument(content); preview = Utils.createPreviewEditor(previewDocument, project, false); name = new JBTextField(IgnoreBundle.message("dialog.userTemplate.name.value")); JLabel nameLabel = new JLabel(IgnoreBundle.message("dialog.userTemplate.name")); nameLabel.setBorder(JBUI.Borders.emptyRight(10)); JPanel namePanel = new JPanel(new BorderLayout()); namePanel.add(nameLabel, BorderLayout.WEST); namePanel.add(name, BorderLayout.CENTER); JComponent previewComponent = preview.getComponent(); previewComponent.setBorder(JBUI.Borders.emptyTop(10)); centerPanel.add(namePanel, BorderLayout.NORTH); centerPanel.add(previewComponent, BorderLayout.CENTER); return centerPanel; }
public JBTextField createComponent() { String valueAsString = Objects.toString(setting.getValueAsFloat(), null); JBTextField jbTextField = new JBTextField(valueAsString); applyGenericProperties(jbTextField); return jbTextField; }
@Override protected JComponent createCenterPanel() { nameField = new JBTextField("newRule"); double h = nameField.getSize().getHeight(); nameField.setPreferredSize(new Dimension(250,(int)h)); setTitle("Name the extracted rule"); nameField.selectAll(); return nameField; }
private void createUIComponents() { sonarcloudIcon = new JLabel(SonarLintIcons.icon("SonarCloud")); sonarqubeIcon = new JLabel(SonarLintIcons.icon("SonarQube")); sonarcloudText = SwingHelper.createHtmlViewer(false, null, null, null); sonarqubeText = SwingHelper.createHtmlViewer(false, null, null, null); JBTextField text = new JBTextField(); text.getEmptyText().setText("Example: http://localhost:9000"); urlText = text; nameField = new JBTextField(); nameField.setDocument(new LengthRestrictedDocument(NAME_MAX_LENGTH)); } }
projectKeyTextField = new JBTextField(); projectKeyTextField.getEmptyText().setText("Input project key or search one");
filterTextField = new JBTextField(); TableRowSorter<TableModel> sorter = new TableRowSorter<>(projectListTableModel); projectListTable.setRowSorter(sorter);
public JTextField createComponent() { Setting.ConfigType configType = setting.getConfigType(); String value = setting.getValueAsString(); JTextField jTextField; if (configType == Setting.ConfigType.PASSWORD) { JBPasswordField jbPasswordField = new JBPasswordField(); jbPasswordField.setText(value); jTextField = jbPasswordField; } else { JBTextField jbTextField = new JBTextField(value); jTextField = jbTextField; } applyGenericProperties(jTextField); return jTextField; }