Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.97 KB | None | 0 0
  1. public HtmlForm()
  2. {
  3.     HTMLComponent htmlC = new HTMLComponent(null);
  4.    
  5.     setLayout(new BoxLayout(BoxLayout.Y_AXIS));
  6.  
  7.    
  8.     StringBuffer sb = new StringBuffer();
  9.     sb.append("<style type=\"text/css\">.category{color:#003063;margin-bottom:8px;}.items{color:#315984;margin-left:20px;margin-bottom:8px;font-size:small;}</style>");
  10.     prepareHtml("category1", "super long string ....", sb);
  11.     prepareHtml("category2", "super long string ....", sb);
  12.     prepareHtml("test", "<a href=\"asdf\">test</a>", sb);
  13.     htmlC.setBodyText(sb.toString());
  14.  
  15.     setScrollable(false); // The HTMLComponent itself will be scrollable, not the form
  16.     setScrollableX(false); // The HTMLComponent itself will be scrollable, not the form
  17.  
  18.     addComponent(htmlC);
  19. }
  20.  
  21. private void prepareHtml(String category, String items, StringBuffer sb)
  22. {
  23.     sb.append("<div class=\"category\">");
  24.     sb.append(category);
  25.     sb.append("</div>");
  26.    
  27.     sb.append("<div class=\"items\">");
  28.     sb.append(items);
  29.     sb.append("</div>");
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement