下面列出了javax.swing.JSeparator#setVisible ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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;
}
}
}
}
/**
* 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);
}
}
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);
}