0

I have a question from swing, I have two forms, the first form is for MDI and the second form is for login, I want when a user enters password and username correct, user can login to MDI‘s form. MDI form use of jform and login form use of jinternalframe, I define JDesktopPane and add login to this, but I want to use button in jframe(MDI form) , when I add button to JDesktopPane, it can add but I cannot set location of my button. Please help me how can set location of my jinternalframe and button?

This is my code:

     Login frame = new Login();
    frame.setVisible(true); 
    desktop=new JDesktopPane();
    desktop.add(frame,BorderLayout.CENTER);
    setContentPane(desktop);
    frame.setSelected(true);  
    frame.setLocation(500, 200);

    FlowLayout flo = new FlowLayout();
    desktop.setLayout(flo);
    JButton buttonSaveCustumer = new JButton("Create Customer");
    buttonSaveCustumer.setLocation(70, 80);
    this.add(buttonSaveCustumer);

Best Regards

Paul Samsotha
  • 205,037
  • 37
  • 486
  • 720
user3373621
  • 11
  • 1
  • 5
  • You need to give us more code. None of us know the class in which this code is being called, what the class 'Login' is, or any context to anything that you posted. Please post your complete code formatted in your question, maybe then we can help you. – BigBerger Mar 25 '14 at 17:05

1 Answers1

0

See below method,//Before using the below method don't forget to set the layout property to null

public void setBounds(int x, int y, int width, int height)

Moves and resizes this component. The new location of the top-left corner is specified by x and y, and the new size is specified by width and height. This method changes layout-related information, and therefore, invalidates the component hierarchy.

Parameters:
x - the new x-coordinate of this component
y - the new y-coordinate of this component
width - the new width of this component
height - the new height of this component
RKC
  • 1,834
  • 13
  • 13