Java Code Examples for javax.swing.JSeparator#setMaximumSize()
The following examples show how to use
javax.swing.JSeparator#setMaximumSize() .
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: BasicFindPanel.java From constellation with Apache License 2.0 | 5 votes |
private void resetComboBox() { JSeparator sep = new JSeparator(SwingConstants.HORIZONTAL); Dimension sepDim = new Dimension(Integer.MAX_VALUE, 5); sep.setMaximumSize(sepDim); selectAll.setSelected(false); dropDownPanel.add(selectAll); dropDownPanel.add(sep); updateValidation(); }
Example 2
Source File: ReplacePanel.java From constellation with Apache License 2.0 | 5 votes |
private void resetComboBox() { JSeparator sep = new JSeparator(SwingConstants.HORIZONTAL); Dimension sepDim = new Dimension(Integer.MAX_VALUE, 5); sep.setMaximumSize(sepDim); selectAll.setSelected(false); dropDownPanel.add(selectAll); dropDownPanel.add(sep); updateValidation(); }
Example 3
Source File: PreferencePanel.java From gcs with Mozilla Public License 2.0 | 5 votes |
/** @param flexContainer The {@link FlexContainer} to add a separator to. */ protected void addSeparator(FlexContainer flexContainer) { JSeparator sep = new JSeparator(); sep.setOpaque(false); sep.setMaximumSize(new Dimension(LayoutSize.MAXIMUM_SIZE, 1)); add(sep); FlexComponent comp = new FlexComponent(sep, Alignment.CENTER, Alignment.CENTER); comp.setInsets(new Insets(5, 0, 5, 0)); flexContainer.add(comp); }
Example 4
Source File: GUIOption.java From PacketProxy with Apache License 2.0 | 4 votes |
private JComponent createSeparator() { JSeparator line = new JSeparator(); line.setMaximumSize(new Dimension(Short.MAX_VALUE, line.getMinimumSize().height)); return line; }
Example 5
Source File: ConfigWindow.java From rscplus with GNU General Public License v3.0 | 4 votes |
/** * Adds a new horizontal separator to the notifications list. * * @param panel Panel to add the separator to. */ private void addSettingsHeaderSeparator(JPanel panel) { JSeparator jsep = new JSeparator(SwingConstants.HORIZONTAL); jsep.setMaximumSize(new Dimension(Short.MAX_VALUE, 7)); panel.add(jsep); }
Example 6
Source File: AbstractUndoableMovesPanel.java From triplea with GNU General Public License v3.0 | 4 votes |
private void initLayout() { removeAll(); setLayout(new BorderLayout()); final JPanel items = new JPanel(); items.setLayout(new BoxLayout(items, BoxLayout.Y_AXIS)); // we want the newest move at the top moves = new ArrayList<>(moves); Collections.reverse(moves); final Iterator<AbstractUndoableMove> iter = moves.iterator(); if (iter.hasNext()) { add( new JLabel((this instanceof UndoablePlacementsPanel) ? "Placements:" : "Moves:"), BorderLayout.NORTH); } int scrollIncrement = 10; final Dimension separatorSize = new Dimension(150, 20); while (iter.hasNext()) { final AbstractUndoableMove item = iter.next(); final JComponent moveComponent = newComponentForMove(item); scrollIncrement = moveComponent.getPreferredSize().height; items.add(moveComponent); if (iter.hasNext()) { final JSeparator separator = new JSeparator(SwingConstants.HORIZONTAL); separator.setPreferredSize(separatorSize); separator.setMaximumSize(separatorSize); items.add(separator); } } if (movePanel.getUndoableMoves() != null && movePanel.getUndoableMoves().size() > 1) { final JButton undoAllButton = new JButton("Undo All"); undoAllButton.addActionListener(new UndoAllMovesActionListener()); items.add(undoAllButton); } final int scrollIncrementFinal = scrollIncrement + separatorSize.height; // JScrollPane scroll = new JScrollPane(items); scroll = new JScrollPane(items) { private static final long serialVersionUID = -1064967105431785533L; @Override public void paint(final Graphics g) { if (previousVisibleIndex != null) { items.scrollRectToVisible( new Rectangle( 0, scrollIncrementFinal * (moves.size() - previousVisibleIndex), 1, scrollIncrementFinal)); previousVisibleIndex = null; } super.paint(g); } }; scroll.setBorder(null); scroll.getVerticalScrollBar().setUnitIncrement(scrollIncrementFinal); if (scrollBarPreviousValue != null) { scroll.getVerticalScrollBar().setValue(scrollBarPreviousValue); scrollBarPreviousValue = null; } add(scroll, BorderLayout.CENTER); SwingUtilities.invokeLater(this::validate); }
Example 7
Source File: AKDockLayout.java From WorldPainter with GNU General Public License v3.0 | 2 votes |
private void flipSeparators(Component c, int orientn) { if (c != null && c instanceof JToolBar && UIManager.getLookAndFeel().getName().toLowerCase().indexOf("windows") != -1) { JToolBar jtb = (JToolBar) c; Component comps[] = jtb.getComponents(); if (comps != null && comps.length > 0) { for (int i = 0; i < comps.length; i++) { try { Component component = comps[i]; if (component != null) { if (component instanceof JSeparator) { jtb.remove(component); JSeparator separ = new JSeparator(); if (orientn == SwingConstants.VERTICAL) { separ.setOrientation(SwingConstants.VERTICAL); separ.setMinimumSize(new Dimension(2, 6)); separ.setPreferredSize(new Dimension(2, 6)); separ.setMaximumSize(new Dimension(2, 100)); } else { separ.setOrientation(SwingConstants.HORIZONTAL); separ.setMinimumSize(new Dimension(6, 2)); separ.setPreferredSize(new Dimension(6, 2)); separ.setMaximumSize(new Dimension(100, 2)); } jtb.add(separ, i); } } } catch (Exception e) { e.printStackTrace(); } } } } }