lafolle24320
Messages postés406Date d'inscriptionsamedi 26 mars 2005StatutMembreDernière intervention29 juin 2009
-
5 avril 2007 à 09:10
Twinuts
Messages postés5375Date d'inscriptiondimanche 4 mai 2003StatutModérateurDernière intervention14 juin 2023
-
5 avril 2007 à 14:35
Bonjour,
Je crée un JPopupMenu et j'écris dedans. Poour l'instant l'orientation est horizontal mais je voudrais le mettre en vertical. Doit on changé l'orientation du popup ou du texte dedans? Dans les 2 cas je n'arrive pas à trouver une méthode permettant de mettre à la verticale. Voici ci dessous ma classe ou est créer se JPopup.
/**
* That class display a line of information on the chart.
* @author girard
*/
public class LineInfoPopup extends MouseAdapter
{
private transient final JPopupMenu popup;
/**
* Constructor makes a new LineInfoPopup invisible.
*/
public LineInfoPopup()
{
super();
popup = new JPopupMenu();
}
/**
* Display the LineInfoPopup when MouseEvent occurs.
* @param event MouseEvent
* @param menuList Menu to display
*/
public void display(final MouseEvent event, final ArrayList menuList)
{
String menuLabel;
final Iterator menuIterator = menuList.iterator();
popup.removeAll();
// add information of the menu in the line
while(menuIterator.hasNext())
{
menuLabel = menuIterator.next().toString();
// check if there is some line to display
if(popup.getComponentCount() > 0)
{
// display the line where we have clicked.
popup.show(event.getComponent(), event.getX(), event.getY());
}
}
/**
* add information in the line.
* @param menuLabel info
*/
private void addMenuItem(final String menuLabel)
{
final JMenuItem item = new JMenuItem(menuLabel);
popup.add(item);
}
}