Two layouts, one GUI ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MiziaQ
    New Member
    • Nov 2007
    • 63

    #1

    Two layouts, one GUI ?

    I currently created a GUI using the GridLayout in order to have JLabels and JTextFields side-by-side. However, below the button, I would like to have a FlowLayout or something to display the results of the calculation. Is it possible to have two layouts on one GUI?

    public void actionPerformed (ActionEvent event){
    String eventName = event.getAction Command();

    if (eventName.equa ls("calcPED")) {

    FlowLayout experimentLayou t = new FlowLayout();
    contentPane.set Layout(experime ntLayout);

    When I do the following, the JLabels and JTextFields appear disarranged after the button is clicked. Any suggestions ?
  • Nepomuk
    Recognized Expert Specialist
    • Aug 2007
    • 3111

    #2
    If you make a GridLayout of 1x2 (or an other layout, if you wish), put a JPanel in each and then put a GridLayout in the top one and a FlowLayout in the bottom one. That should do the job.

    Greetings,
    Nepomuk

    Comment

    Working...