CodeLabel
Displays source code nicely formatted and colored
A drop-in replacement for Label, formats and colorizes source code nicely.
CodeLabel uses the google-code-prettify library to do the heavy-lifting. An example can be seen by clicking the code example highlight - yes, this is the same component seen in both Sampler and Directory.
Sample code
package org.vaadin.codelabel; import com.vaadin.Application; import com.vaadin.ui.Label; import com.vaadin.ui.Window; public class CodeLabelDemo extends Application { @Override public void init() { Window mainWindow = new Window("CodeLabel Demo"); Label label = new CodeLabel( "package org.vaadin.codelabel;\n" + "\n" + "import com.vaadin.Application;\n" + "import com.vaadin.ui.*;\n" + "\n" + "public class CodeLabelDemo extends Application {\n" + " @Override\n" + " public void init() {\n" + " Window mainWindow = new Window(\"CodeLabel Demo\");\n" + " Label label = new CodeLabel(\"\");\n" + " mainWindow.addComponent(label);\n" + " setMainWindow(mainWindow);\n" + " }\n" + "}"); mainWindow.addComponent(label); setMainWindow(mainWindow); } }
Links
Compatibility
Was this helpful? Need more help?
Leave a comment or a question below. You can also join
the chat on Discord or
ask questions on StackOverflow.
Version
Quick rewrite for Vaadin 7. Please report issues.
- Released
- 2013-05-24
- Maturity
- BETA
- License
- Apache License 2.0
Compatibility
- Framework
- Vaadin 7.0+
- Vaadin 6.0+ in 1.0
- Browser
- Browser Independent
CodeLabel - Vaadin Add-on Directory
Displays source code nicely formatted and coloredA drop-in replacement for Label, formats and colorizes source code nicely.
CodeLabel uses the google-code-prettify library to do the heavy-lifting. An example can be seen by clicking the code example highlight - yes, this is the same component seen in both Sampler and Directory.