In blogging, I often like to share some code. Often times, I’ll just take a screen print, crop it, and upload it. But yesterday I found another way to put formatted code in my posts using Netbeans: Print to HTML. It’s under the File menu.
- Open your source in Netbeans
- Click Print to HTML under the File menu
- Choose between “Print to File” and “Print to Clipboard
- Click the HTML tab (assuming you’re using WordPress
- Paste in markup into your blog editor…et voila!
1 /*
2 * To change this template, choose Tools | Templates 3 * and open the template in the editor. 4 */ 5 6 package sample.transfer; 7 8 import java.math.BigDecimal; 9 10 /** 11 * 12 * @author david ctr wilson-bur 13 */ 14 public class ProductTO { 15 private Integer productId; 16 private String description; 17 private BigDecimal purchaseCost; 18 19 public String getDescription() { 20 return description; 21 } 22 23 public void setDescription(String description) { 24 this.description = description; 25 } 26 27 public String getManufacturerName() { 28 return manufacturerName; 29 } 30 31 public void setManufacturerName(String manufacturerName) { 32 this.manufacturerName = manufacturerName; 33 } 34 35 public Integer getProductId() { 36 return productId; 37 } 38 39 public void setProductId(Integer productId) { 40 this.productId = productId; 41 } 42 43 public BigDecimal getPurchaseCost() { 44 return purchaseCost; 45 } 46 47 public void setPurchaseCost(BigDecimal purchaseCost) { 48 this.purchaseCost = purchaseCost; 49 } 50 private String manufacturerName; 51 52 53 54 } 55 56
Thanks for reading! If you would like to see what else I’m up to, check out Whiff
Nice tip. Thanks for documenting and sharing.
with regards
Tushar