Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Oct 2003
    Location
    SC
    Posts
    936
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Scrollable GUI app in JAVA

    Hi guys,

    Code:
    import javax.swing.*;
    import BreezySwing.*;
    
    public class StudentTestScores extends GBFrame{
    	
    	JButton Submit, Shuffle;
    	
    	public StudentTestScores(){
    	   	JLabel nameLabel;
    	   	JTextField nameField;
    	   	
    	   	Submit  = addButton ("Submit" ,1,1,1,1);
    	   	Shuffle = addButton ("Suffle" ,1,2,1,1);
    	   	
    	   	for(int i=0; i<=10; i++) {
    	   		nameLabel = addLabel 	 ("Name"  ,i+2,1,1,1);
    			nameField = addTextField (""	  ,i+2,2,1,1);
    		}
    	}
    
      public void buttonClicked (JButton buttonObj){
          if      (buttonObj == Submit){};
       }
    
       public static void main (String[] args){
          StudentTestScores theGUI = new StudentTestScores();
          theGUI.setSize (200, 800);
          theGUI.setVisible(true);
       }
    }
    The above code is the start of one of my little projects, however I need to archive the same GUI window as the above program does, the only thing is i have to be able to refer back to all the textareas...

    So how could I do that?

    And How could I make everything scroll so it isnt that squeezed...

    thanks guys
    Attached Files Attached Files

  • #2
    New to the CF scene
    Join Date
    Aug 2004
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Im kind of new to java, but dont you have to set up actionlistners for your buttons, so that if you want an event to happen, it can? not too great on GUI's, but that was the bit that I found the hardest.

    Andy

  • #3
    Regular Coder
    Join Date
    Oct 2003
    Location
    SC
    Posts
    936
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That is the problem i have, I cant refer to all of them cause they all have the same name

  • #4
    Senior Coder
    Join Date
    Aug 2002
    Location
    Kansas City, Kansas
    Posts
    1,518
    Thanks
    0
    Thanked 2 Times in 2 Posts
    I'm new to java also. Is there some way to tack on the iterating variable to the name of the gui components? Like, nameLabel1, nameLabel2, etc.

  • #5
    Regular Coder
    Join Date
    Oct 2003
    Location
    SC
    Posts
    936
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thats what I am trying to do, but it seems that I can not make an array full of objects....

    thanks for any ideas


  •  

    Posting Permissions

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