Java 如何在流布局中组织对象?

Java 如何在流布局中组织对象?,java,swing,oop,user-interface,flowlayout,Java,Swing,Oop,User Interface,Flowlayout,我想要一个jframe,文本在左边(JLabel),按钮在右边。我先添加了文本,希望尽量不要将框架设置为从右向左 结束帧代码。。。使用其他类的信息,其他类更新JLabel public class endFrame extends JFrame { public endFrame() { setSize(500,75); setLayout(new FlowLayout()); add(board.winner); JButton r = new JButton(

我想要一个jframe,文本在左边(JLabel),按钮在右边。我先添加了文本,希望尽量不要将框架设置为从右向左

结束帧代码。。。使用其他类的信息,其他类更新JLabel

public class endFrame extends JFrame
{
public endFrame()
{
    setSize(500,75);
    setLayout(new FlowLayout());
    add(board.winner);
    JButton r = new JButton("Reset");
    r.addActionListener(board.mouse);
    add(r);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setLocationRelativeTo(null);
}
}

MadProgrammer向我展示了使用Container#add(comont,int)可以按照所需的正确顺序移动对象

对我来说很好,文本在左边,按钮在右边right@MadProgrammer我想这与我更新jlabel有关。是否有办法确保按钮位于右侧,jlabel位于左侧?除了按顺序添加它们之外