本文整理汇总了Java中org.netbeans.editor.Utilities.createSingleLineEditor方法的典型用法代码示例。如果您正苦于以下问题:Java Utilities.createSingleLineEditor方法的具体用法?Java Utilities.createSingleLineEditor怎么用?Java Utilities.createSingleLineEditor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.editor.Utilities
的用法示例。
在下文中一共展示了Utilities.createSingleLineEditor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addClassNameEditorCC
import org.netbeans.editor.Utilities; //导入方法依赖的package包/类
static Pair<JScrollPane, JEditorPane> addClassNameEditorCC(String mimeType, JComponent comp, String className, String tooltipText) {
JComponent [] editorComponents = Utilities.createSingleLineEditor(mimeType);
JScrollPane sle = (JScrollPane) editorComponents[0];
JEditorPane epClassName = (JEditorPane) editorComponents[1];
epClassName.setText(className);
if (comp != null) {
java.awt.GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
comp.add(sle, gridBagConstraints);
}
sle.setToolTipText(tooltipText);
epClassName.setToolTipText(tooltipText);
return Pair.<JScrollPane, JEditorPane>of(sle, epClassName);
}
示例2: getPanel
import org.netbeans.editor.Utilities; //导入方法依赖的package包/类
public JComponent getPanel() {
if (panel != null) {
return panel;
}
panel = new JPanel();
ResourceBundle bundle = NbBundle.getBundle(WatchPanel.class);
panel.getAccessibleContext ().setAccessibleDescription (bundle.getString ("ACSD_WatchPanel")); // NOI18N
JLabel textLabel = new JLabel();
Mnemonics.setLocalizedText(textLabel, bundle.getString ("CTL_Watch_Name")); // NOI18N
if (expression != null && expression.trim().length() == 0) {
JEditorPane editor = EditorContextDispatcher.getDefault().getMostRecentEditor();
if (editor != null && editor.getDocument() instanceof StyledDocument) {
StyledDocument doc = (StyledDocument) editor.getDocument();
String selectedExpression = getSelectedIdentifier(doc, editor, editor.getCaret ().getDot ());
if (selectedExpression != null) {
expression = selectedExpression;
}
}
}
JComponent [] editorComponents = Utilities.createSingleLineEditor("text/plain");
JScrollPane sp = (JScrollPane) editorComponents[0];
editorPane = (JEditorPane) editorComponents[1];
int h = sp.getPreferredSize().height;
int w = Math.min(70*editorPane.getFontMetrics(editorPane.getFont()).charWidth('a'),
org.openide.windows.WindowManager.getDefault().getMainWindow().getSize().width);
sp.setPreferredSize(new Dimension(w, h));
/*
FontMetrics fm = editorPane.getFontMetrics(editorPane.getFont());
int size = 2*fm.getLeading() + fm.getMaxAscent() + fm.getMaxDescent();
Insets eInsets = editorPane.getInsets();
Insets spInsets = sp.getInsets();
sp.setPreferredSize(new Dimension(30*size,
size +
eInsets.bottom + eInsets.top +
spInsets.bottom + spInsets.top));
*/
textLabel.setBorder (new EmptyBorder (0, 0, 5, 0));
panel.setLayout (new BorderLayout ());
panel.setBorder (new EmptyBorder (11, 12, 1, 11));
panel.add (BorderLayout.NORTH, textLabel);
panel.add (BorderLayout.CENTER, sp);
editorPane.getAccessibleContext ().setAccessibleDescription (bundle.getString ("ACSD_CTL_Watch_Name")); // NOI18N
editorPane.setText (expression);
editorPane.selectAll ();
Runnable editorPaneUpdated = new Runnable() {
@Override
public void run() {
editorPane.setText (expression);
editorPane.selectAll ();
}
};
setupContext(editorPane, editorPaneUpdated);
textLabel.setLabelFor (editorPane);
HelpCtx.setHelpIDString(editorPane, "debug.customize.watch");
editorPane.requestFocus ();
return panel;
}
示例3: createScrollableLineEditor
import org.netbeans.editor.Utilities; //导入方法依赖的package包/类
private JScrollPane createScrollableLineEditor() {
JComponent [] editorComponents = Utilities.createSingleLineEditor("text/x-java");
JScrollPane sp = (JScrollPane) editorComponents[0];
tfCondition = (JEditorPane) editorComponents[1];
return sp;
}
示例4: ChangeParametersPanel
import org.netbeans.editor.Utilities; //导入方法依赖的package包/类
/** Creates new form ChangeMethodSignature */
public ChangeParametersPanel(TreePathHandle refactoredObj, ChangeListener parent, ParameterInfo[] preConfiguration, CodeStyle cs) {
returnTypeDocListener = new ReturnTypeDocListener();
methodNameDocListener = new MethodNameDocListener();
this.refactoredObj = refactoredObj;
this.parent = parent;
this.preConfiguration = preConfiguration;
model = new ParamTableModel(columnNames, 0) {
@Override
public void addRow(Object[] rowData) {
int row = paramTable.getRowCount();
super.addRow(rowData);
for (int i = 0; i < paramTable.getColumnCount(); i++) {
TableCellEditor cellEditor = paramTable.getCellEditor(row, i);
int rowHeight = cellEditor.getTableCellEditorComponent(paramTable, rowData[0], true, row, i).getPreferredSize().height;
if(paramTable.getRowHeight() < rowHeight) {
paramTable.setRowHeight(rowHeight);
}
}
}
};
this.returnTypeAction = new ReturnTypeAction();
singleLineEditor = Utilities.createSingleLineEditor(MIME_JAVA);
paramname = CodeStyleUtils.addPrefixSuffix("par", cs.getParameterNamePrefix(), cs.getParameterNameSuffix());
initComponents();
InputMap im = paramTable.getInputMap(JTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
ActionMap ptActionMap = paramTable.getActionMap();
KeyStroke tab = KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0);
Action oldTabAction = ptActionMap.get(im.get(tab));
tableTabAction = new TableTabAction(oldTabAction);
ptActionMap.put(im.get(tab), tableTabAction);
KeyStroke shiftTab = KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_MASK);
Action oldShiftTabAction = ptActionMap.get(im.get(shiftTab));
tableShiftTabAction = new TableTabAction(oldShiftTabAction);
ptActionMap.put(im.get(shiftTab), tableShiftTabAction);
methodNameText.getDocument().addDocumentListener(methodNameDocListener);
}