return button;
}
public static RSyntaxTextArea createSyntaxTextArea(String name, String text) {
final RSyntaxTextArea area = new RSyntaxTextArea();
area.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_LISP);
area.setText(text);
area.setName(name);
area.setToolTipText(name);
for(int i = 0; i < area.getPopupMenu().getComponentCount(); i++) {
Object object = area.getPopupMenu().getComponent(i);
if(object instanceof JMenuItem) {
JMenuItem item = (JMenuItem) object;
if(item.getText().equals("Copy"))
SwingFactory.setIcon(item, "icons/Copy.png");
if(item.getText().equals("Paste"))
SwingFactory.setIcon(item, "icons/Paste.png");
if(item.getText().equals("Cut"))
SwingFactory.setIcon(item, "icons/Cut.png");
if(item.getText().contains("Delete"))
SwingFactory.setIcon(item, "icons/delete.png");
if(item.getText().contains("Select All"))
SwingFactory.setIcon(item, "icons/edit_select_all.png");
if(item.getText().contains("Undo"))
SwingFactory.setIcon(item, "icons/undo.png");
if(item.getText().contains("Redo"))
SwingFactory.setIcon(item, "icons/redo.png");
}
}
// mouse listener to resize font
area.addMouseWheelListener(new MouseWheelListener() {
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
Font font = area.getFont();
float size = font.getSize();
if(e.getWheelRotation() < 0) {
size = font.getSize() + 1f;
}
else if (e.getWheelRotation() > 0){
size = font.getSize() - 1f;
}
area.setFont(font.deriveFont(size));
}
});
return area;
}