Java Code Examples for org.fife.ui.rsyntaxtextarea.RSyntaxTextArea#revalidate()

The following examples show how to use org.fife.ui.rsyntaxtextarea.RSyntaxTextArea#revalidate() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainView.java    From HiJson with Apache License 2.0 6 votes vote down vote up
private RSyntaxTextArea newTextArea(){
//        JTextArea textArea = new JTextArea();
//        textArea.setAutoscrolls(true);
////      textArea.getDocument().addUndoableEditListener(undoMg);
//        textArea.addMouseListener(new TextAreaMouseListener());
        RSyntaxTextArea textArea = new RSyntaxTextArea();
        textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT);
        textArea.setCodeFoldingEnabled(true);
        textArea.setAntiAliasingEnabled(true);
        textArea.setAutoscrolls(true);

        SyntaxScheme scheme = textArea.getSyntaxScheme();
//        scheme.getStyle(Token.COMMENT_KEYWORD).foreground = Color.red;
//      scheme.getStyle(Token.DATA_TYPE).foreground = Color.blue;
        scheme.getStyle(Token.LITERAL_STRING_DOUBLE_QUOTE).foreground = Color.BLUE;
        scheme.getStyle(Token.LITERAL_NUMBER_DECIMAL_INT).foreground = new Color(164, 0, 0);
        scheme.getStyle(Token.LITERAL_NUMBER_FLOAT).foreground = new Color(164, 0, 0);
        scheme.getStyle(Token.LITERAL_BOOLEAN).foreground = Color.RED;
        scheme.getStyle(Token.OPERATOR).foreground = Color.BLACK;
        textArea.revalidate();
        textArea.addMouseListener(new TextAreaMouseListener());
       
        return textArea;
    }
 
Example 2
Source File: SyntaxPane.java    From otroslogviewer with Apache License 2.0 6 votes vote down vote up
public static RSyntaxTextArea propertiesTextArea(Theme theme) {
  final RSyntaxTextArea editorPane = new RSyntaxTextArea();
  editorPane.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_PROPERTIES_FILE);
  SyntaxScheme scheme = editorPane.getSyntaxScheme();
  scheme.getStyle(Token.RESERVED_WORD).foreground = theme.getColor(ThemeKey.LOG_DETAILS_PROPERTY_KEY);
  scheme.getStyle(Token.OPERATOR).foreground = theme.getColor(ThemeKey.LOG_DETAILS_PROPERTY_KEY);
  scheme.getStyle(Token.VARIABLE).foreground = theme.getColor(ThemeKey.LOG_DETAILS_PROPERTY_VALUE);
  scheme.getStyle(Token.LITERAL_STRING_DOUBLE_QUOTE).foreground = theme.getColor(ThemeKey.LOG_DETAILS_PROPERTY_VALUE);
  scheme.getStyle(Token.COMMENT_EOL).foreground = theme.getColor(ThemeKey.LOG_DETAILS_STACKTRACE_COMMENT);
  editorPane.setBackground(new JTextArea().getBackground());

  Color highlightColor;
  if (theme.themeType().equals(Theme.Type.Light)){
    highlightColor = editorPane.getBackground().darker();
  } else {
    highlightColor = editorPane.getBackground().brighter();
  }
  editorPane.setCurrentLineHighlightColor(highlightColor);
  editorPane.revalidate();
  return editorPane;
}
 
Example 3
Source File: JWTViewTab.java    From JWT4B with GNU General Public License v3.0 4 votes vote down vote up
private void drawPanel() {
	GridBagLayout gridBagLayout = new GridBagLayout();
	gridBagLayout.columnWidths = new int[] { 10, 447, 0, 0 };
	gridBagLayout.rowHeights = new int[] { 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
	gridBagLayout.columnWeights = new double[] { 0.0, 1.0, 0.0, Double.MIN_VALUE };
	gridBagLayout.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
	setLayout(gridBagLayout);
	
	keyLabel = new JLabel(" ");
	keyLabel.setFont(new Font("Tahoma", Font.BOLD, 12));
	GridBagConstraints gbc_inputLabel1 = new GridBagConstraints();
	gbc_inputLabel1.fill = GridBagConstraints.VERTICAL;
	gbc_inputLabel1.insets = new Insets(0, 0, 5, 5);
	gbc_inputLabel1.anchor = GridBagConstraints.WEST;
	gbc_inputLabel1.gridx = 1;
	gbc_inputLabel1.gridy = 1;
	add(keyLabel, gbc_inputLabel1);

	jwtKeyArea = new JTextArea();
	GridBagConstraints gbc_inputField1 = new GridBagConstraints();
	gbc_inputField1.insets = new Insets(0, 0, 5, 5);
	gbc_inputField1.fill = GridBagConstraints.HORIZONTAL;
	gbc_inputField1.gridx = 1;
	gbc_inputField1.gridy = 2;
	add(jwtKeyArea, gbc_inputField1);
	jwtKeyArea.setColumns(10);
	
	verificationIndicator = new JButton("");
	Dimension preferredSize = new Dimension(400, 30);
	verificationIndicator.setPreferredSize(preferredSize);
	GridBagConstraints gbc_validIndicator = new GridBagConstraints();
	gbc_validIndicator.insets = new Insets(0, 0, 5, 5);
	gbc_validIndicator.gridx = 1;
	gbc_validIndicator.gridy = 4;
	add(verificationIndicator, gbc_validIndicator);

	outputField = new RSyntaxTextArea();
	SyntaxScheme scheme = outputField.getSyntaxScheme();
	Style style = new Style();
	style.foreground = new Color(222,133,10);
	scheme.setStyle(Token.LITERAL_STRING_DOUBLE_QUOTE, style);
	outputField.revalidate();
	outputField.setHighlightCurrentLine(false);
	outputField.setCurrentLineHighlightColor(Color.WHITE);
	outputField.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT);
	outputField.setEditable(false);
	outputField.setPopupMenu(new JPopupMenu()); // no context menu on right-click
	
	outputLabel = new JLabel("JWT");
	outputLabel.setFont(new Font("Tahoma", Font.BOLD, 12));
	GridBagConstraints gbc_outputLabel = new GridBagConstraints();
	gbc_outputLabel.anchor = GridBagConstraints.WEST;
	gbc_outputLabel.insets = new Insets(0, 0, 5, 5);
	gbc_outputLabel.gridx = 1;
	gbc_outputLabel.gridy = 5;
	add(outputLabel, gbc_outputLabel);
	
	lbRegisteredClaims = new JLabel();
	lbRegisteredClaims.setBackground(SystemColor.controlHighlight);
	GridBagConstraints gbc_lbRegisteredClaims = new GridBagConstraints();
	gbc_lbRegisteredClaims.fill = GridBagConstraints.BOTH;
	gbc_lbRegisteredClaims.insets = new Insets(0, 0, 5, 5);
	gbc_lbRegisteredClaims.gridx = 1;
	gbc_lbRegisteredClaims.gridy = 8;
	add(lbRegisteredClaims, gbc_lbRegisteredClaims);
	
	lblCookieFlags = new JLabel(" ");
	lblCookieFlags.setFont(new Font("Tahoma", Font.BOLD, 12));
	GridBagConstraints gbc_lblCookieFlags = new GridBagConstraints();
	gbc_lblCookieFlags.anchor = GridBagConstraints.SOUTHWEST;
	gbc_lblCookieFlags.insets = new Insets(0, 0, 5, 5);
	gbc_lblCookieFlags.gridx = 1;
	gbc_lblCookieFlags.gridy = 9;
	add(lblCookieFlags, gbc_lblCookieFlags);
	
	RTextScrollPane sp = new RTextScrollPane(outputField);
	sp.setLineNumbersEnabled(false);
	
	GridBagConstraints gbc_outputfield = new GridBagConstraints();
	gbc_outputfield.insets = new Insets(0, 0, 5, 5);
	gbc_outputfield.fill = GridBagConstraints.BOTH;
	gbc_outputfield.gridx = 1;
	gbc_outputfield.gridy = 6;
	add(sp, gbc_outputfield);
}