Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Window extends JFrame implements Runnable {
- ....
- private final JToolBar toolbar;
- private final JToolBar toolbar1;
- private final JPanel fbar;
- private final JTextField formulaBar;
- private JLabel barCaption;
- JMenuBar menuBar;
- RibbonBar Ribbon;
- toolbar = new JToolBar();
- toolbar1 = new JToolBar();
- fbar = new JPanel();
- formulaBar = new JTextField(70);
- menuBar = new JMenuBar();
- Ribbon = new RibbonBar(this);
- toolbar.add(fbar);
- formulaBar.setSize(500, 25);
- formulaBar.setFont(new Font("Arial", Font.PLAIN, 12));
- formulaBar.setBorder(BorderFactory.createCompoundBorder(formulaBar.getBorder(), BorderFactory.createEmptyBorder(0, 5, 0, 5)));
- fbar.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
- fbar.setLayout(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
- //natural height, maximum width
- c.fill = GridBagConstraints.HORIZONTAL;
- c.gridx = 0;
- c.gridy = 0;
- c.ipadx = 0;
- fbar.add(Ribbon, c);
- c.fill = GridBagConstraints.HORIZONTAL;
- c.gridx = 1;
- c.gridy = 0;
- c.ipadx = 0;
- //barCaption = new JLabel(" Formula :", SwingConstants.CENTER);
- barCaption = new JLabel(" ", SwingConstants.CENTER);
- barCaption.setBorder(BorderFactory.createCompoundBorder(barCaption.getBorder(), BorderFactory.createEmptyBorder(0, 17, 0, 17)));
- fbar.add(barCaption, c);
- c.fill = GridBagConstraints.HORIZONTAL;
- c.weightx = 0.5;
- c.gridx = 2;
- c.gridy = 0;
- fbar.add(formulaBar, c);
- c.fill = GridBagConstraints.HORIZONTAL;
- c.weightx = 0;
- c.gridx = 0;
- c.gridy = 0;
- toolbar.setFloatable(false);
- setJMenuBar(menuBar);
- add(toolbar, BorderLayout.NORTH);
- ...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement