javax.swing.JSeparator Java Examples

The following examples show how to use javax.swing.JSeparator. 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: ReportIndianPanel.java    From freecol with GNU General Public License v2.0 6 votes vote down vote up
/**
 * The constructor that will add the items to this panel.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 */
public ReportIndianPanel(FreeColClient freeColClient) {
    super(freeColClient, "reportIndianAction");

    Player player = getMyPlayer();
    reportPanel.setLayout(new MigLayout("wrap 6, fillx, insets 0",
                                        "[]20px[center]", "[top]"));
    boolean needsSeperator = false;
    for (Player opponent : CollectionUtils.transform(getGame().getLiveNativePlayers(),
                                     p -> player.hasContacted(p))) {
        if (needsSeperator) {
            reportPanel.add(new JSeparator(JSeparator.HORIZONTAL),
                "newline 20, span, growx, wrap 20");
        }
        buildIndianAdvisorPanel(player, opponent);
        needsSeperator = true;
    }
    scrollPane.getViewport().setOpaque(false);
    reportPanel.setOpaque(true);
    reportPanel.doLayout();
}
 
Example #2
Source File: SeparatorTitled.java    From jdal with Apache License 2.0 6 votes vote down vote up
public SeparatorTitled(String title, boolean bold) {

	super(BoxLayout.LINE_AXIS);
	JLabel titleLabel = new JLabel(title);
	
	if (bold)
		FormUtils.setBold(titleLabel);
	
	titleLabel.setAlignmentY(Component.BOTTOM_ALIGNMENT);
	this.add(titleLabel);
	this.add(Box.createHorizontalStrut(5));
	JSeparator separator = new JSeparator();
	separator.setAlignmentY(Container.TOP_ALIGNMENT);
	this.add(separator);
	this.setMaximumSize(new Dimension(Short.MAX_VALUE, 20));
}
 
Example #3
Source File: SwingUtils.java    From ib-controller with GNU General Public License v3.0 6 votes vote down vote up
private static void appendMenuItem(Component menuItem, StringBuilder builder, String indent) {
    if (menuItem instanceof JMenuBar) {
        appendMenuSubElements((MenuElement)menuItem, builder, indent);
    } else if (menuItem instanceof JPopupMenu) {
        appendMenuSubElements((MenuElement)menuItem, builder, indent);
    } else if (menuItem instanceof JMenuItem) {
        builder.append(NEWLINE);
        builder.append(indent);
        builder.append(((JMenuItem)menuItem).getText());
        builder.append(((JMenuItem)menuItem).isEnabled() ? "" : "[Disabled]");
        appendMenuSubElements((JMenuItem)menuItem, builder, "|   " + indent);
    } else if (menuItem instanceof JSeparator) {
        builder.append(NEWLINE);
        builder.append(indent);
        builder.append("--------");
    }
}
 
Example #4
Source File: QueryParserPaneProvider.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
public JScrollPane get() {
  JPanel panel = new JPanel();
  panel.setOpaque(false);
  panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
  panel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));

  panel.add(initSelectParserPane());
  panel.add(new JSeparator(JSeparator.HORIZONTAL));
  panel.add(initParserSettingsPanel());
  panel.add(new JSeparator(JSeparator.HORIZONTAL));
  panel.add(initPhraseQuerySettingsPanel());
  panel.add(new JSeparator(JSeparator.HORIZONTAL));
  panel.add(initFuzzyQuerySettingsPanel());
  panel.add(new JSeparator(JSeparator.HORIZONTAL));
  panel.add(initDateRangeQuerySettingsPanel());
  panel.add(new JSeparator(JSeparator.HORIZONTAL));
  panel.add(initPointRangeQuerySettingsPanel());

  JScrollPane scrollPane = new JScrollPane(panel);
  scrollPane.setOpaque(false);
  scrollPane.getViewport().setOpaque(false);
  return scrollPane;
}
 
Example #5
Source File: FlatSeparatorUI.java    From FlatLaf with Apache License 2.0 6 votes vote down vote up
@Override
public void paint( Graphics g, JComponent c ) {
	Graphics2D g2 = (Graphics2D) g.create();
	try {
		FlatUIUtils.setRenderingHints( g2 );
		g2.setColor( c.getForeground() );

		float width = scale( (float) stripeWidth );
		float indent = scale( (float) stripeIndent );

		if( ((JSeparator)c).getOrientation() == JSeparator.VERTICAL )
			g2.fill( new Rectangle2D.Float( indent, 0, width, c.getHeight() ) );
		else
			g2.fill( new Rectangle2D.Float( 0, indent, c.getWidth(), width ) );
	} finally {
		g2.dispose();
	}
}
 
Example #6
Source File: JExtendedComboBox.java    From visualvm with GNU General Public License v2.0 6 votes vote down vote up
protected void fireItemStateChanged(ItemEvent e) {
    switch (e.getStateChange()) {
        case ItemEvent.SELECTED:

            if (e.getItem() instanceof JSeparator) {
                SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
                            selectNextItem();
                        }
                    });

            }

            break;
        case ItemEvent.DESELECTED:

            if (!(e.getItem() instanceof JSeparator)) {
                lastSelectedIndex = model.getIndexOf(e.getItem());
            }

            break;
    }

    super.fireItemStateChanged(e);
}
 
Example #7
Source File: JFrameMasterCtrlMenuRecents.java    From mts with GNU General Public License v3.0 6 votes vote down vote up
public JFrameMasterCtrlMenuRecents(JMenu jMenuRecents, JMenuItem jMenuItemClear, JMenuItem jMenuItemEmpty, JSeparator jSeparator, ActionListener jMenuItemActionPerformed) {
    _jMenuRecents = jMenuRecents;
    _jMenuItemClear = jMenuItemClear;
    _jMenuItemActionPerformed = jMenuItemActionPerformed;
    _jMenuItemEmpty = jMenuItemEmpty;
    _jSeparator = jSeparator;
    
    
    _jMenuItemClear.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            clearRecents();
            updateRecents();
        }
    });
    
    readRecentsFromFile();
    updateRecents();
}
 
Example #8
Source File: PostCustomizationDialog.java    From arcusplatform with Apache License 2.0 6 votes vote down vote up
@Override
protected Component createContents() {
	JPanel panel = new JPanel(new VerticalLayout());
	panel.add(new HyperLink(Actions.build("Pair Another Device", () -> submit(Action.PAIR_ANOTHER))).getComponent());
	int remainingDevices = ((Collection<?>) input.getPairingSubsystem().get(PairingSubsystem.ATTR_PAIRINGDEVICES)).size();
	if(remainingDevices > 0) {
		panel.add(new HyperLink(Actions.build(String.format("Customize %d Remaining Devices", remainingDevices), () -> submit(Action.CUSTOMIZE_ANOTHER))).getComponent());
	}
	panel.add(new JSeparator(JSeparator.HORIZONTAL));
	
	JButton dismissAll = new JButton(Actions.build("Dismiss All", () -> submit(Action.DISMISS_ALL)));
	JPanel buttons = new JPanel();
	buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));
	buttons.add(Box.createGlue());
	buttons.add(dismissAll);
	panel.add(buttons);
	
	return panel;
}
 
Example #9
Source File: DynaMenuModel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
static void checkSeparators(Component[] menuones, JPopupMenu parent) {
    boolean wasSeparator = false;
    for (int i = 0; i < menuones.length; i++) {
        Component curItem = menuones[i];
        if (curItem != null) {
            boolean isSeparator = curItem instanceof JSeparator;
            if (isSeparator) {
                boolean isVisible = curItem.isVisible();
                if (isVisible != !wasSeparator) {
                    //MACOSX whenever a property like enablement or visible is changed, need to remove and add.
                    // could be possibly split to work differetly on other platform..
                    parent.remove(i);
                    JSeparator newOne = createSeparator();
                    newOne.setVisible(!wasSeparator);
                    parent.add(newOne, i);
                }
            }
            if (!(curItem instanceof InvisibleMenuItem)) {
                wasSeparator = isSeparator;
            }
        }
    }
}
 
Example #10
Source File: BetaFeaturesIndicator.java    From rapidminer-studio with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Creates a indicator for activation of beta features.
 */
BetaFeaturesIndicator() {
	separator = new JSeparator(JSeparator.VERTICAL);
	modeLabel = new ResourceLabel("setting.activated_beta_features");
	modeLabel.setFont(modeLabel.getFont().deriveFont(Font.BOLD));
	modeLabel.setForeground(ICON_COLOR);
	modeLabel.addMouseListener(new MouseAdapter() {

		@Override
		public void mouseClicked(MouseEvent e) {
			showBetaBubble();
		}
	});

	ParameterService.registerParameterChangeListener(betaFeaturesListener);
	if (Boolean.parseBoolean(ParameterService.getParameterValue(RapidMiner.PROPERTY_RAPIDMINER_UPDATE_BETA_FEATURES))) {
		modeLabel.setVisible(true);
		separator.setVisible(true);
	} else {
		modeLabel.setVisible(false);
		separator.setVisible(false);
	}
}
 
Example #11
Source File: TextEditor.java    From screenstudio with GNU General Public License v3.0 6 votes vote down vote up
private void setControls() {
    DefaultComboBoxModel<String> model = new DefaultComboBoxModel<>(GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames());
    cboFonts.setModel(model);
    String[] tags = {"@CURRENTDATE", "@CURRENTTIME", "@STARTTIME", "@RECORDINGTIME", "@UPDATE 60 SEC@", "@UPDATE 5 MIN@", "@ONCHANGEONLY", "@ONELINER", "@SCROLLVERTICAL", "@SCROLLHORIZONTAL", "@TYPEWRITER", "", "file:///path/to/file.txt"};
    for (String t : tags) {
        if (t.length() > 0) {
            JMenuItem m = new JMenuItem(t);
            m.setActionCommand(t);
            m.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    txtText.insert(e.getActionCommand(), txtText.getCaretPosition());
                    mTextViewer.setText(txtText.getText());
                    mText.setText(txtText.getText());
                }
            });
            mnuTags.add(m);
        } else {
            mnuTags.add(new JSeparator());
        }

    }
}
 
Example #12
Source File: DirectorySelectorCombo.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void changeModel() {
  DefaultComboBoxModel model = (DefaultComboBoxModel)fileMRU.getModel();
  model.removeAllElements();
  if (isShowWelcome()) {
    model.addElement(new StringComboListElement(getWelcomeText(), true));
  }
  model.addElement(new ComboListElement(getNoneText()) {
    public void onSelection() {
      validSelection = false;
    }
  });
  JSeparator separ = new JSeparator();
  model.addElement(separ);
  model.addElement(new ComboListElement(getActionText()) {
    public void onSelection() {
      validSelection = false;
      browseFiles();
    }
  });
}
 
Example #13
Source File: AnalyzerPaneProvider.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
public JScrollPane get() {
  JPanel panel = new JPanel();
  panel.setOpaque(false);
  panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
  panel.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));

  panel.add(initAnalyzerNamePanel());
  panel.add(new JSeparator(JSeparator.HORIZONTAL));
  panel.add(initAnalysisChainPanel());

  tokenizerTF.setEditable(false);

  JScrollPane scrollPane = new JScrollPane(panel);
  scrollPane.setOpaque(false);
  scrollPane.getViewport().setOpaque(false);
  return scrollPane;
}
 
Example #14
Source File: ConfigWindow.java    From rscplus with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Adds a new horizontal separator to the keybinds list. The JSeparator spans 2 columns.
 *
 * @param panel Panel to add the separator to.
 */
private void addKeybindCategorySeparator(JPanel panel) {
  GridBagConstraints gbc = new GridBagConstraints();
  gbc.anchor = GridBagConstraints.CENTER;
  gbc.fill = GridBagConstraints.HORIZONTAL;
  gbc.insets = new Insets(0, 0, 0, 0);
  gbc.gridx = 0;
  gbc.gridy = keybindButtonGridYCounter++;
  keybindLabelGridYCounter++;
  gbc.gridwidth = 2;

  panel.add(Box.createVerticalStrut(7), gbc);
  JSeparator jsep = new JSeparator(SwingConstants.HORIZONTAL);
  panel.add(jsep, gbc);
  panel.add(Box.createVerticalStrut(7), gbc);
}
 
Example #15
Source File: GroupConfig.java    From sldeditor with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates a horizontal separator.
 *
 * @return the j separator
 */
public static Component createSeparator() {
    JPanel p = new JPanel();

    p.setLayout(new BorderLayout());

    JSeparator separator = new JSeparator(SwingConstants.HORIZONTAL);

    p.add(separator, BorderLayout.CENTER);
    Dimension size = new Dimension(FULL_WIDTH, 5);

    p.setPreferredSize(size);
    return p;
}
 
Example #16
Source File: OnePageAnalysisWindow.java    From wpcleaner with Apache License 2.0 5 votes vote down vote up
/**
 * @return Options menu.
 */
private JMenu createOptionsMenu() {
  JMenu menu = Utilities.createJMenu(GT._T("&Options"));
  menuItemShowDisambiguation = Utilities.createJCheckBoxMenuItm(
      GT._T("Show &disambiguation pages"), modelLinks.getShowDisambiguation());
  menuItemShowDisambiguation.addItemListener(this);
  menu.add(menuItemShowDisambiguation);
  menuItemShowMissing = Utilities.createJCheckBoxMenuItm(
      GT._T("Show &missing pages"), modelLinks.getShowMissing());
  menuItemShowMissing.addItemListener(this);
  menu.add(menuItemShowMissing);
  menuItemShowRedirect = Utilities.createJCheckBoxMenuItm(
      GT._T("Show &redirect pages"), modelLinks.getShowRedirect());
  menuItemShowRedirect.addItemListener(this);
  menu.add(menuItemShowRedirect);
  menuItemShowOther = Utilities.createJCheckBoxMenuItm(
      GT._T("Show &other pages"), modelLinks.getShowOther());
  menuItemShowOther.addItemListener(this);
  menu.add(menuItemShowOther);
  menu.add(new JSeparator());
  menuItemCountDisambiguation = Utilities.createJCheckBoxMenuItm(
      GT._T("Count disambiguation pages"), modelLinks.getCountDisambiguation());
  menuItemCountDisambiguation.addItemListener(this);
  menu.add(menuItemCountDisambiguation);
  menuItemCountMissing = Utilities.createJCheckBoxMenuItm(
      GT._T("Count missing pages"), modelLinks.getCountMissing());
  menuItemCountMissing.addItemListener(this);
  menu.add(menuItemCountMissing);
  menuItemCountRedirect = Utilities.createJCheckBoxMenuItm(
      GT._T("Count redirect pages"), modelLinks.getCountRedirect());
  menuItemCountRedirect.addItemListener(this);
  menu.add(menuItemCountRedirect);
  menuItemCountOther = Utilities.createJCheckBoxMenuItm(
      GT._T("Count other pages"), modelLinks.getCountOther());
  menuItemCountOther.addItemListener(this);
  menu.add(menuItemCountOther);
  return menu;
}
 
Example #17
Source File: OpenIndexDialogFactory.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
private JPanel content() {
  JPanel panel = new JPanel();
  panel.setOpaque(false);
  panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
  panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

  panel.add(basicSettings());
  panel.add(new JSeparator(JSeparator.HORIZONTAL));
  panel.add(expertSettings());
  panel.add(new JSeparator(JSeparator.HORIZONTAL));
  panel.add(buttons());

  return panel;
}
 
Example #18
Source File: SeparableToolBar.java    From audiveris with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * The separator will be inserted only if it is really necessary
 */
@Override
public void addSeparator ()
{
    int count = super.getComponentCount();

    if ((count > 0) && !(getComponent(count - 1) instanceof JSeparator)) {
        super.addSeparator(gap);
    }
}
 
Example #19
Source File: Toolbar.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Overridden to set focusable to false for any AbstractButton
 * subclasses which are added */
@Override
protected void addImpl(Component c, Object constraints, int idx) {
    //issue 39896, after opening dialog from toolbar button, focus
    //remains on toolbar button.  Does not create an accessibility issue - 
    //all standard toolbar buttons are also available via the keyboard
    if (c instanceof AbstractButton) {
        c.setFocusable(false);
        ((JComponent) c).setOpaque(false);
        if (isMetalLaF) {
            //metal/ocean resets borders, so fix it this way
            ((AbstractButton) c).setBorderPainted(false);
            ((AbstractButton) c).setOpaque(false);
        }
        //This is active for GTK L&F. It should be fixed in JDK
        //but it is not fixed in JDK 6.0.
        if (!isMetalLaF && !isFlatLaF) {
            ((AbstractButton) c).setMargin( emptyInsets );
        }
        if( null != label && c != label ) {
            remove( label );
            label = null;
        }
    } else if( c instanceof JToolBar.Separator ) {
        JToolBar.Separator separator = (JToolBar.Separator)c;
        if (getOrientation() == VERTICAL) {
            separator.setOrientation(JSeparator.HORIZONTAL);
        } else {
            separator.setOrientation(JSeparator.VERTICAL);
        }
    }
    
    super.addImpl (c, constraints, idx);
}
 
Example #20
Source File: ToolbarContainer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public ToolbarAqua() {
    super( new BorderLayout() );
    JSeparator sep = new JToolBar.Separator();
    sep.setOrientation(JSeparator.VERTICAL);
    sep.setForeground(UIManager.getColor("NbSplitPane.background")); //NOI18N
    add( sep, BorderLayout.CENTER );
    dim = new Dimension (GRIP_WIDTH, GRIP_WIDTH);
    max = new Dimension (GRIP_WIDTH, Integer.MAX_VALUE);
    setBorder(BorderFactory.createEmptyBorder(4, 0, 2, 0));
}
 
Example #21
Source File: UI.java    From arcgis-runtime-demo-java with Apache License 2.0 5 votes vote down vote up
public static JMenuBar createMenuBar(JMenu menuAdd, JButton btnEdit, JButton btnQuery) {
  JMenuBar menuBar = new JMenuBar();
    menuBar.setFont(UI.FONT);
    menuBar.setBackground(UI.BACKGROUND);
    menuBar.setLayout(new FlowLayout());
    menuBar.setAlignmentX(Component.CENTER_ALIGNMENT);
    menuBar.add(menuAdd);
    menuBar.add(new JSeparator());
    menuBar.add(btnEdit);
    menuBar.add(new JSeparator());
    menuBar.add(btnQuery);
    return menuBar;
}
 
Example #22
Source File: UI.java    From arcgis-runtime-demo-java with Apache License 2.0 5 votes vote down vote up
public static JMenuBar createMenuBar(JMenu menuAdd, JButton btnEdit, JButton btnQuery) {
  JMenuBar menuBar = new JMenuBar();
    menuBar.setFont(UI.FONT);
    menuBar.setBackground(UI.BACKGROUND);
    menuBar.setLayout(new FlowLayout());
    menuBar.setAlignmentX(Component.CENTER_ALIGNMENT);
    menuBar.add(menuAdd);
    menuBar.add(new JSeparator());
    menuBar.add(btnEdit);
    menuBar.add(new JSeparator());
    menuBar.add(btnQuery);
    return menuBar;
}
 
Example #23
Source File: CombinedPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void tweakUI() {
    setBorder(null);
    setDividerSize(5);

    if (!(getUI() instanceof BasicSplitPaneUI)) return;

    BasicSplitPaneDivider divider = ((BasicSplitPaneUI)getUI()).getDivider();
    if (divider != null) {
        Color c = UIUtils.isNimbus() ? UIUtils.getDisabledLineColor() :
                new JSeparator().getForeground();
        divider.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, c));
    }
}
 
Example #24
Source File: SeparableToolBar.java    From libreveris with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Remove any potential orphan separator at the end of the tool bar
 */
public static void purgeSeparator (JToolBar toolBar)
{
    int count = toolBar.getComponentCount();

    if (toolBar.getComponent(count - 1) instanceof JSeparator) {
        toolBar.remove(count - 1);
    }
}
 
Example #25
Source File: CombinedPanel.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
private void tweakUI() {
    setBorder(null);
    setDividerSize(5);

    if (!(getUI() instanceof BasicSplitPaneUI)) return;

    BasicSplitPaneDivider divider = ((BasicSplitPaneUI)getUI()).getDivider();
    if (divider != null) {
        Color c = UIUtils.isNimbus() ? UIUtils.getDisabledLineColor() :
                new JSeparator().getForeground();
        divider.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, c));
    }
}
 
Example #26
Source File: CTaggedNodesContainerNodeMenuBuilder.java    From binnavi with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new builder object.
 *
 * @param graph The graph whose nodes are tagged.
 * @param tag The clicked tag.
 */
public CTaggedNodesContainerNodeMenuBuilder(final ZyGraph graph, final ITreeNode<CTag> tag) {
  m_popupMenu = new JPopupMenu();

  m_popupMenu.add(CActionProxy.proxy(new CSelectNodesAction(graph, tag.getObject())));
  m_popupMenu.add(CActionProxy.proxy(new CSelectVisibleNodesAction(graph, tag.getObject())));
  m_popupMenu.add(new JSeparator());
  m_popupMenu.add(CActionProxy.proxy(new CSelectSubtreeNodesAction(graph, tag)));
  m_popupMenu.add(CActionProxy.proxy(new CSelectVisibleSubtreeNodesAction(graph, tag)));
  m_popupMenu.add(new JSeparator());
  m_popupMenu.add(CActionProxy.proxy(new CUnselectNodesAction(graph, tag.getObject())));
  m_popupMenu.add(CActionProxy.proxy(new CUnselectSubtreeNodesAction(graph, tag)));
}
 
Example #27
Source File: PersistenceProviderComboboxHelper.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    
    if (isSelected) {
        setBackground(list.getSelectionBackground());
        setForeground(list.getSelectionForeground());
    } else {
        setBackground(list.getBackground());
        setForeground(list.getForeground());
    }
    
    if (value instanceof Provider) {
        Provider provider = (Provider)value;
        String text = provider.getDisplayName();
        if (value.equals(defaultProvider) && (!(value instanceof DefaultProvider))) {
            text += NbBundle.getMessage(PersistenceProviderComboboxHelper.class, "LBL_DEFAULT_PROVIDER");
        }
        setText(text);
        
    } else if (SEPARATOR.equals(value)) {
        JSeparator s = new JSeparator();
        s.setPreferredSize(new Dimension(s.getWidth(), 1));
        s.setForeground(Color.BLACK);
        return s;
        
    } else if (EMPTY.equals(value)) {
        setText(" ");
        
    } else if (value instanceof LibraryItem) {
        setText(((LibraryItem) value).getText());
        
    } else {
        setText(value != null ?  value.toString() : ""); // NOI18N
    }
    
    return this;
}
 
Example #28
Source File: CRLFStatus.java    From netbeans with Apache License 2.0 5 votes vote down vote up
static Component panelWithSeparator(JLabel cell) {
    JSeparator separator = new JSeparator(SwingConstants.VERTICAL) {
        @Override
        public Dimension getPreferredSize() {
            return new Dimension(3, 3); // Y-unimportant -> gridlayout will stretch it
        }
    };
    separator.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));

    JPanel panel = new JPanel(new BorderLayout());
    panel.add(separator, BorderLayout.WEST);
    panel.add(cell);
    return panel;
}
 
Example #29
Source File: RMenuItem.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private int getRowCount(Component component, int count) {
    Component[] items = ((JMenu) component).getMenuComponents();
    if (items == null) {
        return 0;
    }
    for (int i = 0; i < items.length; i++) {
        if (items[i] instanceof JMenu) {
            count = getRowCount(items[i], count);
        }
        if (!(items[i] instanceof JSeparator)) {
            count++;
        }
    }
    return count;
}
 
Example #30
Source File: GenericToolbar.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected boolean isFocusableComponent(Component component) {
        if (!component.isVisible()) return false;
//            if (!component.isEnabled()) return false;
        if (component instanceof JLabel) return false;
        if (component instanceof JPanel) return false;
        if (component instanceof JSeparator) return false;
        if (component instanceof JToolBar) return false;
        if (component instanceof Box.Filler) return false;
        return true;
    }