public ResourceTree(ResourceTreeModel treemodel) {
    tree.setCellRenderer(new ResourceTreeRenderer());
    tree.addKeyListener(new TreeKeyListener());
    tree.addMouseListener(new TreeMouseListener());
    tree.setModel(treemodel);
    tree.putClientProperty("JTree.lineStyle", "Angled");
    tree.clearSelection();
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    tree.setRootVisible(false);
    tree.addTreeSelectionListener(this);
    tree.setShowsRootHandles(true);

    bnext.addActionListener(this);
    bprev.addActionListener(this);
    bnext.setEnabled(false);
    bprev.setEnabled(false);
    bnext.setHorizontalTextPosition(SwingConstants.LEADING);
    bnext.setMargin(new Insets(3, 1, 3, 1));
    bprev.setMargin(bnext.getMargin());

    JPanel panel = new JPanel();
    panel.setLayout(new GridLayout(1, 2));
    panel.add(bprev);
    panel.add(bnext);

    setLayout(new BorderLayout());
    add(new JScrollPane(tree), BorderLayout.CENTER);
    add(panel, BorderLayout.SOUTH);
  }
Example #2
0
  public SidePaneComponent(SidePaneManager manager, Icon icon, String title) {
    super(title);
    this.manager = manager;

    this.add(new JLabel(icon));

    setTitleForeground(new Color(79, 95, 143));
    setBorder(BorderFactory.createEmptyBorder());

    close.setMargin(new Insets(0, 0, 0, 0));
    close.setBorder(null);
    close.addActionListener(e -> hideAway());

    JButton up = new JButton(IconTheme.JabRefIcon.UP.getSmallIcon());
    up.setMargin(new Insets(0, 0, 0, 0));
    up.setBorder(null);
    up.addActionListener(e -> moveUp());

    JButton down = new JButton(IconTheme.JabRefIcon.DOWN.getSmallIcon());
    down.setMargin(new Insets(0, 0, 0, 0));
    down.setBorder(null);
    down.addActionListener(e -> moveDown());

    JToolBar tlb = new OSXCompatibleToolbar();
    tlb.add(up);
    tlb.add(down);
    tlb.add(close);
    tlb.setOpaque(false);
    tlb.setFloatable(false);
    this.getUI().getTitleBar().add(tlb);
    setTitlePainter(new MattePainter(Color.lightGray));
  }
  private JPanel createImageButtonsPanel() {
    replaceImageButton =
        new JButton(mainPanel.translate("button.replace"), View.getIcon("replaceimage16"));
    replaceImageButton.setMargin(new Insets(3, 3, 3, 10));
    replaceImageButton.addActionListener(mainPanel::replaceButtonActionPerformed);
    replaceImageButton.setVisible(false);

    replaceImageAlphaButton =
        new JButton(
            mainPanel.translate("button.replaceAlphaChannel"), View.getIcon("replacealpha16"));
    replaceImageAlphaButton.setMargin(new Insets(3, 3, 3, 10));
    replaceImageAlphaButton.addActionListener(mainPanel::replaceAlphaButtonActionPerformed);
    replaceImageAlphaButton.setVisible(false);

    prevFontsButton = new JButton(mainPanel.translate("button.prev"), View.getIcon("prev16"));
    prevFontsButton.setMargin(new Insets(3, 3, 3, 10));
    prevFontsButton.addActionListener(this::prevFontsButtonActionPerformed);
    prevFontsButton.setVisible(false);

    nextFontsButton = new JButton(mainPanel.translate("button.next"), View.getIcon("next16"));
    nextFontsButton.setMargin(new Insets(3, 3, 3, 10));
    nextFontsButton.addActionListener(this::nextFontsButtonActionPerformed);
    nextFontsButton.setVisible(false);

    ButtonsPanel imageButtonsPanel = new ButtonsPanel();
    imageButtonsPanel.add(replaceImageButton);
    imageButtonsPanel.add(replaceImageAlphaButton);
    imageButtonsPanel.add(prevFontsButton);
    imageButtonsPanel.add(nextFontsButton);
    return imageButtonsPanel;
  }
  public MultipleObjectsActionPanel(GeometryEditPane editPane) {
    this.editPane = editPane;

    setLayout(new GridBagLayout());

    GridBagConstraints c = new GridBagConstraints();
    GridBagConstraintsEditor editor = new GridBagConstraintsEditor(c);

    JButton filters = new JButton();
    ShowFilterMenuAction filtersAction = new ShowFilterMenuAction(editPane, filters);
    filters.setAction(filtersAction);
    filters.setMargin(new Insets(0, 0, 0, 0));

    MergeChainsAction mergeChainsAction = new MergeChainsAction(editPane);
    mergeChains = new JButton(mergeChainsAction);
    mergeChains.setMargin(new Insets(0, 0, 0, 0));
    mergeChains.setText(null);

    ToPolygonAction toPolygonAction = new ToPolygonAction(editPane);
    toPolygon = new JButton(toPolygonAction);
    toPolygon.setMargin(new Insets(0, 0, 0, 0));
    toPolygon.setText(null);

    ConvexHullAction chAction = new ConvexHullAction(editPane);
    JButton convexHull = new JButton(chAction);
    convexHull.setMargin(new Insets(0, 0, 0, 0));
    convexHull.setText(null);

    editor.gridPos(GridBagConstraints.RELATIVE, 0);
    editor.fill(GridBagConstraints.BOTH);
    add(filters, c);
    add(mergeChains, c);
    add(toPolygon, c);
    add(convexHull, c);
  }
Example #5
0
    public LineSelector() {

      JButton next = new JButton(IconFactory.getRightArrowIcon());
      JButton previous = new JButton(IconFactory.getLeftArrowIcon());

      next.setFocusable(false);
      previous.setFocusable(false);

      next.setMargin(new Insets(3, 3, 3, 3));
      previous.setMargin(new Insets(3, 3, 3, 3));

      next.addActionListener(
          new ActionListener() {

            public void actionPerformed(ActionEvent e) {
              nextLine();
            }
          });

      previous.addActionListener(
          new ActionListener() {

            public void actionPerformed(ActionEvent e) {
              previousLine();
            }
          });

      Packer p = new Packer(this);

      p.add(label).gridx(0).gridy(0).fillboth().west().weightx(1.0);
      p.add(previous).gridx(1).east().fillx().weightx(0);
      p.add(next).gridx(2).east().fillx().weightx(0);
    }
 public BasicDialogPanel(int width, int height, String tituloTela, DialogListener dialogListener) {
   super(width, height, tituloTela);
   this.dialogListener = dialogListener;
   Insets insets = new Insets(6, 1, 0, 1);
   JButton button = null;
   button = this.toolBar.add(new ConfirmaAction(this.dialogListener));
   button.setMargin(insets);
   button = this.toolBar.add(new CancelaAction(this.dialogListener));
   button.setMargin(insets);
   this.configurePanel();
 }
Example #7
0
  protected void initBtn() {
    bOk.setText("确定");
    bOk.setToolTipText("确定");
    bOk.setMargin(new Insets(0, 0, 0, 0));
    bOk.setIcon(ExplorerIcons.getExplorerIcon("jprofiler/checkbox_16.png"));
    bOk.addActionListener(this);

    bExit.setText("取消");
    bExit.setToolTipText("取消");
    bExit.setMargin(new Insets(0, 0, 0, 0));
    bExit.setIcon(ExplorerIcons.getExplorerIcon("jprofiler/delete.png"));
    bExit.addActionListener(this);
  }
Example #8
0
  /**
   * Create a new PathSetting instancen.
   *
   * @param parentComponent The component to open the file chooser on
   * @param defaultPath The path to display as default path, if path is empty
   */
  public PathSetting(final Component parentComponent, String defaultPath) {
    this.defaultPath = defaultPath;
    this.parentComponent = parentComponent;

    display.setEditable(false);
    changeButton.setMargin(GuiUtil.SMALL_BUTTON_INSETS);
    resetButton.setMargin(GuiUtil.SMALL_BUTTON_INSETS);
    openButton.setMargin(GuiUtil.SMALL_BUTTON_INSETS);

    setLayout(new GridBagLayout());

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 1;
    gbc.gridwidth = 3;

    add(display, gbc);

    gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.EAST;
    gbc.gridy = 1;
    gbc.weightx = 1;
    gbc.gridx = 0;
    add(changeButton, gbc);
    gbc.gridx = 1;
    gbc.weightx = 0;
    add(resetButton, gbc);
    gbc.gridx = 2;
    gbc.insets.left += 6;
    add(openButton, gbc);

    ActionListener buttonAction =
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            if (e.getSource() == changeButton) {
              chooseDirectory();
            } else if (e.getSource() == resetButton) {
              setSettingValue("");
            } else if (e.getSource() == openButton) {
              MiscUtil.openFolder(getCurrentPath().toFile(), parentComponent);
            }
          }
        };
    changeButton.addActionListener(buttonAction);
    resetButton.addActionListener(buttonAction);
    openButton.addActionListener(buttonAction);
  }
  private void setupToolBar() // {{{
      {
    toolbar.setFloatable(false);
    toolbar.setRollover(true);
    toolbar.setName("listToolbar"); // NOI18N
    toolbar.setPreferredSize(new java.awt.Dimension(100, 18));

    btnPrev.setIcon(resourceMap.getIcon("btnPrev.icon")); // NOI18N
    btnPrev.setText(resourceMap.getString("btnPrev.text")); // NOI18N
    btnPrev.setToolTipText(resourceMap.getString("btnPrev.toolTipText")); // NOI18N
    btnPrev.setFocusable(false);
    btnPrev.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnPrev.setMargin(new java.awt.Insets(2, 2, 2, 2));
    btnPrev.setName("btnPrev"); // NOI18N
    btnPrev.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    toolbar.add(btnPrev);

    jSeparator3.setMaximumSize(new java.awt.Dimension(1000, 10));
    jSeparator3.setName("jSeparator3"); // NOI18N
    toolbar.add(jSeparator3);

    btnAddList.setAction(actionMap.get("addNewList"));
    btnAddList.setText(resourceMap.getString("btnAddList.text"));
    btnAddList.setIcon(resourceMap.getIcon("btnAddList.icon"));
    btnAddList.setToolTipText(resourceMap.getString("btnAddList.toolTipText"));
    btnAddList.setMargin(new java.awt.Insets(2, 2, 2, 2));
    toolbar.add(btnAddList);

    btnDeleteList.setAction(actionMap.get("deleteList"));
    btnDeleteList.setText(resourceMap.getString("btnDeleteList.text"));
    btnDeleteList.setIcon(resourceMap.getIcon("btnDeleteList.icon"));
    btnDeleteList.setToolTipText(resourceMap.getString("btnDeleteList.toolTipText"));
    btnDeleteList.setMargin(new java.awt.Insets(2, 2, 2, 2));
    toolbar.add(btnDeleteList);

    separatorRight.setMaximumSize(new java.awt.Dimension(1000, 10));
    separatorRight.setName("separatorRight"); // NOI18N
    toolbar.add(separatorRight);

    btnNext.setIcon(resourceMap.getIcon("btnNext.icon")); // NOI18N
    btnNext.setToolTipText(resourceMap.getString("btnNext.toolTipText")); // NOI18N
    btnNext.setFocusable(false);
    btnNext.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    btnNext.setLabel(resourceMap.getString("btnNext.label")); // NOI18N
    btnNext.setMargin(new java.awt.Insets(2, 2, 2, 2));
    btnNext.setName("btnNext"); // NOI18N
    btnNext.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    toolbar.add(btnNext);
  } // }}}
Example #10
0
  protected void initializeZoomSlider() {
    zoomSlider = new JSlider(MIN_ZOOM, tileController.getTileSource().getMaxZoom());
    zoomSlider.setOrientation(JSlider.VERTICAL);
    zoomSlider.setBounds(10, 10, 30, 150);
    zoomSlider.setOpaque(false);
    zoomSlider.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            setZoom(zoomSlider.getValue());
          }
        });
    add(zoomSlider);
    int size = 18;
    try {
      ImageIcon icon = new ImageIcon(getClass().getResource("images/plus.png"));
      zoomInButton = new JButton(icon);
    } catch (Exception e) {
      zoomInButton = new JButton("+");
      zoomInButton.setFont(new Font("sansserif", Font.BOLD, 9));
      zoomInButton.setMargin(new Insets(0, 0, 0, 0));
    }
    zoomInButton.setBounds(4, 155, size, size);
    zoomInButton.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            zoomIn();
          }
        });
    add(zoomInButton);
    try {
      ImageIcon icon = new ImageIcon(getClass().getResource("images/minus.png"));
      zoomOutButton = new JButton(icon);
    } catch (Exception e) {
      zoomOutButton = new JButton("-");
      zoomOutButton.setFont(new Font("sansserif", Font.BOLD, 9));
      zoomOutButton.setMargin(new Insets(0, 0, 0, 0));
    }
    zoomOutButton.setBounds(8 + size, 155, size, size);
    zoomOutButton.addActionListener(
        new ActionListener() {

          public void actionPerformed(ActionEvent e) {
            zoomOut();
          }
        });
    add(zoomOutButton);
  }
    BusinessPane() {
      setLayout(null);
      add(info_label);
      info_label.setBounds(10, 10, 300, 20);
      info_label.setFont(new Font("TimesRoman", Font.BOLD, 12));
      add(info_scroll);
      info_scroll.setBounds(5, 35, 615, 400);
      info_name.add(columnName[0]);
      info_name.add(columnName[1]);
      info_name.add(columnName[2]);
      info_name.add(columnName[3]);
      DefaultTableModel info_model = new DefaultTableModel(info_data, info_name);
      info_table.setModel(info_model);
      info_table.getColumnModel().getColumn(0).setWidth(25);
      info_table.addMouseListener(
          new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
              if (e.getClickCount() == 1) { // click to trigger the event
                // show_selected();
                // System.out.print(table_selected(0));
              }
            }
          });

      add(B_refresh);
      B_refresh.setMargin(new java.awt.Insets(1, 1, 1, 1));
      B_refresh.setBounds(530, 440, 90, 25);
      B_refresh.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent event) {
              update_table();
            }
          });
    }
Example #12
0
 ButtonCellEditor(ActiveTasksTableModel model, Listener listener) {
   this.model = model;
   this.listener = listener;
   delegate = new JButton();
   delegate.setMargin(new Insets(0, 0, 0, 0));
   delegate.addActionListener(this);
 }
Example #13
0
  public FloatCellEditor() {
    super();

    setComponent(panel, textfield);

    textfield.addActionListener(
        new java.awt.event.ActionListener() {
          @Override
          public void actionPerformed(java.awt.event.ActionEvent e) {
            finalizeEdit(false);
          }
        });

    button.setMargin(new Insets(0, 3, 0, 3));

    button.addActionListener(
        new java.awt.event.ActionListener() {
          @Override
          public void actionPerformed(java.awt.event.ActionEvent e) {
            if (getProperty() != null) {
              getProperty().onButtonClicked(button);
              textfield.setText(String.valueOf(getProperty().getValue()));
            }
          }
        });

    panel.add(textfield, BorderLayout.CENTER);
    panel.add(button, BorderLayout.EAST);
  }
  /**
   * This method initializes btnUnitFileOpen
   *
   * @return javax.swing.JButton
   */
  private JButton getBtnUnitFileOpen() {
    if (btnUnitFileOpen == null) {
      btnUnitFileOpen = new JButton();
      btnUnitFileOpen.setText("...");
      btnUnitFileOpen.setMargin(new Insets(0, 0, 0, 0));
      btnUnitFileOpen.addActionListener(
          new java.awt.event.ActionListener() {
            @Override
            public void actionPerformed(java.awt.event.ActionEvent e) {
              execFileChooser(
                  txtUnitFile,
                  new FileFilter() {

                    @Override
                    public String getDescription() {
                      return "SOMLib Unit Files";
                    }

                    @Override
                    public boolean accept(File f) {
                      if (f.isDirectory()
                          || f.getName().endsWith(".unit")
                          || f.getName().endsWith(".unit.gz")) {
                        return true;
                      }
                      return false;
                    }
                  },
                  false,
                  false);
            }
          });
    }
    return btnUnitFileOpen;
  }
Example #15
0
  private JButton makeIncrementButton(
      Devices.Keys devKey, Properties.Keys propKey, String label, float incrementAmount) {
    class incrementButtonActionListener implements ActionListener {
      private final Devices.Keys devKey_;
      private final Properties.Keys propKey_;
      private final float incrementAmount_;

      @Override
      public void actionPerformed(ActionEvent e) {
        try {
          props_.setPropValue(
              devKey_,
              propKey_,
              incrementAmount_ + props_.getPropValueFloat(devKey_, propKey_),
              true);
          props_.callListeners(); // update GUI
        } catch (Exception ex) {
          MyDialogUtils.showError(ex);
        }
      }

      private incrementButtonActionListener(
          Devices.Keys devKey, Properties.Keys propKey, float incrementAmount) {
        devKey_ = devKey;
        propKey_ = propKey;
        incrementAmount_ = incrementAmount;
      }
    }

    JButton jb = new JButton(label);
    jb.setMargin(new Insets(4, 8, 4, 8));
    ActionListener l = new incrementButtonActionListener(devKey, propKey, incrementAmount);
    jb.addActionListener(l);
    return jb;
  }
 /**
  * Renvoit le JPanel de gauche, avec le titre du champ. Utilisé dans le cas où il n'y a pas
  * d'enfants.
  */
 private JPanel getPanelGauche() {
   panelGauche = new JPanel(new FlowLayout(FlowLayout.LEFT));
   final JButton baide = new JButton(new ActionAide(refNoeud));
   baide.setFont(baide.getFont().deriveFont((float) 9));
   if (System.getProperty("os.name").startsWith("Mac OS")) {
     baide.setText("?");
     if ("10.5".compareTo(System.getProperty("os.version")) <= 0)
       baide.putClientProperty("JButton.buttonType", "help");
     else baide.putClientProperty("JButton.buttonType", "toolbar");
   } else {
     baide.setIcon(new ImageIcon(ImageKeeper.loadImage("images/aide.png")));
     baide.setMargin(new Insets(0, 0, 0, 0));
     baide.setBorderPainted(false);
     baide.setContentAreaFilled(false);
   }
   String documentation = getDocumentation();
   if (documentation != null) baide.setToolTipText(documentation);
   if (documentation == null && attribut) baide.setEnabled(false);
   panelGauche.add(baide);
   labelTitre = new JLabel(getTitre());
   if (affParent != null) {
     if (obligatoire()) labelTitre.setForeground(couleurObligatoire);
     else labelTitre.setForeground(couleurFacultatif);
   }
   panelGauche.add(labelTitre);
   return (panelGauche);
 }
 /** Panel avec le titre de l'élément, et les boutons d'aide et d'attributs de l'élément */
 private JPanel getPanelTitre() {
   final JButton baide = new JButton(new ActionAide(refNoeud));
   baide.setFont(baide.getFont().deriveFont((float) 9));
   if (System.getProperty("os.name").startsWith("Mac OS")) {
     baide.setText("?");
     if ("10.5".compareTo(System.getProperty("os.version")) <= 0)
       baide.putClientProperty("JButton.buttonType", "help");
     else baide.putClientProperty("JButton.buttonType", "toolbar");
   } else {
     baide.setIcon(new ImageIcon(ImageKeeper.loadImage("images/aide.png")));
     baide.setMargin(new Insets(0, 0, 0, 0));
     baide.setBorderPainted(false);
     baide.setContentAreaFilled(false);
   }
   String documentation = getDocumentation();
   if (documentation != null) baide.setToolTipText(documentation);
   final JPanel panelTitre = new JPanel();
   panelTitre.add(baide);
   final JLabel labelTitre = new JLabel(getTitre());
   Color couleurTitre;
   if (affParent != null) {
     if (obligatoire()) couleurTitre = couleurObligatoire;
     else couleurTitre = couleurFacultatif;
   } else couleurTitre = panelEnfants.getForeground();
   labelTitre.setForeground(couleurTitre);
   panelTitre.add(labelTitre);
   panelTitre.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
   final JPanel panelNord = new JPanel(new FlowLayout(FlowLayout.LEADING, 0, 0));
   panelNord.add(panelTitre);
   return (panelNord);
 }
Example #18
0
  /**
   * Installs a Tool in the Toolbar
   *
   * @param toolbar as JToolbar
   * @param tool, Tool to install
   */
  public void installToolInToolBar(JToolBar toolbar, final Tool tool) {
    final JButton button;
    button = new JButton();

    button.setMargin(new Insets(0, 0, 0, 0));

    if (tool.getItemType() != null) {
      button.setIcon(tool.getItemType().getIcon());
      button.setToolTipText(tool.getItemType().getDescription());

    } else {
      button.setText("Tool"); // For Debugging
    }
    toolbar.add(button);
    toolButtons.add(button);
    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            WorkingView.this.setTool(tool, button);
          }
        });
    button.setContentAreaFilled(false);
    button.setBorderPainted(false);
    button.addMouseListener(
        new MouseAdapter() {
          public void mouseEntered(MouseEvent e) {
            ((JButton) e.getSource()).setBorderPainted(true);
          }

          public void mouseExited(MouseEvent e) {
            ((JButton) e.getSource()).setBorderPainted(false);
          }
        });
  }
Example #19
0
    public ManageScreen(String type, Screen callerScreen) {
      caller = callerScreen;

      Eve.setLayout(new MigLayout("wrap 3", "[][grow 25][grow 75]", "[][][grow]"));
      this.type = type;

      back.addActionListener(
          (ActionEvent e) -> {
            caller.refresh();
            caller.Return();
          });
      addB.setMargin(new Insets(0, 0, 0, 0));
      addB.addActionListener(
          (ActionEvent e) -> {
            if (type.matches("player")) {
              new ModifyPlayerPopup(null, this, null);
            } else if (type.matches("team")) {
              called = new ModifyTeamScreen(null, this);
              called.Switch();
            }
          });

      view.setBorder(BorderFactory.createLineBorder(Color.black));

      viewScroll.getVerticalScrollBar().setUnitIncrement(16);

      this.drawScreen();
    }
Example #20
0
  private JPanel createAudioPane() {
    JPanel audioPane = new JPanel();

    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();

    audioPane.setLayout(gridbag);

    c.gridx = 0;
    c.gridy = 0;
    c.insets = new Insets(3, 3, 3, 3);
    gridbag.setConstraints(lAudioDevice, c);
    audioPane.add(lAudioDevice);

    c.gridx = 1;
    c.gridy = 0;
    gridbag.setConstraints(cbAudioDevice, c);
    audioPane.add(cbAudioDevice);

    btnAudioProps.setMargin(new Insets(0, 0, 0, 0));
    c.gridx = 2;
    c.gridy = 0;
    c.insets = new Insets(3, 9, 3, 3);
    gridbag.setConstraints(btnAudioProps, c);
    audioPane.add(btnAudioProps);

    String s = i18n.getLabel("ChannelProperties.audioPane");
    audioPane.setBorder(BorderFactory.createTitledBorder(s));

    return audioPane;
  }
Example #21
0
  /**
   * builds the panel with the button row
   *
   * @return the panel
   */
  protected JPanel buildButtonsPanel() {
    JPanel pnl = new JPanel();
    pnl.setLayout(new BoxLayout(pnl, BoxLayout.Y_AXIS));

    // add action
    JButton btn;
    pnl.add(btn = new JButton(tblTagEditor.getAddAction()));
    btn.setMargin(new Insets(0, 0, 0, 0));
    tblTagEditor.addComponentNotStoppingCellEditing(btn);

    // delete action
    pnl.add(btn = new JButton(tblTagEditor.getDeleteAction()));
    btn.setMargin(new Insets(0, 0, 0, 0));
    tblTagEditor.addComponentNotStoppingCellEditing(btn);
    return pnl;
  }
Example #22
0
  private void initialize() {
    setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
    setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
    fileLabel = new JLabel(I18n.text("(no log loaded)"));
    fileLabel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
    fileLabel.setBackground(Color.white);
    fileLabel.setOpaque(true);
    filePanel.add(fileLabel, BorderLayout.CENTER);
    fileSelection = new JButton("...");
    fileSelection.setMargin(new Insets(1, 1, 1, 1));
    fileSelection.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            selectFile();
          }
        });
    filePanel.add(fileSelection, BorderLayout.EAST);
    filePanel.setMaximumSize(new Dimension(200, 25));
    add(filePanel);
    overlaysPanel = new JPanel();
    overlaysPanel.setLayout(new BoxLayout(overlaysPanel, BoxLayout.PAGE_AXIS));
    add(new JScrollPane(overlaysPanel));
  }
Example #23
0
  /**
   * Create a button to go inside of the toolbar. By default this will load an image resource. The
   * image filename is relative to the classpath (including the '.' directory if its a part of the
   * classpath), and may either be in a JAR file or a separate file.
   *
   * @param key The key in the resource file to serve as the basis of lookups.
   */
  protected JButton createToolbarButton(String key) {
    URL url = getResource(key + imageSuffix);
    JButton b =
        new JButton(new ImageIcon(url)) {

          @Override
          public float getAlignmentY() {
            return 0.5f;
          }
        };
    b.setRequestFocusEnabled(false);
    b.setMargin(new Insets(1, 1, 1, 1));

    String astr = getProperty(key + actionSuffix);
    if (astr == null) {
      astr = key;
    }
    Action a = getAction(astr);
    if (a != null) {
      b.setActionCommand(astr);
      b.addActionListener(a);
    } else {
      b.setEnabled(false);
    }

    String tip = getResourceString(key + tipSuffix);
    if (tip != null) {
      b.setToolTipText(tip);
    }

    return b;
  }
  private JButton createHeaderPopupCornerButton(final JPopupMenu headerPopup) {
    final JButton cornerButton = new JButton(Icons.getIcon(GeneralIcons.HIDE_COLUMN));
    cornerButton.setToolTipText(Bundle.ReferencesBrowserControllerUI_ShowHideColumnsString());
    cornerButton.setDefaultCapable(false);

    if (UIUtils.isWindowsClassicLookAndFeel()) {
      cornerButton.setMargin(new Insets(0, 0, 2, 2));
    } else if (UIUtils.isWindowsXPLookAndFeel()) {
      cornerButton.setMargin(new Insets(0, 0, 0, 1));
    } else if (UIUtils.isMetalLookAndFeel()) {
      cornerButton.setMargin(new Insets(0, 0, 2, 1));
    }

    cornerButton.addKeyListener(
        new KeyAdapter() {
          public void keyPressed(final KeyEvent evt) {
            if (evt.getKeyCode() == KeyEvent.VK_SPACE) {
              showColumnSelectionPopup(headerPopup, cornerButton);
            }
          }
        });

    cornerButton.addMouseListener(
        new MouseAdapter() {
          public void mousePressed(MouseEvent mouseEvent) {
            if (headerPopup.isVisible()) {
              internalCornerButtonClick = true;
              cornerButton.getModel().setArmed(false);
            } else {
              internalCornerButtonClick = false;

              if (mouseEvent.getModifiers() == InputEvent.BUTTON3_MASK) {
                showColumnSelectionPopup(headerPopup, cornerButton);
              }
            }
          }

          public void mouseClicked(MouseEvent mouseEvent) {
            if ((mouseEvent.getModifiers() == InputEvent.BUTTON1_MASK)
                && (!internalCornerButtonClick)) {
              showColumnSelectionPopup(headerPopup, cornerButton);
            }
          }
        });

    return cornerButton;
  }
Example #25
0
  @Override
  public JComponent createUI(
      DescriptionType inputOrOutput, Map<URI, Object> dataMap, Orientation orientation) {
    // Create the main panel
    JComponent component = new JPanel(new MigLayout("fill"));

    boolean isOptional = false;
    if (inputOrOutput instanceof InputDescriptionType) {
      isOptional =
          ((InputDescriptionType) inputOrOutput).getMinOccurs().equals(new BigInteger("0"));
    }
    // Display the SourceCA into a JTextField
    JTextField jtf = new JTextField();
    jtf.setToolTipText(inputOrOutput.getAbstract().get(0).getValue());
    // "Save" the CA inside the JTextField
    jtf.getDocument().putProperty(DATA_MAP_PROPERTY, dataMap);
    URI uri = URI.create(inputOrOutput.getIdentifier().getValue());
    jtf.getDocument().putProperty(URI_PROPERTY, uri);
    // add the listener for the text changes in the JTextField
    jtf.getDocument()
        .addDocumentListener(
            EventHandler.create(DocumentListener.class, this, "saveDocumentText", "document"));
    if (isOptional) {
      if (dataMap.containsKey(uri)) {
        jtf.setText(dataMap.get(uri).toString());
      }
    }

    GeometryData geometryData = null;
    if (inputOrOutput instanceof InputDescriptionType) {
      geometryData =
          (GeometryData) ((InputDescriptionType) inputOrOutput).getDataDescription().getValue();
    }
    // If the DescriptionType is an output, there is nothing to show, so exit
    if (geometryData == null) {
      return null;
    }

    component.add(jtf, "growx");

    if (orientation.equals(Orientation.VERTICAL)) {
      JPanel buttonPanel = new JPanel(new MigLayout());

      // Create the button Browse
      JButton pasteButton = new JButton(ToolBoxIcon.getIcon(ToolBoxIcon.PASTE));
      // "Save" the sourceCA and the JTextField in the button
      pasteButton.putClientProperty(TEXT_FIELD_PROPERTY, jtf);
      pasteButton.setBorderPainted(false);
      pasteButton.setContentAreaFilled(false);
      pasteButton.setMargin(new Insets(0, 0, 0, 0));
      // Add the listener for the click on the button
      pasteButton.addActionListener(EventHandler.create(ActionListener.class, this, "onPaste", ""));
      buttonPanel.add(pasteButton);

      component.add(buttonPanel, "dock east");
    }

    return component;
  }
 private void init() {
   setTitle("Synchronization Results");
   // Add a OK button
   JPanel southPane = new JPanel();
   southPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 8, 8));
   JButton closeBtn = new JButton("Close");
   closeBtn.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           dispose();
         }
       });
   closeBtn.setMnemonic('C');
   closeBtn.setDefaultCapable(true);
   getRootPane().setDefaultButton(closeBtn);
   southPane.add(closeBtn);
   getContentPane().add(southPane, BorderLayout.SOUTH);
   // Initialize actions
   initUpdateFromDBAction();
   initCommitToDBAction();
   initShowComparisonAction();
   initClearRecordAction();
   // Add a toolbar
   JToolBar toolbar = new JToolBar();
   Insets insets = new Insets(0, 0, 0, 0);
   JButton updateFromDBBtn = toolbar.add(updateFromDBAction);
   updateFromDBBtn.setText((String) updateFromDBAction.getValue(Action.NAME));
   JButton commitToDBBtn = toolbar.add(commitToDBAction);
   commitToDBBtn.setText((String) commitToDBAction.getValue(Action.NAME));
   JButton showComparisonBtn = toolbar.add(showComparisonAction);
   showComparisonBtn.setText((String) showComparisonAction.getValue(Action.NAME));
   JButton clearRecordBtn = toolbar.add(clearRecordAction);
   clearRecordBtn.setText((String) clearRecordAction.getValue(Action.NAME));
   if (!GKApplicationUtilities.isMac()) {
     updateFromDBBtn.setMargin(insets);
     commitToDBBtn.setMargin(insets);
     showComparisonBtn.setMargin(insets);
     clearRecordBtn.setMargin(insets);
   }
   getContentPane().add(toolbar, BorderLayout.NORTH);
   setSize(600, 700);
   GKApplicationUtilities.center(this);
   setModal(true);
   isLocalHasUnexpIECommitAllowed =
       SynchronizationManager.getManager().isLocalHasUnexpIECommitAllowed();
 }
 /**
  * Creates a JButton with an X
  *
  * @return the button
  */
 private JButton createXButton() {
   JButton closeButton = new JButton("X");
   closeButton.setOpaque(false);
   closeButton.setMargin(null);
   closeButton.setFont(closeButton.getFont().deriveFont(Font.BOLD).deriveFont((float) 10));
   closeButton.setBorder(new EmptyBorder(1, 1, 1, 1));
   return closeButton;
 }
Example #28
0
  public JToolBar getToolBar() {
    JToolBar toolBar = new JToolBar();
    toolBar.setOpaque(false);
    toolBar.setBorder(null);
    toolBar.setFloatable(false);
    toolBar.setBorderPainted(false);

    Insets insets = new Insets(6, 0, 0, 0);
    JButton button = null;
    button = toolBar.add(new NovoAction(this));
    button.setMargin(insets);
    button = toolBar.add(new CancelarAction(this));
    button.setMargin(insets);
    button = toolBar.add(new SalvarAction(this));
    button.setMargin(insets);
    button = toolBar.add(new ExcluirAction(this));
    button.setMargin(insets);
    button = toolBar.add(new PesquisarAction(this));
    button.setMargin(insets);
    button = toolBar.add(new LimparAction(this));
    button.setMargin(insets);
    button = toolBar.add(new ImprimirAction(this));
    button.setMargin(insets);
    toolBar.addSeparator(new Dimension(20, 10));
    return toolBar;
  }
Example #29
0
  /**
   * Static component init
   *
   * @throws Exception
   */
  void jbInit() throws Exception {
    panel.setLayout(panelLayout);
    southPanel.setLayout(southLayout);
    mainPanel.setLayout(gridBagLayout);
    panelLayout.setHgap(5);
    panelLayout.setVgap(10);
    getContentPane().add(panel);
    panel.add(mainPanel, BorderLayout.NORTH);
    panel.add(southPanel, BorderLayout.SOUTH);
    southPanel.add(confirmPanel, BorderLayout.CENTER);

    toLink.setText(TO_LINK);
    toLink.addActionListener(this);
    toLink.setMargin(ConfirmPanel.s_insets);
    confirmPanel.addComponent(toLink);

    toRoute.setText(TO_ROUTE);
    toRoute.addActionListener(this);
    toRoute.setMargin(ConfirmPanel.s_insets);
    confirmPanel.addComponent(toRoute);

    getAddress.setText("Procurar");
    getAddress.addActionListener(this);
    getAddress.setMargin(ConfirmPanel.s_insets);
    confirmPanel.addComponent(getAddress);
    //

    fAddress1.setMandatory(
        new MColumn(Env.getCtx(), MColumn.getColumn_ID("C_Location", "Address1"), null)
            .isMandatory());
    fAddress2.setMandatory(
        new MColumn(Env.getCtx(), MColumn.getColumn_ID("C_Location", "Address2"), null)
            .isMandatory());
    fAddress3.setMandatory(
        new MColumn(Env.getCtx(), MColumn.getColumn_ID("C_Location", "Address3"), null)
            .isMandatory());
    fAddress4.setMandatory(
        new MColumn(Env.getCtx(), MColumn.getColumn_ID("C_Location", "Address4"), null)
            .isMandatory());
    fPostal.setMandatory(
        new MColumn(Env.getCtx(), MColumn.getColumn_ID("C_Location", "Postal"), null)
            .isMandatory());

    confirmPanel.addActionListener(this);
  } //	jbInit
Example #30
0
 public void setButton(JButton jbtn) {
   jbtn.setOpaque(false);
   jbtn.setMargin(new Insets(0, 0, 0, 0));
   jbtn.setContentAreaFilled(false);
   jbtn.setFocusPainted(false);
   jbtn.setBorderPainted(false);
   jbtn.setBorder(null);
   jbtn.addMouseListener(new ButtonListener());
 }