javax.swing.JToolBar Java Examples

The following examples show how to use javax.swing.JToolBar. 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: PageInspectorImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Processes incoming message for the inspected page.
 * 
 * @param messageTxt message to process.
 */
private void processMessage(final String messageTxt) {
    if (messageTxt == null) {
        synchronized (LOCK) {
            uninitSelectionMode(pageContext.lookup(JToolBar.class));
            if (pageModel == getPage()) {
                inspectPage(Lookup.EMPTY);
            }
        }
    } else {
        try {
            JSONObject message = (JSONObject)JSONValue.parseWithException(messageTxt);
            Object type = message.get(MESSAGE_TYPE);
            // Message about selection mode modification
            if (MESSAGE_SELECTION_MODE.equals(type)) {
                boolean selectionMode = (Boolean)message.get(MESSAGE_SELECTION_MODE_ATTR);
                pageModel.setSelectionMode(selectionMode);
            }
        } catch (ParseException ex) {
            Logger.getLogger(PageInspectorImpl.class.getName())
                    .log(Level.INFO, "Ignoring message that is not in JSON format: {0}", messageTxt); // NOI18N
        }
    }
}
 
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: TestDesignUI.java    From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 6 votes vote down vote up
private JPanel getTreeInPanel(String labelText, JTree tree) {
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());

    JToolBar toolBar = new JToolBar();
    toolBar.setFloatable(false);
    toolBar.setBorder(BorderFactory.createEtchedBorder());
    JLabel label = new JLabel(labelText);
    label.setFont(new Font("Default", Font.BOLD, 12));
    toolBar.add(new javax.swing.Box.Filler(new java.awt.Dimension(10, 0),
            new java.awt.Dimension(10, 0),
            new java.awt.Dimension(10, 32767)));
    toolBar.add(label);
    toolBar.add(new javax.swing.Box.Filler(new java.awt.Dimension(0, 0),
            new java.awt.Dimension(0, 0),
            new java.awt.Dimension(32767, 32767)));
    toolBar.add(getPrevoiusTestCaseButton());

    toolBar.add(getEditTagButton());
    toolBar.setPreferredSize(new java.awt.Dimension(toolBar.getPreferredSize().width, 30));
    panel.add(toolBar, BorderLayout.NORTH);
    panel.add(TreeSearch.installFor(tree), BorderLayout.CENTER);
    return panel;
}
 
Example #4
Source File: GenericToolbar.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public Dimension getPreferredSize() {
    Dimension dim = super.getPreferredSize();
    if (PREFERRED_HEIGHT == -1) {
        GenericToolbar tb = new GenericToolbar();
        tb.setBorder(getBorder());
        tb.setBorderPainted(isBorderPainted());
        tb.setRollover(isRollover());
        tb.setFloatable(isFloatable());
        Icon icon = Icons.getIcon(GeneralIcons.SAVE);
        tb.add(new JButton("Button", icon)); // NOI18N
        tb.add(new JToggleButton("Button", icon)); // NOI18N
        tb.add(new JTextField("Text")); // NOI18N
        JComboBox c = new JComboBox();
        c.setEditor(new BasicComboBoxEditor());
        c.setRenderer(new BasicComboBoxRenderer());
        tb.add(c);
        tb.addSeparator();
        PREFERRED_HEIGHT = tb.getSuperPreferredSize().height;
    }
    dim.height = getParent() instanceof JToolBar ? 1 :
                 Math.max(dim.height, PREFERRED_HEIGHT);
    return dim;
}
 
Example #5
Source File: ProfilerPopup.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private static List<Component> components(Container aContainer) {
            List<Component> l = new ArrayList();

            for (int i = 0; i < aContainer.getComponentCount(); i++) {
                Component c = aContainer.getComponent(i);
                if (c instanceof JPanel || c instanceof JToolBar)
                    l.addAll(components((Container)c));
                else if (c instanceof JScrollPane)
                    l.addAll(components((Container)((JScrollPane)c).getViewport()));
//                else if (c instanceof JRootPane)
//                    l.addAll(components((Container)((JRootPane)c).getContentPane()));
                else if (focusable(c)) l.add(c);
            }

            return l;
        }
 
Example #6
Source File: WatchAnnotationProvider.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void addActions(JToolBar tb, Action[] actions) {
    tb.removeAll();
    boolean visible = false;
    if (actions != null) {
        for (Action a : actions) {
            if (a != null) {
                JButton btn = tb.add(a);
                btn.setBorder(new javax.swing.border.EmptyBorder(0, 2, 0, 2));
                btn.setBorderPainted(false);
                btn.setContentAreaFilled(false);
                btn.setRolloverEnabled(false);
                btn.setOpaque(false);
                btn.setFocusable(false);
                visible = true;
            } else {
                tb.add(new JSeparator(JSeparator.VERTICAL));
            }
        }
    }
    tb.setVisible(visible);
}
 
Example #7
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 #8
Source File: NimbusGlueTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private static void createUI() throws Exception {
    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            frame = new JFrame();
            bar = new JToolBar();
            bar.add(createButton(1));
            bar.add(createButton(2));
            bar.add(Box.createHorizontalGlue());
            bar.add(createButton(3));
            frame.add(bar, BorderLayout.NORTH);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(600, 400);
            frame.setVisible(true);
        }
    });
}
 
Example #9
Source File: SynthToolBarUI.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private void updateStyle(JToolBar c) {
    SynthContext context = getContext(
            c, Region.TOOL_BAR_CONTENT, null, ENABLED);
    contentStyle = SynthLookAndFeel.updateStyle(context, this);
    context.dispose();

    context = getContext(c, Region.TOOL_BAR_DRAG_WINDOW, null, ENABLED);
    dragWindowStyle = SynthLookAndFeel.updateStyle(context, this);
    context.dispose();

    context = getContext(c, ENABLED);
    SynthStyle oldStyle = style;

    style = SynthLookAndFeel.updateStyle(context, this);
    if (oldStyle != style) {
        handleIcon =
            style.getIcon(context, "ToolBar.handleIcon");
        if (oldStyle != null) {
            uninstallKeyboardActions();
            installKeyboardActions();
        }
    }
    context.dispose();
}
 
Example #10
Source File: EntityAction.java    From libreveris with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Wraps an existing action, used as a delegate
 */
protected EntityAction (Collection<Action> entityActions,
                        JMenu menu,
                        JToolBar toolBar,
                        Action delegate)
{
    this(
            entityActions,
            menu,
            toolBar,
            (String) delegate.getValue(Action.NAME),
            (String) delegate.getValue(Action.SHORT_DESCRIPTION),
            (String) delegate.getValue(Action.ACCELERATOR_KEY),
            (Icon) delegate.getValue(Action.SMALL_ICON));
    this.delegate = delegate;
}
 
Example #11
Source File: NimbusLookAndFeel.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Package private method which returns either BorderLayout.NORTH,
 * BorderLayout.SOUTH, BorderLayout.EAST, or BorderLayout.WEST depending
 * on the location of the toolbar in its parent. The toolbar might be
 * in PAGE_START, PAGE_END, CENTER, or some other position, but will be
 * resolved to either NORTH,SOUTH,EAST, or WEST based on where the toolbar
 * actually IS, with CENTER being NORTH.
 *
 * This code is used to determine where the border line should be drawn
 * by the custom toolbar states, and also used by NimbusIcon to determine
 * whether the handle icon needs to be shifted to look correct.
 *
 * Toollbars are unfortunately odd in the way these things are handled,
 * and so this code exists to unify the logic related to toolbars so it can
 * be shared among the static files such as NimbusIcon and generated files
 * such as the ToolBar state classes.
 */
static Object resolveToolbarConstraint(JToolBar toolbar) {
    //NOTE: we don't worry about component orientation or PAGE_END etc
    //because the BasicToolBarUI always uses an absolute position of
    //NORTH/SOUTH/EAST/WEST.
    if (toolbar != null) {
        Container parent = toolbar.getParent();
        if (parent != null) {
            LayoutManager m = parent.getLayout();
            if (m instanceof BorderLayout) {
                BorderLayout b = (BorderLayout)m;
                Object con = b.getConstraints(toolbar);
                if (con == SOUTH || con == EAST || con == WEST) {
                    return con;
                }
                return NORTH;
            }
        }
    }
    return NORTH;
}
 
Example #12
Source File: DisplayPanel3D.java    From orson-charts with GNU General Public License v3.0 6 votes vote down vote up
/** 
 * Creates a new display panel.
 * 
 * @param content  the content ({@code null} not permitted).
 * @param toolbar  toolbar?
 * @param popupMenu  popup menu?
 */
public DisplayPanel3D(Panel3D content, boolean toolbar, boolean popupMenu) {
    super(new BorderLayout());
    
    this.content = content;
    add(this.content);
    
    if (toolbar) {
        JToolBar tb = createToolBar(content);
        add(tb, BorderLayout.EAST);
    }
    if (popupMenu) {
        this.popup = createPopupMenu(ExportFormat.values());
    }
    this.content.addMouseListener(this);
}
 
Example #13
Source File: ToolBar.java    From opt4j with MIT License 6 votes vote down vote up
/**
 * Initialization. This method has to be called once after construction.
 */
public void init() {
	toolBar.setFloatable(false);
	Border border = BorderFactory.createMatteBorder(0, 0, 1, 0, toolBar.getBackground().darker());
	toolBar.setBorder(border);

	List<ToolBarService> list = new ArrayList<>();
	list.addAll(toolBarServices);
	Collections.sort(list, new ToolBarOrderComparator<>());

	for (ToolBarService toolBarService : list) {
		JToolBar component = toolBarService.getToolBar();
		component.setFloatable(false);
		toolBar.add(component);
	}
}
 
Example #14
Source File: NimbusLookAndFeel.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Package private method which returns either BorderLayout.NORTH,
 * BorderLayout.SOUTH, BorderLayout.EAST, or BorderLayout.WEST depending
 * on the location of the toolbar in its parent. The toolbar might be
 * in PAGE_START, PAGE_END, CENTER, or some other position, but will be
 * resolved to either NORTH,SOUTH,EAST, or WEST based on where the toolbar
 * actually IS, with CENTER being NORTH.
 *
 * This code is used to determine where the border line should be drawn
 * by the custom toolbar states, and also used by NimbusIcon to determine
 * whether the handle icon needs to be shifted to look correct.
 *
 * Toollbars are unfortunately odd in the way these things are handled,
 * and so this code exists to unify the logic related to toolbars so it can
 * be shared among the static files such as NimbusIcon and generated files
 * such as the ToolBar state classes.
 */
static Object resolveToolbarConstraint(JToolBar toolbar) {
    //NOTE: we don't worry about component orientation or PAGE_END etc
    //because the BasicToolBarUI always uses an absolute position of
    //NORTH/SOUTH/EAST/WEST.
    if (toolbar != null) {
        Container parent = toolbar.getParent();
        if (parent != null) {
            LayoutManager m = parent.getLayout();
            if (m instanceof BorderLayout) {
                BorderLayout b = (BorderLayout)m;
                Object con = b.getConstraints(toolbar);
                if (con == SOUTH || con == EAST || con == WEST) {
                    return con;
                }
                return NORTH;
            }
        }
    }
    return NORTH;
}
 
Example #15
Source File: IMPanel.java    From SmartIM with Apache License 2.0 6 votes vote down vote up
private void initUI() {

        JPanel pLeft = new JPanel();
        pLeft.setLayout(new BorderLayout(0, 0));
        JToolBar toolBar1 = new JToolBar();
        toolBar1.setFloatable(false);
        toolBar1.setOrientation(SwingConstants.VERTICAL);
        initToolBar1(toolBar1);
        pLeft.add(toolBar1, BorderLayout.WEST);

        left = createContactsUI();
        left.onLoadContacts(false);
        pLeft.add(left, BorderLayout.CENTER);
        setLeftComponent(pLeft);

        JPanel pRight = new JPanel();
        pRight.setLayout(new BorderLayout(0, 0));

        tabbedChat = new ClosableTabHost(this);
        pRight.add(tabbedChat, BorderLayout.CENTER);

        setRightComponent(pRight);

        setResizeWeight(0.3);
        setDividerLocation(250);
    }
 
Example #16
Source File: NimbusLookAndFeel.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Package private method which returns either BorderLayout.NORTH,
 * BorderLayout.SOUTH, BorderLayout.EAST, or BorderLayout.WEST depending
 * on the location of the toolbar in its parent. The toolbar might be
 * in PAGE_START, PAGE_END, CENTER, or some other position, but will be
 * resolved to either NORTH,SOUTH,EAST, or WEST based on where the toolbar
 * actually IS, with CENTER being NORTH.
 *
 * This code is used to determine where the border line should be drawn
 * by the custom toolbar states, and also used by NimbusIcon to determine
 * whether the handle icon needs to be shifted to look correct.
 *
 * Toollbars are unfortunately odd in the way these things are handled,
 * and so this code exists to unify the logic related to toolbars so it can
 * be shared among the static files such as NimbusIcon and generated files
 * such as the ToolBar state classes.
 */
static Object resolveToolbarConstraint(JToolBar toolbar) {
    //NOTE: we don't worry about component orientation or PAGE_END etc
    //because the BasicToolBarUI always uses an absolute position of
    //NORTH/SOUTH/EAST/WEST.
    if (toolbar != null) {
        Container parent = toolbar.getParent();
        if (parent != null) {
            LayoutManager m = parent.getLayout();
            if (m instanceof BorderLayout) {
                BorderLayout b = (BorderLayout)m;
                Object con = b.getConstraints(toolbar);
                if (con == SOUTH || con == EAST || con == WEST) {
                    return con;
                }
                return NORTH;
            }
        }
    }
    return NORTH;
}
 
Example #17
Source File: InfoPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private JToolBar createFilterToolBar() {
    final FiltersDescriptor filtersDesc = FiltersDescriptor.getInstance();
    // configure toolbar
    final JToolBar toolbar = new NoBorderToolBar();
    toolbar.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
    toolbar.setFloatable(false);
    //toolbar.setRollover(true);
    toolbar.setBorderPainted(false);
    toolbar.setOpaque(false);
    if( "Aqua".equals(UIManager.getLookAndFeel().getID()) ) { //NOI18N
        toolbar.setBackground(UIManager.getColor("NbExplorerView.background")); //NOI18N
    }
    createFilterToolBarUI(toolbar, filtersDesc);
    filtersDesc.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    createFilterToolBarUI(toolbar, filtersDesc);
                }
            });
        }
    });
    return toolbar;
}
 
Example #18
Source File: PageInspectorImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Uninitializes the selection mode (removes the page inspection
 * component/s from the toolbar).
 * 
 * @param toolBar toolBar to remove the buttons from.
 */
void uninitSelectionMode(JToolBar toolBar) {
    if (toolBar != null) {
        for (Component component : toolBar.getComponents()) {
            if (SELECTION_MODE_COMPONENT_NAME.equals(component.getName())) {
                toolBar.remove(component);
                break;
            }
        }
    }
}
 
Example #19
Source File: CTrackingResultsToolbar.java    From binnavi with Apache License 2.0 5 votes vote down vote up
/**
 * Small helper function for adding buttons to the toolbar.
 *
 * @param toolBar
 * @param action Action associated with the new button.
 * @param defaultIconPath Path to the default icon for the button.
 * @param rolloverIconPath Path to the roll-over icon for the button.
 * @param pressedIconPath Path to the pressed icon for the button.
 *
 * @return The created button.
 */
// ESCA-JAVA0138:
private static JButton createAndAddIconToToolbar(final JToolBar toolBar,
    final AbstractAction action, final String defaultIconPath, final String rolloverIconPath,
    final String pressedIconPath) {
  final JButton button = toolBar.add(CActionProxy.proxy(action));
  button.setBorder(new EmptyBorder(0, 0, 0, 0));

  button.setIcon(new ImageIcon(CMain.class.getResource(defaultIconPath)));
  button.setRolloverIcon(new ImageIcon(CMain.class.getResource(rolloverIconPath)));
  button.setPressedIcon(new ImageIcon(CMain.class.getResource(pressedIconPath)));

  return button;
}
 
Example #20
Source File: SynthToolBarUI.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void propertyChange(PropertyChangeEvent e) {
    if (SynthLookAndFeel.shouldUpdateStyle(e)) {
        updateStyle((JToolBar)e.getSource());
    }
}
 
Example #21
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 #22
Source File: AbstractSearchResultsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor.
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    jPanel1 = new javax.swing.JPanel();
    toolBar = new ToolbarWithOverflow();
    contentPanel = new javax.swing.JPanel();

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
        jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGap(0, 100, Short.MAX_VALUE)
    );
    jPanel1Layout.setVerticalGroup(
        jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGap(0, 100, Short.MAX_VALUE)
    );

    setLayout(new java.awt.BorderLayout());

    toolBar.setFloatable(false);
    toolBar.setOrientation(JToolBar.VERTICAL);
    toolBar.setRollover(true);
    toolBar.setPreferredSize(null);
    toolBar.setRequestFocusEnabled(false);
    add(toolBar, java.awt.BorderLayout.WEST);

    contentPanel.setBorder(javax.swing.BorderFactory.createLineBorder(javax.swing.UIManager.getDefaults().getColor("controlShadow")));
    contentPanel.setLayout(new javax.swing.BoxLayout(contentPanel, javax.swing.BoxLayout.LINE_AXIS));
    add(contentPanel, java.awt.BorderLayout.CENTER);
}
 
Example #23
Source File: SynthToolBarUI.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void propertyChange(PropertyChangeEvent e) {
    if (SynthLookAndFeel.shouldUpdateStyle(e)) {
        updateStyle((JToolBar)e.getSource());
    }
}
 
Example #24
Source File: PaletteToolBarBorder.java    From openAGV with Apache License 2.0 5 votes vote down vote up
@Override
public void paintBorder(Component component, Graphics gr, int x, int y, int w, int h) {
  Graphics2D g = (Graphics2D) gr;

  g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
  g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

  if ((component instanceof JToolBar) /* && ((((JToolBar) component).getUI()) instanceof PaletteToolBarUI) */) {
    JToolBar c = (JToolBar) component;

    if (c.isFloatable()) {
      int borderColor = 0x80ff0000;
      float[] stops = ENABLED_STOPS;
      Color[] stopColors = ENABLED_STOP_COLORS;

      g.setColor(new Color(borderColor, true));
      LinearGradientPaint lgp = new LinearGradientPaint(
          new Point2D.Float(1, 1), new Point2D.Float(19, 1),
          stops, stopColors,
          MultipleGradientPaint.CycleMethod.REPEAT);
      g.setPaint(lgp);
      g.fillRect(1, 1, 7 - 2, h - 2);
      ImageIcon icon = new ImageIcon(getClass().getResource("/org/opentcs/guing/res/symbols/toolbar/border.jpg"));

      if (c.getComponentCount() != 0 && !(c.getComponents()[0] instanceof JLabel)) {
        JLabel label = new JLabel(icon);
        label.setFocusable(false);
        c.add(label, 0);
        label.getParent().setBackground(label.getBackground());
        label.setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
      }
    }
  }
}
 
Example #25
Source File: JSList.java    From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 5 votes vote down vote up
private JToolBar withToolbar(JComponent a, JComponent b) {
    JToolBar tbar = getToolbar();
    tbar.add(a);
    tbar.add(b);
    tbar.setLayout(new BoxLayout(tbar, BoxLayout.LINE_AXIS));
    return tbar;
}
 
Example #26
Source File: SynthToolBarUI.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void propertyChange(PropertyChangeEvent e) {
    if (SynthLookAndFeel.shouldUpdateStyle(e)) {
        updateStyle((JToolBar)e.getSource());
    }
}
 
Example #27
Source File: SynthToolBarUI.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void propertyChange(PropertyChangeEvent e) {
    if (SynthLookAndFeel.shouldUpdateStyle(e)) {
        updateStyle((JToolBar)e.getSource());
    }
}
 
Example #28
Source File: ActionLinter.java    From wpcleaner with Apache License 2.0 5 votes vote down vote up
/**
 * Add a button for checking a list of articles.
 * 
 * @param window Window.
 * @param toolbar Tool bar.
 * @param wiki Wiki.
 * @param pageListProvider Provider for the list of pages.
 * @param showIcon True if the button should use an icon.
 * @return Button.
 */
public static JButton addButton(
    BasicWindow window, JToolBar toolbar,
    EnumWikipedia wiki,
    PageListProvider pageListProvider,
    boolean showIcon) {
  JButton button = createButton(window, wiki, pageListProvider, showIcon);
  if ((button != null) && (toolbar != null)) {
    toolbar.add(button);
  }
  return button;
}
 
Example #29
Source File: SynthToolBarUI.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void propertyChange(PropertyChangeEvent e) {
    if (SynthLookAndFeel.shouldUpdateStyle(e)) {
        updateStyle((JToolBar)e.getSource());
    }
}
 
Example #30
Source File: PeakListTableToolBar.java    From mzmine2 with GNU General Public License v2.0 5 votes vote down vote up
PeakListTableToolBar(PeakListTableWindow masterFrame) {

    super(JToolBar.VERTICAL);

    setFloatable(false);
    setMargin(new Insets(5, 5, 5, 5));

    GUIUtils.addButton(this, null, propertiesIcon, masterFrame, "PROPERTIES",
        "Set table properties");
    GUIUtils.addButton(this, null, widthIcon, masterFrame, "AUTOCOLUMNWIDTH",
        "Set auto column width");
    addSeparator();
    GUIUtils.addButton(this, null, printIcon, masterFrame, "PRINT", "Print");

  }