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

Java 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(newWordTextField, BorderLayout.SOUTH);
  2. jcsd
  3. Oct 29, 2012 #2


    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.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook