Java Code Examples for javax.swing.JToolBar#setOpaque()
The following examples show how to use
javax.swing.JToolBar#setOpaque() .
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: HierarchyTopComponent.java From netbeans with Apache License 2.0 | 6 votes |
MainToolBar(@NonNull final Pair<JComponent,GridBagConstraints>... components) { super(BoxLayout.X_AXIS); setBorder(BorderFactory.createEmptyBorder(1, 2, 1, 5)); final JToolBar toolbar = new NoBorderToolBar(JToolBar.HORIZONTAL); toolbar.setFloatable(false); toolbar.setRollover(true); toolbar.setBorderPainted(false); toolbar.setBorder(BorderFactory.createEmptyBorder()); toolbar.setOpaque(false); toolbar.setFocusable(false); toolbar.setLayout(new GridBagLayout()); for (Pair<JComponent,GridBagConstraints> p : components) { toolbar.add(p.first(),p.second()); } add (toolbar); }
Example 2
Source File: InfoPanel.java From netbeans with Apache License 2.0 | 6 votes |
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 3
Source File: ProfilerToolbar.java From netbeans with Apache License 2.0 | 5 votes |
@Override public Component add(ProfilerToolbar toolbar, int index) { JToolBar implToolbar = ((Impl)toolbar).toolbar; implToolbar.setBorder(BorderFactory.createEmptyBorder()); implToolbar.setOpaque(false); implToolbar.putClientProperty("Toolbar.noGTKBorder", Boolean.TRUE); // NOI18N return add(implToolbar, index); }
Example 4
Source File: ProfilerToolbar.java From visualvm with GNU General Public License v2.0 | 5 votes |
@Override public Component add(ProfilerToolbar toolbar, int index) { JToolBar implToolbar = ((Impl)toolbar).toolbar; implToolbar.setBorder(BorderFactory.createEmptyBorder()); implToolbar.setOpaque(false); implToolbar.putClientProperty("Toolbar.noGTKBorder", Boolean.TRUE); // NOI18N return add(implToolbar, index); }
Example 5
Source File: SnapshotDiffView.java From visualvm with GNU General Public License v2.0 | 5 votes |
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 6
Source File: TransparentToolBar.java From visualvm with GNU General Public License v2.0 | 5 votes |
private static JToolBar createToolBar(final boolean horizontal) { JToolBar tb = new JToolBar(horizontal ? JToolBar.HORIZONTAL : JToolBar.VERTICAL) { public void layout() { super.layout(); if (horizontal) { if (BUTTON_HEIGHT == -1) BUTTON_HEIGHT = getButtonHeight(); Insets i = getInsets(); int height = getHeight() - i.top - i.bottom; for (Component comp : getComponents()) { if (comp.isVisible() && (comp instanceof JButton || comp instanceof JToggleButton)) { Rectangle b = comp.getBounds(); b.height = BUTTON_HEIGHT; b.y = i.top + (height - b.height) / 2; comp.setBounds(b); } } } } }; if (UISupport.isNimbusLookAndFeel()) tb.setLayout(new BoxLayout(tb, horizontal ? BoxLayout.X_AXIS : BoxLayout.Y_AXIS)); tb.setBorderPainted(false); tb.setFloatable(false); tb.setRollover(true); tb.setOpaque(false); return tb; }
Example 7
Source File: EditorPanel.java From jclic with GNU General Public License v2.0 | 5 votes |
protected JToolBar createToolBar() { JToolBar toolBar = new JToolBar(); toolBar.setFloatable(false); toolBar.setOpaque(false); addActionsTo(toolBar); return toolBar; }
Example 8
Source File: CoBrowser.java From Spark with Apache License 2.0 | 5 votes |
private void buildUI() { if (!isShowing) { update(getGraphics()); isShowing = true; final JToolBar toolbar = new JToolBar(); toolbar.setFloatable(false); toolbar.add(backButton); toolbar.add(urlField); toolbar.add(goButton); toolbar.setOpaque(false); final BackgroundPane titlePanel = new BackgroundPane(); titlePanel.setLayout(new GridBagLayout()); JLabel cobrowsingLabel = new JLabel(); cobrowsingLabel.setText(FpRes.getString("cobrowsing.session")); cobrowsingLabel.setFont(new Font("Dialog", Font.BOLD, 11)); titlePanel.add(cobrowsingLabel, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 0), 0, 0)); titlePanel.add(pushCurrentPageButton, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0)); titlePanel.add(followMeButton, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0)); titlePanel.add(toolbar, new GridBagConstraints(0, 1, 3, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(10, 0, 5, 0), 0, 0)); add(titlePanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); updateLinkLabel(getStartLocation()); goButton.addActionListener(this); backButton.addActionListener(this); pushCurrentPageButton.addActionListener(this); } }
Example 9
Source File: LibraryPanel.java From HubPlayer with GNU General Public License v3.0 | 4 votes |
/** * 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", "serial" }) // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { aScrollPanel = new JScrollPane(); dataTable = new JTable(); libraryTableModel = new LibraryTableModel(); libraryOperation = new LibraryOperation(); aToolBar = new JToolBar(); moreSearch = new JButton(); setLayout(new BorderLayout()); aScrollPanel .setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); aScrollPanel .setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); aScrollPanel.setMaximumSize(new Dimension(615, 481)); // 设置20行空数据 dataTable.setModel(libraryTableModel); libraryTableModel.setLibraryOperation(libraryOperation); // 定义"操作栏"的渲染器 显示按钮 dataTable.getColumn("操作").setCellRenderer( new DefaultTableCellRenderer() { @Override public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { return value instanceof JPanel ? (JPanel) value : super .getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); } }); // 定义"操作栏"的编辑器 响应按钮事件 dataTable.getColumn("操作").setCellEditor(new CellEditor()); dataTable.setColumnSelectionAllowed(true); dataTable.setRowHeight(23); aScrollPanel.setViewportView(dataTable); dataTable.getColumnModel().getSelectionModel() .setSelectionMode(ListSelectionModel.SINGLE_SELECTION); add(aScrollPanel, BorderLayout.CENTER); aToolBar.setFloatable(false); aToolBar.setRollover(true); aToolBar.setOpaque(false); moreSearch.setText("更多数据"); moreSearch.setFocusable(false); moreSearch.setHorizontalTextPosition(SwingConstants.CENTER); moreSearch.setVerticalTextPosition(SwingConstants.BOTTOM); // moreSearch.setEnabled(false); aToolBar.add(moreSearch); Box box = Box.createVerticalBox(); box.setBorder(BorderFactory.createLineBorder(Color.BLACK)); box.setOpaque(true); box.add(aToolBar); add(box, BorderLayout.SOUTH); }