如何将mac_widgets java api中的小部件添加到HUD窗口

如何将mac_widgets java api中的小部件添加到HUD窗口,java,jpanel,widget,macos,hud,Java,Jpanel,Widget,Macos,Hud,你好 我最近来过纽约。我浏览了文档和示例,但没有找到将小部件添加到窗口的方法。我是通过一个在线解决方案来的 panel.setLayout(新的BoxLayout?(panel,BoxLayout?.Y_轴)); panel.add(sourceList.getComponent()) 如果panel是对JPanel对象的引用,并且它被添加到JFrame窗口中,那么这种方法是有效的 有没有一种方法可以将面板添加到mac_widgets api中的HUD窗口?试试下面的代码,当然你不会得到透明度。

你好

我最近来过纽约。我浏览了文档和示例,但没有找到将小部件添加到窗口的方法。我是通过一个在线解决方案来的

panel.setLayout(新的BoxLayout?(panel,BoxLayout?.Y_轴)); panel.add(sourceList.getComponent())

如果panel是对JPanel对象的引用,并且它被添加到JFrame窗口中,那么这种方法是有效的


有没有一种方法可以将面板添加到mac_widgets api中的HUD窗口?

试试下面的代码,当然你不会得到透明度。但这是如何将面板添加到HUD窗口的。尝试解压缩MacWiget.jar文件以查看其他类。组件有不同的名称,在本例中,面板称为ActivePanel

import javax.swing.JButton;

import com.explodingpixels.macwidgets.ActivePanel;
import com.explodingpixels.macwidgets.HudWidgetFactory;
import com.explodingpixels.macwidgets.HudWindow;

public class MacWidgetTest {


    public static void main(String[] args) {
        setGUI();   
    }

    public static void setGUI() {
        System.out.println("Starting GUI");
        HudWindow hud = new HudWindow("Window");
        hud.getJDialog().setSize(300, 350);
        hud.getJDialog().setLocationRelativeTo(null);
        ActivePanel panel = new ActivePanel();
        JButton button = HudWidgetFactory.createHudButton("Button");
        panel.add(button);
        hud.setContentPane(panel);
        hud.getJDialog().setVisible(true);
    }

}

试试下面的代码,当然你不会得到透明度。但这是如何将面板添加到HUD窗口的。尝试解压缩MacWiget.jar文件以查看其他类。组件有不同的名称,在本例中,面板称为ActivePanel

import javax.swing.JButton;

import com.explodingpixels.macwidgets.ActivePanel;
import com.explodingpixels.macwidgets.HudWidgetFactory;
import com.explodingpixels.macwidgets.HudWindow;

public class MacWidgetTest {


    public static void main(String[] args) {
        setGUI();   
    }

    public static void setGUI() {
        System.out.println("Starting GUI");
        HudWindow hud = new HudWindow("Window");
        hud.getJDialog().setSize(300, 350);
        hud.getJDialog().setLocationRelativeTo(null);
        ActivePanel panel = new ActivePanel();
        JButton button = HudWidgetFactory.createHudButton("Button");
        panel.add(button);
        hud.setContentPane(panel);
        hud.getJDialog().setVisible(true);
    }

}