need a scrollable JPopupMenu as the menuitems are sometimes so many that they exceed the screen space and would not be visible. I need a way to scroll through the menu items to avoid this visibility problem.. I have a word document which I am uploading which has all the details as to what I require. [login to view URL] Please note that this is an urgent requirement and I need it by Sunday
## Deliverables
I have developed an application which requires a Scrollable JPopupMenu. Reason for the requirement I need a scrollable JPopupMenu as the menuitems are sometimes so many that they exceed the screen space and would not be visible. I need a way to scroll through the menu items to avoid this visibility problem. What I have implemented I have implemented a Scrollable JPopupMenu which contains JButtons as menuitems. This solves my scrolling issue but I have many other problems. My Project requires the addition of JCheckBoxMenuItems to check and uncheck the menuitems each time the user clicks on the item. My Code 1. [login to view URL] import [login to view URL]; import [login to view URL]; import [login to view URL]; import [login to view URL]; import [login to view URL]; import [login to view URL]; import [login to view URL]; import [login to view URL]; import [login to view URL]; import [login to view URL]; public class ScrollablePopupMenu extends JPopupMenu { private static final long serialVersionUID = 1; private JPanel panelMenus = null; private JScrollPane scroll = null; public ScrollablePopupMenu(GraphicsConfiguration gc) { super(); scroll = new JScrollPane(); panelMenus = new JPanel(); [login to view URL](new GridLayout(0,1)); [login to view URL](panelMenus); [login to view URL](null); [login to view URL](new Dimension([login to view URL]().width, [login to view URL]().getScreenSize().height - [login to view URL]().getScreenInsets(gc).top - [login to view URL]().getScreenInsets(gc).bottom - 4)); [login to view URL](scroll); } public void show(Component invoker, int x, int y) { [login to view URL](); [login to view URL](); int maxsize = [login to view URL]().height; int realsize = [login to view URL]().height; int sizescroll = 0; if (maxsize < realsize) { sizescroll = [login to view URL]().getPreferredSize().width; } [login to view URL](new Dimension( [login to view URL]().width + sizescroll, [login to view URL]().height)); [login to view URL](invoker, x, y); } public void add(JButton menuItem) { [login to view URL](menuItem); } public JMenuItem add(JMenuItem menuItem) { [login to view URL](menuItem); return menuItem; } public void addSeparator() { [login to view URL](new JSeparator()); } } 2. [login to view URL] import [login to view URL]; import [login to view URL]; import [login to view URL]; import [login to view URL]; import [login to view URL]; import [login to view URL]; import [login to view URL]; import [login to view URL]; import [login to view URL]; public class JFramePopupMenu extends JFrame { private static final long serialVersionUID = 1; private JPanel jContentPane = null; private JButton jbnPopup = null; private JTextField jtfNumOfMenus = null; private JLabel lblNumElem = null; private JButton getBtnPopup() { if (jbnPopup == null) { jbnPopup = new JButton(); [login to view URL]("View Popup"); [login to view URL](new ActionListener() { public void actionPerformed(ActionEvent e) { ScrollablePopupMenu scrollablePopupMenu = new ScrollablePopupMenu([login to view URL]()); int n = [login to view URL](getTxtNumElem().getText()); for (int i=0;i
## Platform
Windows, Java JDK 1.5