Results 1 to 4 of 4

Thread: dont know

  1. #1
    selomojemalo is offline Member
    Join Date
    May 2013
    Posts
    10
    Rep Power
    0

    Default refer to object

    hi
    code first :)

    Java Code:
    import java.awt.*;
    import java.awt.event.*;
    
    import javax.swing.*;
    import javax.swing.border.EmptyBorder;
    import com.jgoodies.forms.layout.*;
    import com.jgoodies.forms.factories.FormFactory;
    
    
    
    public class mainWindow extends JFrame {
    
    	private JPanel contentPane;
    	private JPanel loginPane;
    	private JTextField textField;
    	private JTextField textField_1;
    	private JButton btnPotvrdi;
    
    	/**
    	 * Launch the application.
    	 */
    	public static void main(String[] args) {
    		EventQueue.invokeLater(new Runnable() {
    			public void run() {
    				try {
    					mainWindow main = new mainWindow();
    					main.setVisible(true);
    					main.setFocusableWindowState(false);
    					
    					loginFrame login = new loginFrame();                                       :)
    					login.setVisible(true);                                                    :)
    				} catch (Exception e) {
    					e.printStackTrace();
    				}
    			}
    		});
    	}
    
    	/**
    	 * Create the frames.
    	 */
    	public mainWindow() {
    		super("Main window");
    		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    		getContentPane().setPreferredSize(Toolkit.getDefaultToolkit().getScreenSize());
    		pack();
    		setResizable(false);
    		contentPane = new JPanel();
    		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    		contentPane.setLayout(new BorderLayout(0, 0));
    		setContentPane(contentPane);
    	}
    	
    	public void loginFrame() {
    		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    		setSize(300, 150);
    		this.setLocation(Toolkit.getDefaultToolkit().getScreenSize().width/2-this.getSize().width/2, Toolkit.getDefaultToolkit().getScreenSize().height/2-this.getSize().height/2);
    		loginPane = new JPanel();
    		loginPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    		setContentPane(loginPane);
    		loginPane.setLayout(new FormLayout(new ColumnSpec[] {
    				FormFactory.RELATED_GAP_COLSPEC,
    				FormFactory.DEFAULT_COLSPEC,
    				FormFactory.RELATED_GAP_COLSPEC,
    				FormFactory.DEFAULT_COLSPEC,
    				FormFactory.RELATED_GAP_COLSPEC,
    				FormFactory.DEFAULT_COLSPEC,
    				FormFactory.RELATED_GAP_COLSPEC,
    				ColumnSpec.decode("default:grow"),},
    			new RowSpec[] {
    				FormFactory.RELATED_GAP_ROWSPEC,
    				FormFactory.DEFAULT_ROWSPEC,
    				FormFactory.RELATED_GAP_ROWSPEC,
    				FormFactory.DEFAULT_ROWSPEC,
    				FormFactory.RELATED_GAP_ROWSPEC,
    				FormFactory.DEFAULT_ROWSPEC,
    				FormFactory.RELATED_GAP_ROWSPEC,
    				FormFactory.DEFAULT_ROWSPEC,
    				FormFactory.RELATED_GAP_ROWSPEC,
    				FormFactory.DEFAULT_ROWSPEC,}));
    		
    		JLabel lblKorisnikoIme = new JLabel("Korisni\u010Dko ime:");
    		loginPane.add(lblKorisnikoIme, "4, 6");
    		
    		textField = new JTextField();
    		loginPane.add(textField, "8, 6, fill, default");
    		textField.setColumns(10);
    		
    		JLabel lblPassword = new JLabel("Password:");
    		loginPane.add(lblPassword, "4, 10");
    		
    		textField_1 = new JTextField();
    		loginPane.add(textField_1, "8, 10, fill, default");
    		textField_1.setColumns(10);
    		
    		btnPotvrdi = new JButton("Potvrdi");
    		loginPane.add(btnPotvrdi, "8, 14");
    		
    		btnPotvrdi.addActionListener(                                                                           :)
    				new ActionListener(){
    					public void actionPerformed(ActionEvent event){                                 :)
    						                                                                        :)
    					}
    				}
    			);
    		
    	}
    
    }
    i wuld like that loginFrame window that i set to true to become false when someone click on button
    that button is in class loginFrame so how shuld i set it to fals
    i put smiles whares that 2 codes

    btw sorry fo english :)
    Last edited by selomojemalo; 08-04-2013 at 02:47 PM.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,193
    Rep Power
    19

    Default Re: dont know

    Please go through the Forum Rules with special reference to the third paragraph.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    selomojemalo is offline Member
    Join Date
    May 2013
    Posts
    10
    Rep Power
    0

    Default Re: dont know

    i know and sorry, but problem is that i dont know how shuld i title it

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,193
    Rep Power
    19

    Default Re: dont know

    Your login window should probably be a modal JDialog and not a JFrame.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Replies: 2
    Last Post: 10-31-2012, 12:24 AM
  2. Dont know how to use .lastIndexOf
    By reddevilggg in forum New To Java
    Replies: 2
    Last Post: 09-28-2011, 04:23 PM
  3. Dont know what im doing wrong here
    By prendergast36 in forum New To Java
    Replies: 4
    Last Post: 09-09-2011, 09:57 PM
  4. Hello! and I need help. I dont know were to start
    By Fall0ut in forum New To Java
    Replies: 10
    Last Post: 05-19-2010, 06:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •