当前位置: 首页>>代码示例>>Java>>正文


Java Utilities.createSingleLineEditor方法代码示例

本文整理汇总了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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:ClassBreakpointPanel.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:65,代码来源:WatchPanel.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:ConditionsPanel.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:44,代码来源:ChangeParametersPanel.java


注:本文中的org.netbeans.editor.Utilities.createSingleLineEditor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。