Results 1 to 4 of 4

Thread: java window

  1. #1
    nikkka is offline Member
    Join Date
    Mar 2011
    Posts
    45
    Rep Power
    0

    Default java window

    What's the matter with this code?
    I want to get something like on the attached picture :S
    Java Code:
    import java.awt.Dimension;
    import java.awt.GridLayout;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JTextArea;
    public class Bounce {
    	public static void main(String[] args) {
    		JFrame frame = new JFrame();
    		frame.setSize(new Dimension(600, 350));
    		frame.setResizable(false);
    		frame.setTitle(new String("test"));
    		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    		JPanel panel = new JPanel();
    		panel.setPreferredSize(new Dimension(600, 300));
    		panel.setLayout(new GridLayout(0,2,50,50));
    		JTextArea text1 = new JTextArea();
    		JTextArea text2 = new JTextArea();
    		panel.add(text1);
    		panel.add(text2);
    		frame.getContentPane().add(panel);
    		frame.setVisible(true);
    	}
    }
    Attached Thumbnails Attached Thumbnails java window-untitled.jpg  

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,001
    Rep Power
    10

    Default

    You tell us. What does the code do instead?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Vase is offline Member
    Join Date
    Jan 2011
    Location
    Gainesville, FL
    Posts
    45
    Rep Power
    0

    Default

    And what's the problem? It works fine for me.

  4. #4
    nikkka is offline Member
    Join Date
    Mar 2011
    Posts
    45
    Rep Power
    0

    Default

    It stretches text fields on whole window when I want it to make an alignment of 50 pixels :S

Similar Threads

  1. Replies: 4
    Last Post: 01-10-2010, 08:48 AM
  2. change url in parent window from child window
    By rakesh_n_mehta in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 07-09-2009, 01:17 PM
  3. how can i move one frame window to another window
    By santhosh_el in forum AWT / Swing
    Replies: 8
    Last Post: 06-10-2009, 04:36 PM
  4. how we get popup window in java
    By baserohit in forum Advanced Java
    Replies: 1
    Last Post: 03-22-2008, 05:39 AM
  5. Locking window in java
    By coco in forum AWT / Swing
    Replies: 1
    Last Post: 07-31-2007, 08:21 AM

Posting Permissions

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