Java Code Examples for javax.swing.JToolBar#add()

The following examples show how to use javax.swing.JToolBar#add() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GUIFrame.java    From jaamsim with Apache License 2.0 6 votes vote down vote up
private void addShowLinksButton(JToolBar buttonBar, Insets margin) {
	showLinks = new JToggleButton(new ImageIcon(GUIFrame.class.getResource("/resources/images/ShowLinks-16.png")));
	showLinks.setToolTipText(formatToolTip("Show Entity Flow",
			"When selected, arrows are shown between objects to indicate the flow of entities."));
	showLinks.setMargin(margin);
	showLinks.setFocusPainted(false);
	showLinks.setRequestFocusEnabled(false);
	showLinks.addActionListener(new ActionListener() {
		@Override
		public void actionPerformed( ActionEvent event ) {
			boolean bShow = (((JToggleButton)event.getSource()).isSelected());
			if (RenderManager.isGood()) {
				RenderManager.inst().setShowLinks(bShow);
				RenderManager.redraw();
			}
			controlStartResume.requestFocusInWindow();
		}

	});
	buttonBar.add( showLinks );
}
 
Example 2
Source File: ToolBarManager.java    From openAGV with Apache License 2.0 6 votes vote down vote up
/**
   * Method addSelectionToolButton must have been invoked prior to this on the
   * JToolBar.
   *
   * @param toolBar
   * @param editor
   * @param tool
   * @param toolTipText
   * @param labels
   * @return
   */
  private JToggleButton addToolButton(JToolBar toolBar,
                                      DrawingEditor editor,
                                      Tool tool,
                                      String toolTipText,
                                      ImageIcon iconBase) {
    JToggleButton toggleButton = new JToggleButton();

    toggleButton.setIcon(iconBase);
    toggleButton.setText(null);
    toggleButton.setToolTipText(toolTipText);
    toggleButton.addItemListener(new ToolButtonListener(tool, editor));
//    toggleButton.setFocusable(false);

    ToolListener toolHandler = (ToolListener) toolBar.getClientProperty("toolHandler");
    tool.addToolListener(toolHandler);

    ButtonGroup group = (ButtonGroup) toolBar.getClientProperty("toolButtonGroup");
    group.add(toggleButton);
    toolBar.add(toggleButton);

    return toggleButton;
  }
 
Example 3
Source File: GUIFrame.java    From jaamsim with Apache License 2.0 6 votes vote down vote up
private void addSnapToGridButton(JToolBar buttonBar, Insets margin) {
	snapToGrid = new JToggleButton( new ImageIcon(
			GUIFrame.class.getResource("/resources/images/Snap-16.png")) );
	snapToGrid.setMargin(margin);
	snapToGrid.setFocusPainted(false);
	snapToGrid.setRequestFocusEnabled(false);
	snapToGrid.setToolTipText(formatToolTip("Snap to Grid",
			"During repositioning, objects are forced to the nearest grid point."));
	snapToGrid.addActionListener( new ActionListener() {

		@Override
		public void actionPerformed( ActionEvent event ) {
			KeywordIndex kw = InputAgent.formatBoolean("SnapToGrid", snapToGrid.isSelected());
			InputAgent.storeAndExecute(new KeywordCommand(sim.getSimulation(), kw));
			gridSpacing.setEnabled(snapToGrid.isSelected());
			controlStartResume.requestFocusInWindow();
		}
	} );

	buttonBar.add( snapToGrid );
}
 
Example 4
Source File: ConsoleWindow.java    From triplea with GNU General Public License v3.0 6 votes vote down vote up
private JToolBar createButtonsToolBar(final ConsoleModel model) {
  final JToolBar buttonsToolBar = new JToolBar(SwingConstants.HORIZONTAL);
  buttonsToolBar.setFloatable(false);
  buttonsToolBar.setLayout(new FlowLayout());
  buttonsToolBar.add(
      SwingAction.of("Enumerate Threads", () -> ConsoleModel.enumerateThreadsAction(this)));
  buttonsToolBar.add(SwingAction.of("Memory", () -> ConsoleModel.memoryAction(this)));
  buttonsToolBar.add(SwingAction.of("Properties", () -> ConsoleModel.propertiesAction(this)));
  buttonsToolBar.add(
      SwingAction.of("Copy to clipboard", () -> model.copyToClipboardAction(this)));
  buttonsToolBar.add(SwingAction.of("Clear", () -> ConsoleModel.clearAction(this)));

  buttonsToolBar.add(
      JComboBoxBuilder.builder(String.class)
          .selectedItem(ConsoleModel.getCurrentLogLevel())
          .items(ConsoleModel.getLogLevelOptions())
          .itemSelectedAction(ConsoleModel::setLogLevel)
          .toolTipText("Increase or decrease log messages printed to console")
          .build());
  return buttonsToolBar;
}
 
Example 5
Source File: ReportEditorTest.java    From ramus with GNU General Public License v3.0 6 votes vote down vote up
public ReportEditorTest() {
    setSize(1200, 800);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setLocationRelativeTo(null);
    JPanel panel = new JPanel(new BorderLayout());

    XMLDiagram diagram = new XMLDiagram();
    ReportEditor editor = new ReportEditor(diagram);

    setContentPane(panel);
    JScrollPane pane = new JScrollPane(editor);

    panel.add(pane, BorderLayout.CENTER);
    JToolBar bar = new JToolBar();
    panel.add(bar, BorderLayout.NORTH);
    for (Action action : editor.getActions()) {
        JButton button = bar.add(action);
        button.setText((String) action.getValue(Action.ACTION_COMMAND_KEY));
    }

}
 
Example 6
Source File: TransportOrdersContainerPanel.java    From openAGV with Apache License 2.0 5 votes vote down vote up
private JToolBar createToolBar(List<FilterButton> filterButtons) {
  JToolBar toolBar = new JToolBar();

  for (FilterButton button : filterButtons) {
    toolBar.add(button);
  }

  return toolBar;
}
 
Example 7
Source File: ToolBar.java    From OpERP with MIT License 5 votes vote down vote up
private ToolBar() {
	toolBar = new JToolBar(SwingConstants.HORIZONTAL);
	toolBar.setRollover(true);

	toolBar.add(new JButton("New"));
	toolBar.add(new JButton("Edit"));

}
 
Example 8
Source File: SnapshotDiffView.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
public DataViewComponent.MasterView getMasterView() {
    try {
        JComponent memoryDiffPanel = (JComponent)sdw.getComponent(0);
        memoryDiffPanel.setOpaque(false);
        final JToolBar toolBar = (JToolBar)memoryDiffPanel.getComponent(1);
        toolBar.setOpaque(false);
        ((JComponent)toolBar.getComponent(0)).setOpaque(false);
        ((JComponent)toolBar.getComponent(1)).setOpaque(false);
        ((JComponent)toolBar.getComponent(3)).setOpaque(false);
        ((JComponent)toolBar.getComponent(4)).setOpaque(false);
        ((JComponent)toolBar.getComponent(5)).setOpaque(false);

        JPanel toolbarSpacer = new JPanel(null) {
            public Dimension getPreferredSize() {
                if (UISupport.isGTKLookAndFeel() || UISupport.isNimbusLookAndFeel()) {
                    int currentWidth = toolBar.getSize().width;
                    int minimumWidth = toolBar.getMinimumSize().width;
                    int extraWidth = currentWidth - minimumWidth;
                    return new Dimension(Math.max(extraWidth, 0), 0);
                } else {
                    return super.getPreferredSize();
                }
            }
        };
        toolbarSpacer.setOpaque(false);
        Component descriptionLabel = toolBar.getComponent(7);
        toolBar.remove(descriptionLabel);
        toolBar.remove(6);
        toolBar.add(toolbarSpacer);
        toolBar.add(descriptionLabel);
    } catch (Exception e) {}

    sdw.setPreferredSize(new Dimension(1, 1));
    SnapshotDiffContainer snapshotDiff = (SnapshotDiffContainer)getDataSource();
    String caption = NbBundle.getMessage(SnapshotDiffView.class, "DESCR_Snapshots_Comparison", // NOI18N
            new Object[] { DataSourceDescriptorFactory.getDescriptor(snapshotDiff.getSnapshot1()).getName(),
                           DataSourceDescriptorFactory.getDescriptor(snapshotDiff.getSnapshot2()).getName()});
    return new DataViewComponent.MasterView(caption, null, sdw);   // NOI18N
}
 
Example 9
Source File: ActionDeletePage.java    From wpcleaner with Apache License 2.0 5 votes vote down vote up
/**
 * Add a button for deleting a page.
 * 
 * @param toolbar Tool bar.
 * @param parent Parent component.
 * @param pageProvider Page provider.
 * @param listener Listener.
 * @param showIcon True if the button should use an icon.
 * @return Button.
 */
public static JButton addButton(
    JToolBar toolbar,
    Component parent, PageProvider pageProvider,
    ListenerPageDeletion listener,
    boolean showIcon) {
  JButton button = createButton(parent, pageProvider, listener, showIcon);
  if ((button != null) && (toolbar != null)) {
    toolbar.add(button);
  }
  return button;
}
 
Example 10
Source File: FrmCustom.java    From MeteoInfo with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void init_Figure() {
    JFrame window = getFrame();

    JMenuBar menuBar = new JMenuBar();
    menuBar.add(new JMenu("File"));
    menuBar.add(new JMenu("Figure"));

    window.setJMenuBar(menuBar);
    
    JToolBar toolBar = new JToolBar();
    JButton jButton_ZoomIn = new JButton();
    jButton_ZoomIn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/TSB_ZoomIn.Image.png"))); // NOI18N
    jButton_ZoomIn.setToolTipText("Zoom In"); // NOI18N
    jButton_ZoomIn.setFocusable(false);
    jButton_ZoomIn.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
    jButton_ZoomIn.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
    jButton_ZoomIn.addActionListener(new java.awt.event.ActionListener() {
        @Override
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            //jButton_ZoomInActionPerformed(evt);
        }
    });
    toolBar.add(jButton_ZoomIn);
    
    JButton jButton_ZoomOut = new JButton();
    JButton jButton_Pan = new JButton();
    JButton jButton_FullExtent = new JButton();
            
    //window.getContentPane().setLayout(new GridLayout(2, 1));
    //window.add(toolBar);
    window.getContentPane().add(toolBar, BorderLayout.PAGE_START);
}
 
Example 11
Source File: PipeApplicationBuilder.java    From PIPE with MIT License 5 votes vote down vote up
/**
 * Creates and adds the token view combo box to the view
 *
 * @param toolBar the JToolBar to add the combo box to
 * @param action  the action that the tokenClassComboBox performs when selected
 * @param view  application view 
 */
private void addTokenClassComboBox(JToolBar toolBar, Action action, PipeApplicationView view) {
    String[] tokenClassChoices = new String[]{"Default"};
    DefaultComboBoxModel<String> model = new DefaultComboBoxModel<>(tokenClassChoices);
    JComboBox<String> tokenClassComboBox = new JComboBox<>(model);
    tokenClassComboBox.setEditable(true);
    tokenClassComboBox.setSelectedItem(tokenClassChoices[0]);
    tokenClassComboBox.setMaximumRowCount(100);
    tokenClassComboBox.setEditable(false);
    tokenClassComboBox.setAction(action);
    view.register(tokenClassComboBox);
    toolBar.add(tokenClassComboBox);
}
 
Example 12
Source File: TerminalContainerCommon.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void fixSize(JToolBar actionBar) {
    Insets ins = actionBar.getMargin();
    JButton dummy = new JButton();
    dummy.setBorderPainted(false);
    dummy.setOpaque(false);
    dummy.setText(null);
    dummy.setIcon(new Icon() {

 @Override
        public int getIconHeight() {
            return 16;
        }

 @Override
        public int getIconWidth() {
            return 16;
        }

        @SuppressWarnings(value = "empty-statement")
 @Override
        public void paintIcon(Component c, Graphics g, int x, int y) {
            ;
        }
    });
    actionBar.add(dummy);
    Dimension buttonPref = dummy.getPreferredSize();
    Dimension minDim = new Dimension(buttonPref.width + ins.left + ins.right, buttonPref.height + ins.top + ins.bottom);
    actionBar.setMinimumSize(minDim);
    actionBar.setPreferredSize(minDim);
    actionBar.remove(dummy);
}
 
Example 13
Source File: GUIFrame.java    From jaamsim with Apache License 2.0 5 votes vote down vote up
private void addFontColourButton(JToolBar buttonBar, Insets margin) {

		colourIcon = new ColorIcon(16, 16);
		colourIcon.setFillColor(Color.LIGHT_GRAY);
		colourIcon.setOutlineColor(Color.LIGHT_GRAY);
		fontColour = new JButton(colourIcon);
		fontColour.setMargin(margin);
		fontColour.setFocusPainted(false);
		fontColour.setRequestFocusEnabled(false);
		fontColour.setToolTipText(formatToolTip("Font Colour", "Sets the colour of the text."));
		fontColour.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed( ActionEvent event ) {
				if (!(selectedEntity instanceof TextEntity))
					return;
				final TextEntity textEnt = (TextEntity) selectedEntity;
				final Color4d presentColour = textEnt.getFontColor();
				ArrayList<Color4d> coloursInUse = GUIFrame.getFontColoursInUse(sim);
				ColourMenu fontMenu = new ColourMenu(presentColour, coloursInUse, true) {

					@Override
					public void setColour(String colStr) {
						KeywordIndex kw = InputAgent.formatInput("FontColour", colStr);
						InputAgent.storeAndExecute(new KeywordCommand(selectedEntity, kw));
					}

				};
				fontMenu.show(fontColour, 0, fontColour.getPreferredSize().height);
				controlStartResume.requestFocusInWindow();
			}
		});

		buttonBar.add( fontColour );
	}
 
Example 14
Source File: HMMapframe.java    From hortonmachine with GNU General Public License v3.0 5 votes vote down vote up
private static HMMapframe getBaseFrame( String title, boolean exitOnClose ) {
    ImageIcon icon = new ImageIcon(ImageCache.getInstance().getBufferedImage(ImageCache.HORTONMACHINE_FRAME_ICON));
    HMMapframe mapFrame = new HMMapframe(title);
    mapFrame.setIconImage(icon.getImage());
    mapFrame.enableToolBar(true);
    mapFrame.enableStatusBar(true);
    mapFrame.enableLayerTable(true);
    mapFrame.enableTool(Tool.PAN, Tool.ZOOM, Tool.RESET, Tool.INFO);
    if (exitOnClose) {
        mapFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    } else {
        mapFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    }
    mapFrame.setSize(1200, 900);
    mapFrame.setVisible(true);

    JToolBar toolBar = mapFrame.getToolBar();
    toolBar.add(new AbstractAction("Add OSM background", ImageCache.getInstance().getImage(ImageCache.GLOBE)){
        @Override
        public void actionPerformed( ActionEvent e ) {
            String baseURL = "http://tile.openstreetmap.org/";
            TileService service = new OSMService("OpenStreetMap", baseURL);
            TileLayer layer = new TileLayer(service);
            layer.setTitle("OpenStreetMap");
            mapFrame.addLayerBottom(layer);
        }
    });
    return mapFrame;
}
 
Example 15
Source File: ToggleDropDownButton.java    From rapidminer-studio with GNU Affero General Public License v3.0 4 votes vote down vote up
public JToggleButton addToToolBar(JToolBar toolbar) {
	toolbar.add(mainButton);
	toolbar.add(arrowButton);
	return mainButton;
}
 
Example 16
Source File: LogPanel.java    From nextreports-designer with Apache License 2.0 4 votes vote down vote up
public LogPanel() {
    if (tailer == null) {

        setPreferredSize(new Dimension(400, 300));
        setLayout(new BorderLayout());

        textArea = new JTextArea();
        textArea.setEditable(false);
        textArea.setLineWrap(true);
        textArea.setWrapStyleWord(true);
        JScrollPane scrollPanel = new JScrollPane(textArea);

        linesTextField = new JTextField();
        linesTextField.setPreferredSize(dim);
        linesTextField.setMinimumSize(dim);
        linesTextField.setMaximumSize(dim);
        linesTextField.setText(String.valueOf(LINES));

        JToolBar toolBar = new JToolBar();
        toolBar.setRollover(true);
        toolBar.add(new ClearLogAction(textArea));
        toolBar.add(new ReloadLogAction(textArea, this));

        JPanel topPanel = new JPanel();
        topPanel.setLayout(new BoxLayout(topPanel, BoxLayout.X_AXIS));
        topPanel.add(toolBar);
        topPanel.add(Box.createHorizontalStrut(5));
        topPanel.add(new JLabel(I18NSupport.getString("logpanel.last.lines")));
        topPanel.add(Box.createHorizontalStrut(5));
        topPanel.add(linesTextField);
        topPanel.add(Box.createHorizontalGlue());

        add(topPanel, BorderLayout.NORTH);
        add(scrollPanel, BorderLayout.CENTER);

        final File log = new File(LOG);
        if (!log.exists()) {
            try {
                new File(LOG_DIR).mkdirs();
                boolean created = log.createNewFile();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }

        // read existing text in log
        Thread t = new Thread(new Runnable() {
            public void run() {
                Cursor hourGlassCursor = new Cursor(Cursor.WAIT_CURSOR);
                setCursor(hourGlassCursor);

                //@todo
                //reload(log, textArea);

                tailer = new LogFileTailer(log, 1000, false);
                tailer.addLogFileTailerListener(LogPanel.this);
                tailer.setPriority(Thread.MIN_PRIORITY);

                // very consuming !!!
                //tailer.start();

                Cursor normalCursor = new Cursor(Cursor.DEFAULT_CURSOR);
                setCursor(normalCursor);
            }
        }, "NEXT : " + getClass().getSimpleName());
        t.start();

    }
}
 
Example 17
Source File: Options.java    From audiveris with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Creates a new Options object.
 */
public Options ()
{
    // Preload constant units
    UnitManager.getInstance().preLoadUnits();

    frame = new JFrame();
    frame.setName("optionsFrame");
    frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    JComponent framePane = (JComponent) frame.getContentPane();
    framePane.setLayout(new BorderLayout());

    InputMap inputMap = framePane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    ActionMap actionMap = framePane.getActionMap();

    JToolBar toolBar = new JToolBar(JToolBar.HORIZONTAL);
    framePane.add(toolBar, BorderLayout.NORTH);

    // Dump button
    JButton dumpButton = new JButton(dumping);
    dumpButton.setName("optionsDumpButton");
    toolBar.add(dumpButton);

    // Check button
    JButton checkButton = new JButton(checking);
    checkButton.setName("optionsCheckButton");
    toolBar.add(checkButton);

    // Reset button
    JButton resetButton = new JButton(resetting);
    resetButton.setName("optionsResetButton");
    toolBar.add(resetButton);

    // Some space
    toolBar.add(Box.createHorizontalStrut(100));

    toolBar.add(new JLabel("Search:"));

    // Back button
    JButton backButton = new JButton(backSearch);
    backButton.setName("optionsBackButton");
    toolBar.add(backButton);
    inputMap.put(KeyStroke.getKeyStroke("shift F3"), "backSearch");
    actionMap.put("backSearch", backSearch);

    // Search entry
    searchField = new JTextField();
    searchField.setMaximumSize(new Dimension(200, 28));
    searchField.setName("optionsSearchField");
    searchField.setHorizontalAlignment(JTextField.LEFT);
    toolBar.add(searchField);
    inputMap.put(KeyStroke.getKeyStroke("ctrl F"), "find");
    actionMap.put("find", find);
    searchField.getDocument().addDocumentListener(docListener);

    // Forward button
    JButton forwardButton = new JButton(forwardSearch);
    forwardButton.setName("optionsForwardButton");
    toolBar.add(forwardButton);

    // Some space, message field
    toolBar.add(Box.createHorizontalStrut(10));
    toolBar.add(msgLabel);

    // TreeTable
    UnitModel unitModel = new UnitModel();
    unitTreeTable = new UnitTreeTable(unitModel);
    framePane.add(new JScrollPane(unitTreeTable), BorderLayout.CENTER);

    // Needed to process user input when RETURN/ENTER is pressed
    inputMap.put(KeyStroke.getKeyStroke("ENTER"), "forwardSearch");
    inputMap.put(KeyStroke.getKeyStroke("F3"), "forwardSearch");
    actionMap.put("forwardSearch", forwardSearch);

    // Resources injection
    ResourceMap resource = Application.getInstance().getContext().getResourceMap(getClass());
    resource.injectComponents(frame);

    // Make sure the search entry field gets the focus at creation time
    frame.addWindowListener(new WindowAdapter()
    {
        @Override
        public void windowOpened (WindowEvent e)
        {
            searchField.requestFocus();
        }
    });
}
 
Example 18
Source File: DropDownButton.java    From rapidminer-studio with GNU Affero General Public License v3.0 4 votes vote down vote up
public JButton addToToolbar(JToolBar toolbar, Object mainButtonConstraints, Object arrowButtonConstraints) {
	toolbar.add(mainButton, mainButtonConstraints);
	toolbar.add(arrowButton, arrowButtonConstraints);
	return mainButton;

}
 
Example 19
Source File: OnePageAnalysisWindow.java    From wpcleaner with Apache License 2.0 4 votes vote down vote up
/**
 * @return Links components.
 */
private Component createLinksComponents() {
  JPanel panel = new JPanel(new GridBagLayout());

  listLinks = new JList<Page>(modelLinks);

  // Initialize constraints
  GridBagConstraints constraints = new GridBagConstraints();
  constraints.fill = GridBagConstraints.HORIZONTAL;
  constraints.gridheight = 1;
  constraints.gridwidth = 1;
  constraints.gridx = 0;
  constraints.gridy = 0;
  constraints.insets = new Insets(0, 0, 0, 0);
  constraints.ipadx = 0;
  constraints.ipady = 0;
  constraints.weightx = 1;
  constraints.weighty = 0;

  // Button toolbar
  JToolBar toolbar = new JToolBar(SwingConstants.HORIZONTAL);
  toolbar.setFloatable(false);
  toolbar.setBorderPainted(false);
  ActionFullAnalysis.addButton(
      getParentComponent(), toolbar, getWikipedia(), listLinks, knownPages, true, true);
  ActionDisambiguationAnalysis.addButton(
      getParentComponent(), toolbar, getWikipedia(), listLinks, true, true);
  buttonRemoveLinks = Utilities.createJButton(
      "wpc-remove-link.png", EnumImageSize.NORMAL,
      GT._T("Remove all links"), false, null);
  buttonRemoveLinks.addActionListener(EventHandler.create(
      ActionListener.class, this, "actionRemoveAllLinks"));
  toolbar.add(buttonRemoveLinks);
  buttonWatchLink = ActionWatchPage.createButton(
      getParentComponent(), getWikipedia(), listLinks, true, true);
  toolbar.add(buttonWatchLink);
  constraints.fill = GridBagConstraints.HORIZONTAL;
  constraints.weightx = 1;
  panel.add(toolbar, constraints);
  constraints.gridy++;

  // Links
  constraints.fill = GridBagConstraints.BOTH;
  constraints.weighty = 1;
  listCellRenderer = new PageListCellRenderer();
  listCellRenderer.showCountOccurrence(true);
  listCellRenderer.showDisambiguation(true);
  listCellRenderer.showMissing(true);
  listCellRenderer.showRedirect(true);
  listLinks.setCellRenderer(listCellRenderer);
  popupListenerLinks = new AnalysisPageListPopupListener(
      getWikipedia(), getTextContents(), listLinks, this);
  listLinks.addMouseListener(popupListenerLinks);
  listLinks.addMouseListener(new PageListAnalyzeListener(getWikipedia(), null));
  listLinks.addListSelectionListener(new AnalysisListSelectionListener());
  JScrollPane scrollLinks = new JScrollPane(listLinks);
  scrollLinks.setMinimumSize(new Dimension(100, 100));
  scrollLinks.setPreferredSize(new Dimension(200, 500));
  scrollLinks.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
  panel.add(scrollLinks, constraints);
  constraints.gridy++;

  return panel;
}
 
Example 20
Source File: DBDiagramEngine.java    From jeddict with Apache License 2.0 4 votes vote down vote up
protected void buildReloadTool(JToolBar bar) {
    JButton reloadButton = new JButton(RELOAD_ICON);
    reloadButton.setToolTipText("Reload Diagram");
    bar.add(reloadButton);
    reloadButton.addActionListener(e -> DBViewerAction.reloadDBViewer(file));
}