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


Java RSyntaxTextArea.setFont方法代码示例

本文整理汇总了Java中org.fife.ui.rsyntaxtextarea.RSyntaxTextArea.setFont方法的典型用法代码示例。如果您正苦于以下问题:Java RSyntaxTextArea.setFont方法的具体用法?Java RSyntaxTextArea.setFont怎么用?Java RSyntaxTextArea.setFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.fife.ui.rsyntaxtextarea.RSyntaxTextArea的用法示例。


在下文中一共展示了RSyntaxTextArea.setFont方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: displayJavaConfigInfo

import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入方法依赖的package包/类
public static void displayJavaConfigInfo() {
    JFrame dframe = new JFrame("Java Runtime Information");
    final RSyntaxTextArea jt = new RSyntaxTextArea();

    jt.setFont(new Font(GlobalValues.paneFontName, Font.PLAIN, GlobalValues.paneFontSize));

    jt.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
    jt.setCodeFoldingEnabled(true);

    StringBuilder sb = new StringBuilder();
    for (Map.Entry e : System.getProperties().entrySet()) {
        String se = (String) e.getKey();
        if (se.startsWith("java")) {
            //System.out.println("se = "+e.toString());
            sb.append(e.toString() + "\n");
        }
    }
    jt.setText(sb.toString());

    RTextScrollPane jp = new RTextScrollPane(jt);
    dframe.add(jp);
    dframe.setLocation(200, 200);
    dframe.setSize(400, 400);
    dframe.setVisible(true);

}
 
开发者ID:scalalab,项目名称:scalalab,代码行数:27,代码来源:JavaConfigInfo.java

示例2: CustomCodeSyntaxPane

import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入方法依赖的package包/类
public CustomCodeSyntaxPane() {

		panel = new JPanel(new BorderLayout());
		textArea = new RSyntaxTextArea();
		textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
		textArea.setAntiAliasingEnabled(true);
		textArea.setCodeFoldingEnabled(true);
		textArea.setFont(DerivedConfig.getPanelContentFont());

		// setup autocompletion
		for (String word : getAutocompletionStrings()) {
			provider.addCompletion(new BasicCompletion(provider, word));
		}
		new AutoCompletion(provider).install(textArea);

		scrollPane = new RTextScrollPane(textArea);
		scrollPane.setFoldIndicatorEnabled(true);
		scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
		scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
		panel.add(scrollPane);
		textArea.getDocument().putProperty(PlainDocument.tabSizeAttribute, 3); // Reduce tab size
	}
 
开发者ID:umlet,项目名称:umlet,代码行数:23,代码来源:CustomCodeSyntaxPane.java

示例3: getHtmlPane

import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入方法依赖的package包/类
public static RSyntaxTextArea getHtmlPane() {
	/*
	 * JEditorPane htmlPane = new JEditorPane();
	 * htmlPane.setBackground(Color.WHITE);
	 * htmlPane.setForeground(Color.BLACK); Font font = new
	 * Font(Font.SANS_SERIF, Font.PLAIN, 20); htmlPane.setFont(font);
	 */
	RSyntaxTextArea textArea = new RSyntaxTextArea();
	textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
	textArea.setCodeFoldingEnabled(true);
	Font font = new Font(Font.SANS_SERIF, Font.PLAIN, 16);
	textArea.setFont(font);
	return textArea;
}
 
开发者ID:csanuragjain,项目名称:APKRepatcher,代码行数:15,代码来源:APKRepatcher.java

示例4: configureScriptTextArea

import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入方法依赖的package包/类
private void configureScriptTextArea(RSyntaxTextArea eventContent, RTextScrollPane scrollPane_2, String syntaxStyle)
{
    eventContent.setSyntaxEditingStyle(syntaxStyle);
    eventContent.getFoldManager().setCodeFoldingEnabled(true);
    eventContent.setFont(new Font("Hack", Font.PLAIN, 16));
    eventContent.setRows(3);
    eventContent.setMarkOccurrences(true);
    eventContent.setLineWrap(true);
    eventContent.setWrapStyleWord(true);

    scrollPane_2.setLineNumbersEnabled(true);
    scrollPane_2.setFoldIndicatorEnabled(true);
}
 
开发者ID:d0k1,项目名称:jsflight,代码行数:14,代码来源:MainFrame.java

示例5: CodeEditorWindow

import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入方法依赖的package包/类
public CodeEditorWindow() {
  setContentPane(contentPane);

  control = new CControl(this);
  base = CLocation.base();
  control.setTheme(ThemeMap.KEY_ECLIPSE_THEME);
  setContentPane(control.getContentArea());

  RSyntaxTextArea textArea = new RSyntaxTextArea(20, 60);
  textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT);
  textArea.setCodeFoldingEnabled(true);
  textArea.setFont(new Font("Ubuntu Mono", textArea.getFont().getStyle(), 14));
  Theme theme = null;
  try {
    theme = Theme.load(getClass().getResourceAsStream("/org/fife/ui/rsyntaxtextarea/themes/dark.xml"));
    theme.apply(textArea);
  } catch (IOException e) {
    e.printStackTrace();
  }


  RTextScrollPane sp = new RTextScrollPane(textArea);
  DefaultSingleCDockable dockable = new DefaultSingleCDockable("code", "sss", sp);
  dockable.setCloseable(true);
  dockable.setExternalizable(false);


  CGrid grid = new CGrid(control);

  grid.add(0, 0, 1, 1, createDockable("scripts", Color.CYAN));
  grid.add(1, 0, 8, 7, createDockable("* main.fjs", Color.CYAN));
  grid.add(1, 0, 8, 7, createDockable("* log.fjs", Color.CYAN));
  grid.add(1, 0, 8, 7, dockable);
  grid.add(0, 8, 9, 2, createDockable("Logs", Color.BLACK));
  control.getContentArea().deploy(grid);

}
 
开发者ID:macbury,项目名称:ForgE,代码行数:38,代码来源:CodeEditorWindow.java

示例6: changeFontSize

import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入方法依赖的package包/类
private void changeFontSize(int fontSize) {
    this.fontSize = fontSize;

    for (SyntaxSnippetEditor editor : editorList) {
        Font currentFont = editor.getTextArea().getFont();
        Font newFont = new Font(currentFont.getName(), currentFont.getStyle(), fontSize);
        RSyntaxTextArea textArea = editor.getTextArea();

        textArea.setFont(newFont);
    }
}
 
开发者ID:massimozappino,项目名称:tagmycode-java-plugin-framework,代码行数:12,代码来源:SyntaxSnippetEditorFactory.java

示例7: loadJarFile

import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入方法依赖的package包/类
public void loadJarFile(String name) {
    String jarName = GlobalValues.jarFilePath;

    try {
        JarEntry entry;

        exampleArea = new RSyntaxTextArea();
        exampleArea.setFont(new Font(GlobalValues.paneFontName, Font.PLAIN, GlobalValues.paneFontSize));

        exampleArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_SCALA);
        exampleArea.setCodeFoldingEnabled(true);

        exampleArea.setText("");

        JarInputStream zin = new JarInputStream(new FileInputStream(jarName));

        while ((entry = zin.getNextJarEntry()) != null) {

            if (entry.getName().equals(name)) {

                // read entry into text area
                BufferedReader in = new BufferedReader(new InputStreamReader(zin));
                String line;
                while ((line = in.readLine()) != null) {
                    exampleArea.append(line);
                    exampleArea.append("\n");
                }
            }
            zin.closeEntry();
        }
        zin.close();
    } catch (IOException e) {
        e.printStackTrace();
    }

    exampleScrollPane = new RTextScrollPane(exampleArea);
    JFrame exampleFrame = new JFrame(selectedExample);
    exampleFrame.add(exampleScrollPane);
    exampleFrame.pack();
    exampleFrame.setVisible(true);
}
 
开发者ID:scalalab,项目名称:scalalab,代码行数:42,代码来源:watchExamples.java

示例8: getComponent

import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入方法依赖的package包/类
@Override
public Component getComponent(int width, int height) throws IOException {
	final JPanel base = new JPanel();
	base.setOpaque(false);
	base.setPreferredSize(new Dimension(width, height));
	base.setLayout(new BorderLayout());

	final JPanel controls = new JPanel();
	final JButton runBtn = new JButton("Run");
	runBtn.setActionCommand("run");
	runBtn.addActionListener(this);
	controls.add(runBtn);

	base.add(controls, BorderLayout.NORTH);

	textArea = new RSyntaxTextArea(20, 60);
	Font font = textArea.getFont();
	font = font.deriveFont(font.getStyle(), 18);
	textArea.setFont(font);
	textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_GROOVY);
	textArea.setCodeFoldingEnabled(true);

	textArea.setText(initialScript);

	final RTextScrollPane inputScrollPane = new RTextScrollPane(textArea);

	outputPane = new JTextPane();
	outputPane.setEditable(false);
	outputPane.setFont(new Font("Monospaced", Font.PLAIN, 18));
	outputPane.setBorder(new EmptyBorder(4, 4, 4, 4));
	final JScrollPane outputScrollPane = new JScrollPane(outputPane);

	splitPane = new JSplitPane(orientation, inputScrollPane, outputScrollPane);
	splitPane.setOneTouchExpandable(true);
	splitPane.setDividerLocation(width / 2);

	final Dimension minimumSize = new Dimension(100, 50);
	inputScrollPane.setMinimumSize(minimumSize);
	outputScrollPane.setMinimumSize(minimumSize);

	final JPanel body = new JPanel();
	body.setBackground(Color.RED);
	body.setLayout(new BoxLayout(body, BoxLayout.Y_AXIS));
	body.add(splitPane);
	base.add(body, BorderLayout.CENTER);

	installInterceptors();

	return base;
}
 
开发者ID:jonhare,项目名称:COMP6237,代码行数:51,代码来源:GroovyConsoleSlide.java

示例9: OwnSyntaxPane

import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入方法依赖的package包/类
public OwnSyntaxPane() {

		panel = new JPanel(new FlowLayout());
		panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
		textArea = new RSyntaxTextArea() {
			private static final long serialVersionUID = 7431070002967577129L;

			@Override
			public void undoLastAction() {
				CurrentDiagram.getInstance().getDiagramHandler().getController().undo();
			}

			@Override
			public void redoLastAction() {
				CurrentDiagram.getInstance().getDiagramHandler().getController().redo();
			}
		};

		// Setup highlighting
		createHightLightMap();
		AbstractTokenMakerFactory atmf = (AbstractTokenMakerFactory) TokenMakerFactory.getDefaultInstance();
		atmf.putMapping(OwnTokenMaker.ID, OwnTokenMaker.class.getName());
		textArea.setSyntaxEditingStyle(OwnTokenMaker.ID);

		textArea.getSyntaxScheme().getStyle(TokenTypes.RESERVED_WORD).foreground = Converter.convert(ColorOwn.SYNTAX_HIGHLIGHTING);

		// Setup autocompletion
		createAutocompletionCompletionProvider();
		AutoCompletion ac = new AutoCompletion(provider);
		// ac.setShowDescWindow(true);
		ac.install(textArea);

		JLabel propertyLabel = new JLabel(" Properties");
		propertyLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
		propertyLabel.setFont(DerivedConfig.getPanelHeaderFont());
		panel.add(propertyLabel);

		textArea.setAntiAliasingEnabled(true);
		textArea.setFont(DerivedConfig.getPanelContentFont());
		scrollPane = new RTextScrollPane(textArea, false);
		scrollPane.setAlignmentX(Component.LEFT_ALIGNMENT);
		scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
		scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
		panel.add(scrollPane);

		textArea.getDocument().putProperty(PlainDocument.tabSizeAttribute, 3); // Reduce tab size
	}
 
开发者ID:umlet,项目名称:umlet,代码行数:48,代码来源:OwnSyntaxPane.java

示例10: QueryWindow

import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入方法依赖的package包/类
public QueryWindow(final WindowContext windowContext, final Datastore datastore, final String query) {
    super(windowContext);
    _datastore = datastore;
    _queryTextArea = new RSyntaxTextArea(5, 17);
    _queryTextArea.setFont(WidgetUtils.FONT_MONOSPACE);
    _queryTextArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_SQL);
    _queryTextArea.setText(query);

    _limitTextField = WidgetFactory.createTextField(null, 3);
    _limitTextField.setDocument(new NumberDocument(false, false));
    _limitTextField.setText("500");

    _table = new DCTable();
    _queryButton = WidgetFactory.createPrimaryButton("Execute query", IconUtils.MODEL_QUERY);
    _queryButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent event) {
            final String queryString = _queryTextArea.getText();
            logger.debug("Query being parsed: {}", queryString);

            try (DatastoreConnection con = _datastore.openConnection()) {
                final DataContext dataContext = con.getDataContext();
                final Query q = dataContext.parseQuery(queryString);
                logger.info("Parsed query: {}", q);
                final String limitString = _limitTextField.getText();
                if (!StringUtils.isNullOrEmpty(limitString)) {
                    final int limit = Integer.parseInt(limitString);
                    q.setMaxRows(limit);
                }
                final DataSet dataSet = dataContext.executeQuery(q);
                _centerPanel.setVisible(true);
                _table.setModel(new DataSetTableModel(dataSet));
            } catch (final MetaModelException e) {
                WidgetUtils.showErrorMessage("Failed to execute query", e.getMessage(), e);
            }
        }
    });

    _centerPanel = _table.toPanel();
    _centerPanel.setVisible(false);

    final DCPanel decoratedLimitTextField = WidgetUtils.decorateWithShadow(_limitTextField, false, 0);

    final DCPanel buttonPanel = new DCPanel();
    WidgetUtils.addToGridBag(DCLabel.dark("Max rows:"), buttonPanel, 1, 1, GridBagConstraints.CENTER);
    WidgetUtils.addToGridBag(decoratedLimitTextField, buttonPanel, 2, 1, GridBagConstraints.CENTER);
    WidgetUtils.addToGridBag(_queryButton, buttonPanel, 1, 2, 2, 1);

    final JScrollPane scrolledTextArea = new JScrollPane(_queryTextArea);
    final DCPanel decoratedTextField = WidgetUtils.decorateWithShadow(scrolledTextArea);

    _upperPanel = new DCPanel();
    _upperPanel.setLayout(new BorderLayout());
    _upperPanel.add(decoratedTextField, BorderLayout.CENTER);
    _upperPanel.add(buttonPanel, BorderLayout.EAST);
}
 
开发者ID:datacleaner,项目名称:DataCleaner,代码行数:57,代码来源:QueryWindow.java

示例11: getTextComponent

import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; //导入方法依赖的package包/类
protected JTextComponent getTextComponent(final ConfiguredPropertyDescriptor propertyDescriptor) {
    final boolean multiline;
    final boolean password;
    final String mimeType;

    if (_stringPropertyAnnotation == null) {
        multiline = false;
        mimeType = null;
        password = false;
    } else {
        multiline = _stringPropertyAnnotation.multiline();
        final String[] mimeTypes = _stringPropertyAnnotation.mimeType();
        mimeType = getTextAreaMimeType(mimeTypes);
        password = _stringPropertyAnnotation.password();
    }

    final JTextComponent textComponent;
    if (multiline) {
        if (mimeType != null) {
            final RSyntaxTextArea syntaxArea = new RSyntaxTextArea(8, 17);
            syntaxArea.setFont(WidgetUtils.FONT_MONOSPACE);
            syntaxArea.setTabSize(2);
            syntaxArea.setSyntaxEditingStyle(mimeType);
            textComponent = syntaxArea;
        } else {
            textComponent = WidgetFactory.createTextArea(propertyDescriptor.getName());
        }
    } else {
        if (password) {
            textComponent = WidgetFactory.createPasswordField();
        } else {
            textComponent = WidgetFactory.createTextField(propertyDescriptor.getName());
        }
    }

    textComponent.getDocument().addDocumentListener(new DCDocumentListener() {
        @Override
        protected void onChange(final DocumentEvent e) {
            fireValueChanged();
        }
    });

    return textComponent;
}
 
开发者ID:datacleaner,项目名称:DataCleaner,代码行数:45,代码来源:SingleStringPropertyWidget.java


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