Java Code Examples for javax.swing.JSeparator#setVisible()

The following examples show how to use javax.swing.JSeparator#setVisible() . 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: 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 2
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 3
Source File: BasicQOptionPaneUI.java    From pumpernickel with MIT License 5 votes vote down vote up
private void installCustomizations(QOptionPane optionPane) {
	JLabel iconLabel = getIconLabel(optionPane);
	JTextArea mainText = getMainMessageTextArea(optionPane);
	JTextArea secondaryText = getSecondaryMessageTextArea(optionPane);
	JPanel footerContainer = getFooterContainer(optionPane);
	JSeparator footerSeparator = getFooterSeparator(optionPane);
	JPanel upperBody = getUpperBody(optionPane);

	installBorder(footerContainer,
			getInsets(optionPane, KEY_FOOTER_INSETS), new Color(0xffDDDDDD));
	installBorder(upperBody, getInsets(optionPane, KEY_UPPER_BODY_INSETS),
			new Color(0xDDffDD));
	installBorder(iconLabel, getInsets(optionPane, KEY_ICON_INSETS),
			new Color(0xffDDff));
	installBorder(mainText, getInsets(optionPane, KEY_MAIN_MESSAGE_INSETS),
			new Color(0xDDDDff));
	installBorder(secondaryText,
			getInsets(optionPane, KEY_SECONDARY_MESSAGE_INSETS), new Color(
					0xDDffff));

	Color separatorColor = getColor(optionPane, KEY_FOOTER_SEPARATOR_COLOR);
	footerSeparator.setVisible(separatorColor != null);
	footerSeparator.setUI(new LineSeparatorUI(separatorColor));

	mainText.setFont(getFont(optionPane, KEY_MAIN_MESSAGE_FONT));
	secondaryText.setFont(getFont(optionPane, KEY_SECONDARY_MESSAGE_FONT));
	mainText.setForeground(getColor(optionPane, KEY_MAIN_MESSAGE_COLOR));
	secondaryText.setForeground(getColor(optionPane,
			KEY_SECONDARY_MESSAGE_COLOR));
	mainText.setDisabledTextColor(getColor(optionPane,
			KEY_MAIN_MESSAGE_COLOR));
	secondaryText.setDisabledTextColor(getColor(optionPane,
			KEY_SECONDARY_MESSAGE_COLOR));

	updateMainMessage(optionPane);
	updateSecondaryMessage(optionPane);
	updateFooter(optionPane);
}