Java JButton CDE/Motif PreferredSize带图像图标和空文本

Java JButton CDE/Motif PreferredSize带图像图标和空文本,java,jbutton,look-and-feel,preferredsize,motif,Java,Jbutton,Look And Feel,Preferredsize,Motif,我正在用CDE/Motif LookAndFeel测试我的Java代码 当PreferredSize建立时,我正在查看JButton的性能/行为 注意:我正在看这篇文章,但我不想改变尺寸(JButton/ImageIcon),只想要LAF之间的“相同”外观 我的代码: 首先,我在fly创建了一个图像来测试porpouses BufferedImage bi = new BufferedImage(13, 13, BufferedImage.TYPE_INT_ARGB); Gra

我正在用CDE/Motif LookAndFeel测试我的Java代码

当PreferredSize建立时,我正在查看JButton的性能/行为

注意:我正在看这篇文章,但我不想改变尺寸(JButton/ImageIcon),只想要LAF之间的“相同”外观

我的代码

首先,我在fly创建了一个图像来测试porpouses

    BufferedImage bi = new BufferedImage(13, 13, BufferedImage.TYPE_INT_ARGB);

    Graphics gr = bi.createGraphics();
    gr.setColor(Color.RED);
    gr.drawLine(6, 0, 6, 13);
    gr.setColor(Color.GREEN);
    gr.drawLine(0, 6, 13, 6);
    gr.dispose();
    gr.drawImage(bi, 0, 0, null);
按钮

    Font inFont = new Font("Monospaced", Font.PLAIN, 10);

    //Creating the Button!
    JButton jbt = new JButton(new ImageIcon(bi));
    jbt.setPreferredSize(new Dimension(30, 21)); // I want to use this Dimension!!!
    jbt.setSize(new Dimension(30, 21));
    jbt.setFont(inFont);
现在面板

    JPanel jpHorz = new JPanel();
    GroupLayout jpLAFLayout = new GroupLayout(jpHorz);
    jpHorz.setLayout(jpLAFLayout);

    //Code to obtain this appareance inserting THE BUTTON 'jbt'
    jpLAFLayout.setHorizontalGroup(
      jpLAFLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(jpLAFLayout.createSequentialGroup()
      .addGap(26, 26, 26)
      .addComponent(jbt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
      .addContainerGap(26, Short.MAX_VALUE))
    );
    jpLAFLayout.setVerticalGroup(
      jpLAFLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(jpLAFLayout.createSequentialGroup()
      .addGap(6, 6, 6)
      .addComponent(jbt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,GroupLayout.PREFERRED_SIZE)
      .addContainerGap(12, Short.MAX_VALUE))
    );
更多代码

    JPanel jpVert = new JPanel();
    jpVert.setBackground(new Color(208, 208, 208));
    jpVert.setLayout(new BoxLayout(jpVert, BoxLayout.PAGE_AXIS));
    jpVert.add(jpHorz);
    frame.add(jpVert, BorderLayout.NORTH);
    frame.setPreferredSize(new Dimension(480, 120));
如您所见,使用CDE/Motif LookAndFeel时图像未满

使用
jbt.setMargin(新的插图(0,0,0,0))我没有得到效果

有没有办法改变Motif LAF按钮的这种糟糕外观?

这里是图像比较