Adding a vertical separator in PopupMenu, in the task bar

后端 未结 2 1715
感动是毒
感动是毒 2021-02-15 23:13

How can I add a vertical separator in the pop up menu of the app in the task bar ?

   tray = SystemTray.getSystemTray();             
   openMenuItem = new MenuI         


        
2条回答
  •  孤独总比滥情好
    2021-02-15 23:55

    ideas

    1. add Borders (MatteBorders for example) to the JMenuItem(s)

    2. add JPanel to the JPopup

      • have to set BorderLayout for JPopup and put JPanel to the CENTER area (and/or with Borders too)

      • set BorderLayout for JPanel

      • there put JSeparator to the EAST or WEST area (depends or direction)

      • put there another JPanel with JButtons that simulating JMenuItem (doesn't difrerence on 1st sight) with output to the Swing Action or ActionListener

    3. the same things with JWindow (I using by default instead JPopup or ToolTip) instead of JPopup

    4. maybe I'm wrong but JPopup looks like as chameleon

      • once time as JPanel,

      • another as JWindow,

      • sorry no deepest knowledge, interest about

提交回复
热议问题