Popup menun

I would like to modifiy some of the properties of the popup menu that is created from createPopupMenu. The returned type is of JPopupMenu. I can modify the border color by

menu.background = system.gui.color(255,0,0)

I am looking to modify the following attributes for the popup:
Background color (not just the border)
Fill Area
width
text wrapping

Also, Is there a way to add a separator? I can use the following to add a separator after the menu is created

menu.addSeparator()

But I cannot seem to add anything after the separator that has a function. The following code can adds a separator and another menu item called “XXX”

menu.addSeparator()
menu.add("XXX")   

The problem is that there is no function associated with the “XXX” menu item. I have tried the following, but all with errors:

menu.addSeparator()
menu.add("XXX",doMenuItem1)   

The code below generates a popup menu on the clicked event of a button.

menu.addSeparator()
menu.add({"XXX":doMenuItem1}) 


m = []
f = []

def doMenuItem1(event):
    import system
    system.gui.messageBox("Report 1 selected")
def doMenuItem2(event):
	import system
	system.gui.messageBox("Report 2 selected")
def doMenuItem3(event):
	import system
	system.gui.messageBox("Report 3 selected")

import system

m.append("Report 1")
m.append("Report 2")
m.append("Report 3")

f.append(doMenuItem1)
f.append(doMenuItem2)
f.append(doMenuItem3)

menu = system.gui.createPopupMenu(m,f)

menu.background = system.gui.color(255,0,0)


menu.show(event,event.source.parent.x,event.source.parent.y+25)

Figured it out:

Turns out i needed to create each java menuitem and assign the properties to each. Then add all the java menu items to the JPopupMenu that is returned from the createPopupMenu.

Here were some useful links:

http://docs.oracle.com/javase/6/docs/api/javax/swing/JComponent.html#getInsets()
http://www.java2s.com/Tutorial/Java/0240__Swing/CustomizingJMenuItemLookandFeel.htm

from javax.swing import JMenuItem
from javax.swing.border import EmptyBorder

def doMenuItem1(event):
    import system
    system.gui.messageBox("Report 1 selected")
def doMenuItem2(event):
	import system
	system.gui.messageBox("Report 2 selected")
def doMenuItem3(event):
	import system
	system.gui.messageBox("Report 3 selected")

import system

menu = system.gui.createPopupMenu([],[])


menuitem1 =  JMenuItem ("Report 1",actionPerformed=doMenuItem1)
menuitem1.background = system.gui.color(0,0,0)
menuitem1.foreground = system.gui.color(255,255,255)
menu.add(menuitem1)

menuitem2 =  JMenuItem ("Report 2",actionPerformed=doMenuItem2)
menuitem2.background = system.gui.color(0,0,0)
menuitem2.foreground = system.gui.color(255,255,255)
menu.add(menuitem2)

menu.addSeparator()

menuitem3 =  JMenuItem ("Report 3",actionPerformed=doMenuItem3)
menuitem3.background = system.gui.color(0,0,0)
menuitem3.foreground = system.gui.color(255,255,255)
menu.add(menuitem3)


menu.setPopupSize(150, 25*3)
menu.setBackground(system.gui.color(0,0,0))

menu.show(event,event.source.parent.x,event.source.parent.y+25)

Glad you got it figured out.