Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

JAVA GridLayout

  1. Oct 29, 2012 #1
    Can anyone tell me how to get the Textbox to the bottom of the applet window?
    Code (Text):

    public void init(){
            setLayout(new GridLayout(6,0,5,5));
            al = new ArrayList();
            addNewWords = new JButton("Add Word");
            displayAllWords = new JButton("Display Words");
            searchForWords = new JButton("Search List");
            removeWords = new JButton("Delete Word");
            removeDuplicates = new JButton("Delete Duplicates");
            removeAllWords = new JButton("Delete all words");
            addNewWords.addActionListener(new ButtonHandlerForAddWord(this));
            newWordTextField = new JTextField("Enter a word", 20);
            add(addNewWords);
            add(displayAllWords);
            add(searchForWords);
            add(removeWords);
            add(removeDuplicates);
            add(removeAllWords);
            add(newWordTextField, BorderLayout.SOUTH);
        }
     
     
  2. jcsd
  3. Oct 29, 2012 #2

    gabbagabbahey

    User Avatar
    Homework Helper
    Gold Member

    Is this method in an extension of a JFrame or other GUI object? If it is a JFrame, you'll want to use JPanel(s) to control the relative positioning of elements.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: JAVA GridLayout
  1. Java Resources (Replies: 4)

  2. [Java] PNGException (Replies: 2)

  3. Java interpreter (Replies: 8)

  4. Java Cylinders (Replies: 2)

Loading...