Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You don't have a layout manager set, so the JFrame's Default which is BorderLayout, is adding everything to the center, which means when you add pass, it covers over the user, then when you add the login button, it covers over the pass, so it looks like you only have a login button. In order to get what you want:</p> <pre><code>add User at top of window add Pass at middle of window add Login at bottom of window </code></pre> <p>An example of the code could be:</p> <pre><code>launcher.setLayout(new BorderLayout()); launcher.add(user, BorderLayout.NORTH); launcher.add(pass, BorderLayout.CENTER); launcher.add(login, BorderLayout.SOUTH); </code></pre> <p>If you want to make it check login when the button is clicked add an <a href="http://docs.oracle.com/javase/tutorial/uiswing/events/actionlistener.html" rel="nofollow">ActionListener</a> to login. </p> <pre><code>login.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ //Check login stuff here... //with maybe something like this? String sLogin = login.getText(); String sPass = pass.getText(); //Then compare with some other string/data you already have saved somewhere... } }); </code></pre> <p>However if you want more exact layout, you can try searching up <a href="http://docs.oracle.com/javase/tutorial/uiswing/layout/gridbag.html" rel="nofollow">GridBagLayout</a></p> <p>If you want to read more about layouts in general go here: <a href="http://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html" rel="nofollow">LayoutManagers</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload