本文整理汇总了Java中javax.swing.JPopupMenu.Separator类的典型用法代码示例。如果您正苦于以下问题:Java Separator类的具体用法?Java Separator怎么用?Java Separator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Separator类属于javax.swing.JPopupMenu包,在下文中一共展示了Separator类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeScaleOptionPanel
import javax.swing.JPopupMenu.Separator; //导入依赖的package包/类
public static JPanel makeScaleOptionPanel(){
// create the side panel with scale change options
JPanel optionPanel = new JPanel();
optionPanel.add(Box.createVerticalStrut(20));
optionPanel.setLayout(new BoxLayout(optionPanel,BoxLayout.Y_AXIS));
optionPanel.add(makeScalePanel(pv1,"View (0,0)"));
optionPanel.add(Box.createVerticalStrut(20));
optionPanel.add(new Separator());
optionPanel.add(makeScalePanel(pv2,"View (0,1)"));
optionPanel.add(Box.createVerticalStrut(20));
optionPanel.add(new Separator());
optionPanel.add(makeScalePanel(pv3,"View (1,0)"));
optionPanel.add(Box.createVerticalStrut(20));
optionPanel.add(new Separator());
optionPanel.add(makeScalePanel(pv4,"View (1,1)"));
optionPanel.add(Box.createVerticalStrut(20));
return optionPanel;
}
示例2: createFileMenu
import javax.swing.JPopupMenu.Separator; //导入依赖的package包/类
/**
* Creates the file menu
*
* @return the file menu
*/
private JMenu createFileMenu() {
JMenu fileMenu = new JMenu(getCaption("tab_file"));
// Input folder
folder = new JMenuItem(getCaption("tab_item_choose_input"));
folder.addActionListener(new FileInputListener(new UiCallback(), frame));
// Output folder
outputFolder = new JMenuItem(getCaption("tab_item_choose_output"));
outputFolder.addActionListener(new FileOutputListener(frame));
// Exit button
JMenuItem exit = new JMenuItem(getCaption("tab_item_exit"));
exit.addActionListener(ae -> shutdown());
fileMenu.add(folder);
fileMenu.add(outputFolder);
fileMenu.add(new Separator());
fileMenu.add(exit);
return fileMenu;
}
示例3: disableOrEnableMenuItems
import javax.swing.JPopupMenu.Separator; //导入依赖的package包/类
private void disableOrEnableMenuItems() {
//ce ni nobenega izbranega frejma, onemogoci
//menije, ki potrebujejo sliko
MenuElement[] menuElement = meni.menuBar.getSubElements();
Component[] component;
//boolean isThereAnyFrame = (desktop.getAllFrames().length > 0); //TODONEW
boolean isThereASelectedFrame = !( desktop.getSelectedFrame() == null );
for ( int i = 0; i < meni.menuBar.getMenuCount() ; i++ ) {
component = ((JMenu) menuElement[i]).getMenuComponents();
for ( int j = 0; j < ((JMenu) menuElement[i]).getItemCount(); j++ ) {
if (component[j] instanceof Separator)
continue;
//ce ni izbrane slike in ce meni ajtem potrebuje eno ali vec slik pol ga disejbla
if ( !isThereASelectedFrame && (((MyMenuInterface)component[j]).noOfOperands() > 0) ) {
component[j].setEnabled(false);
}
else {
component[j].setEnabled(true);
}
}
}
}
示例4: buildBottomPane
import javax.swing.JPopupMenu.Separator; //导入依赖的package包/类
/** @{hide */
private JComponent buildBottomPane() {
JPanel p = new JPanel(new BorderLayout());
JPanel f = new JPanel(new FlowLayout(FlowLayout.RIGHT));
f.add(btnCancel);
f.add(btnPrev);
f.add(btnNext);
p.add(new JSeparator(Separator.HORIZONTAL), BorderLayout.NORTH);
p.add(f, BorderLayout.SOUTH);
return p;
}
示例5: fillSubMenu
import javax.swing.JPopupMenu.Separator; //导入依赖的package包/类
@Messages({
"LBL_NewFileAction_File_PopupName=Other...",
"NewFile.please_wait=Please wait..."
})
private void fillSubMenu(final JMenu menuItem, final Lookup lookup) {
menuItem.removeAll();
JMenuItem wait = new JMenuItem(NewFile_please_wait());
wait.setEnabled(false);
menuItem.add(wait);
final Pair<List<Project>, List<FileObject>> data = ActionsUtil.mineFromLookup(lookup);
RP.post(new Runnable() {
@Override public void run() {
Project projects[] = ActionsUtil.getProjects(data);
final Project project = projects.length > 0 ? projects[0] : null;
final List<TemplateItem> items = OpenProjectList.prepareTemplates(project, getLookup());
EventQueue.invokeLater(new Runnable() {
@Override public void run() {
menuItem.removeAll();
ActionListener menuListener = new PopupListener();
for (TemplateItem i : items) {
JMenuItem item = new JMenuItem(
LBL_NewFileAction_Template_PopupName(i.displayName),
i.icon);
item.addActionListener(menuListener);
item.putClientProperty(TEMPLATE_PROPERTY, i.template);
item.putClientProperty(IN_PROJECT_PROPERTY, project != null);
menuItem.add(item);
}
if (!items.isEmpty()) {
menuItem.add(new Separator());
}
JMenuItem fileItem = new JMenuItem(LBL_NewFileAction_File_PopupName(), (Icon) getValue(Action.SMALL_ICON));
fileItem.addActionListener(menuListener);
fileItem.putClientProperty(TEMPLATE_PROPERTY, null);
fileItem.putClientProperty(IN_PROJECT_PROPERTY, project != null);
menuItem.add(fileItem);
// #205616 - need to refresh please wait node
menuItem.getPopupMenu().pack();
}
});
}
});
}
示例6: setup
import javax.swing.JPopupMenu.Separator; //导入依赖的package包/类
protected final void setup() {
for (MenuElement me : globalCacheMenu.getSubElements()) {
if (AbstractButton.class.isInstance(me)) {
buttonGroup.remove((AbstractButton) me);
}
}
globalCacheMenu.removeAll();
globalCacheRadioButtons = new JRadioButton[GlobalCacheManager.getInstance().getAutomatic().length + GlobalCacheManager.getInstance().getManual().length];
InetAddress[] automaticGlobalCaches = GlobalCacheManager.getInstance().getAutomatic();
InetAddress[] manualGlobalCaches = GlobalCacheManager.getInstance().getManual();
int index = 0;
for (InetAddress ipName : manualGlobalCaches) {
addGlobalCache(index, ipName.getHostName(), ipName, "Manually entered GlobalCache.");
index++;
}
if (automaticGlobalCaches.length > 0 && manualGlobalCaches.length > 0)
globalCacheMenu.add(new Separator());
String[] automaticGlobalCachesPretty = GlobalCacheManager.getInstance().getAutomaticPrettyNames();
for (int i = 0; i < automaticGlobalCaches.length; i++) {
addGlobalCache(index, automaticGlobalCachesPretty[i],
automaticGlobalCaches[i], "Automatically discovered GlobalCache.");
index++;
}
globalCacheMenu.add(new Separator());
JMenuItem manualAddMenuItem = new JMenuItem("Add manually...");
manualAddMenuItem.setMnemonic('A');
globalCacheMenu.add(manualAddMenuItem);
manualAddMenuItem.addActionListener((java.awt.event.ActionEvent evt) -> {
try {
String ip = guiUtils.getInput("Enter GlobalCache IP-Name or -address", "GlobalCache entry", GlobalCache.defaultGlobalCacheIP);
if (ip != null)
GlobalCacheManager.getInstance().addManualGlobalCache(InetAddress.getByName(ip));
} catch (UnknownHostException ex) {
guiUtils.error(ex);
}
});
globalCacheMenu.repaint();
globalCacheMenu.getParent().repaint();
}
示例7: addContact
import javax.swing.JPopupMenu.Separator; //导入依赖的package包/类
/**
* Shows the appropriate user interface that would allow the user to add
* the given <tt>SourceUIContact</tt> to their contact list.
*
* @param contact the contact to add
*/
private void addContact(SourceUIContact contact)
{
SourceContact sourceContact = (SourceContact) contact.getDescriptor();
List<ContactDetail> details = sourceContact.getContactDetails(
OperationSetPersistentPresence.class);
int detailsCount = details.size();
if (detailsCount > 1)
{
JMenuItem addContactMenu = TreeContactList.createAddContactMenu(
(SourceContact) contact.getDescriptor());
JPopupMenu popupMenu = ((JMenu) addContactMenu).getPopupMenu();
// Add a title label.
JLabel infoLabel = new JLabel();
infoLabel.setText("<html><b>"
+ GuiActivator.getResources()
.getI18NString("service.gui.ADD_CONTACT")
+ "</b></html>");
popupMenu.insert(infoLabel, 0);
popupMenu.insert(new Separator(), 1);
popupMenu.setFocusable(true);
popupMenu.setInvoker(treeContactList);
Point location = new Point(addContactButton.getX(),
addContactButton.getY() + addContactButton.getHeight());
SwingUtilities.convertPointToScreen(location, treeContactList);
location.y = location.y
+ treeContactList.getPathBounds(treeContactList.getSelectionPath()).y;
popupMenu.setLocation(location.x + 8, location.y - 8);
popupMenu.setVisible(true);
}
else if (details.size() == 1)
{
TreeContactList.showAddContactDialog(
details.get(0),
sourceContact.getDisplayName());
}
}