Adding a vertical separator in PopupMenu, in the task bar

后端 未结 2 2149
灰色年华
灰色年华 2021-02-15 22:57

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:38

    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

提交回复
热议问题