Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. RSyntaxTextArea textArea = new RSyntaxTextArea(50, 150);
  2. textArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
  3. textArea.setCodeFoldingEnabled(true);
  4. RTextScrollPane sp = new RTextScrollPane(textArea);
  5.  
  6. cp.setLayout(new GridBagLayout());
  7. GridBagConstraints c = new GridBagConstraints();
  8. c.fill = GridBagConstraints.HORIZONTAL;
  9.  
  10. c.gridx = 0;
  11. c.gridy = 0;
  12. cp.add(createToolbar(), c);
  13.  
  14. c.gridx = 0;
  15. c.gridy = 1;
  16. c.ipadx = 90;
  17. c.fill = GridBagConstraints.BOTH;
  18. cp.add(createTree(), c);
  19.  
  20. c.gridx = 1;
  21. c.gridy = 1;
  22. c.fill = GridBagConstraints.HORIZONTAL;
  23. cp.add(sp, c);
  24.  
  25. ...
  26.  
  27. private JToolBar createToolbar() {
  28. JToolBar tb = new JToolBar("Toolbar", JToolBar.HORIZONTAL);
  29.  
  30. JButton ob = new JButton(new ImageIcon("..."));
  31.  
  32. tb.add(ob);
  33.  
  34. tb.setFloatable(false);
  35. tb.setRollover(true);
  36.  
  37. return tb;
  38. }
  39.  
  40. ...
  41.  
  42. private JTree createTree() {
  43. DefaultMutableTreeNode top = new DefaultMutableTreeNode("Projects");
  44. JTree tree = new JTree(top);
  45.  
  46. DefaultMutableTreeNode test = new DefaultMutableTreeNode("I'm a test!");
  47. top.add(test);
  48.  
  49. return tree;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement