EAS BOS 代码添加弹出式菜单

效果图:

代码:

KDWorkButton btnGather = new KDWorkButton();
btnGather.setText("数据提取");
btnGather.setIcon(EASResource.getIcon("imgTree_table"));
		
KDPopupMenu payPopupMenu = btnGather.getAssistPopup();
KDMenuItem btnRegion = new KDMenuItem("数据汇总(按区域)");
KDMenuItem btnTheme = new KDMenuItem("数据汇总(按主题)");
		
payPopupMenu.add(btnRegion);
payPopupMenu.add(btnTheme);
		
btnGather.setAssistPopup(payPopupMenu);
		
btnRegion.setVisible(true);
btnRegion.setEnabled(true);
btnTheme.setVisible(true);
btnTheme.setEnabled(true);
toolBar.add(btnGather);
btnGather.setVisible(true);
btnGather.setEnabled(true);
		
btnRegion.addActionListener(new ActionListener(){//添加点击事件

    @Override
    public void actionPerformed(ActionEvent e) {
        actionRegion_actionPerformed(e);//自定义
    }
});
		
btnTheme.addActionListener(new ActionListener(){//添加点击事件

    @Override
    public void actionPerformed(ActionEvent e) {
        actionTheme_actionPerformed(e);//自定义
    }
});

猜你喜欢

转载自blog.csdn.net/qq_25170493/article/details/82771188