Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. public class Window extends JFrame implements Runnable {
  2.  
  3. ....
  4. private final JToolBar toolbar;
  5. private final JToolBar toolbar1;
  6. private final JPanel fbar;
  7. private final JTextField formulaBar;
  8. private JLabel barCaption;
  9. JMenuBar menuBar;
  10. RibbonBar Ribbon;
  11.  
  12. toolbar = new JToolBar();
  13. toolbar1 = new JToolBar();
  14. fbar = new JPanel();
  15. formulaBar = new JTextField(70);
  16. menuBar = new JMenuBar();
  17. Ribbon = new RibbonBar(this);
  18.  
  19. toolbar.add(fbar);
  20.  
  21. formulaBar.setSize(500, 25);
  22. formulaBar.setFont(new Font("Arial", Font.PLAIN, 12));
  23. formulaBar.setBorder(BorderFactory.createCompoundBorder(formulaBar.getBorder(), BorderFactory.createEmptyBorder(0, 5, 0, 5)));
  24.  
  25. fbar.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
  26. fbar.setLayout(new GridBagLayout());
  27. GridBagConstraints c = new GridBagConstraints();
  28.  
  29. //natural height, maximum width
  30. c.fill = GridBagConstraints.HORIZONTAL;
  31. c.gridx = 0;
  32. c.gridy = 0;
  33. c.ipadx = 0;
  34. fbar.add(Ribbon, c);
  35. c.fill = GridBagConstraints.HORIZONTAL;
  36. c.gridx = 1;
  37. c.gridy = 0;
  38. c.ipadx = 0;
  39. //barCaption = new JLabel(" Formula :", SwingConstants.CENTER);
  40. barCaption = new JLabel(" ", SwingConstants.CENTER);
  41.  
  42. barCaption.setBorder(BorderFactory.createCompoundBorder(barCaption.getBorder(), BorderFactory.createEmptyBorder(0, 17, 0, 17)));
  43. fbar.add(barCaption, c);
  44. c.fill = GridBagConstraints.HORIZONTAL;
  45. c.weightx = 0.5;
  46. c.gridx = 2;
  47. c.gridy = 0;
  48. fbar.add(formulaBar, c);
  49. c.fill = GridBagConstraints.HORIZONTAL;
  50. c.weightx = 0;
  51. c.gridx = 0;
  52. c.gridy = 0;
  53.  
  54. toolbar.setFloatable(false);
  55. setJMenuBar(menuBar);
  56. add(toolbar, BorderLayout.NORTH);
  57. ...
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement