Exemple #1
0
 /**
  * This method initializes compareToolBar
  *
  * @return javax.swing.JToolBar
  */
 private JToolBar getCompareToolBar() {
   if (compareToolBar == null) {
     compareToolBar = new JToolBar();
     compareToolBar.setComponentOrientation(java.awt.ComponentOrientation.LEFT_TO_RIGHT);
     compareToolBar.setFloatable(false);
     compareToolBar.setName("compareToolBar");
     compareToolBar.add(getOpenBase());
     compareToolBar.add(getOpenCompare());
     compareToolBar.add(getSaveCompare());
     compareToolBar.add(getRemove());
     compareToolBar.add(getRemoveGroup());
     compareToolBar.add(getOptimize());
     compareToolBar.add(getAbout());
     compareToolBar.add(getLegendPanel());
   }
   return compareToolBar;
 }
Exemple #2
0
  @SuppressWarnings("serial")
  public static JToolBar newToolbar(boolean anchorRight) {
    JToolBar toolbar;

    if (anchorRight) {
      toolbar =
          new JToolBar() {
            @Override
            protected void addImpl(Component c, Object constraints, int index) {
              int reverseIndex;
              if (index == -1) {
                reverseIndex = 0;
              } else {
                int oldIndex = getComponentIndex(c);
                if (oldIndex >= 0 && index > oldIndex) {
                  index--;
                }

                reverseIndex = getComponentCount() - index;
              }

              super.addImpl(c, constraints, reverseIndex);
            }
          };
      toolbar.setComponentOrientation(RIGHT_TO_LEFT);
    } else {
      toolbar = new JToolBar();
    }

    toolbar.setBorder(null);
    toolbar.setBorderPainted(false);
    toolbar.setFloatable(false);
    toolbar.setRollover(true);
    toolbar.setOpaque(false);
    return toolbar;
  }