By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,071 Members | 1,260 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,071 IT Pros & Developers. It's quick & easy.

JTextArea position

P: 63
is there a way to position the jtextarea on the content pane in a certain location ?
Feb 18 '09 #1
Share this Question
Share on Google+
3 Replies


Expert 10K+
P: 11,448
@MiziaQ
You could remove the LayoutManager and position (and size) the component yourself; but I wouldn't do it if I were you: LayoutManagers are much better at that.

Have you taken a look at a JDesktopPane?

kind regards,

Jos
Feb 18 '09 #2

P: 23
I think this coding may help you...

Expand|Select|Wrap|Line Numbers
  1. import javax.swing.*;
  2. import java.awt.*;
  3. public class trial extends JFrame
  4. {
  5.  
  6.     JTextArea txtarea;
  7.     JDesktopPane desk;
  8.  
  9.     public trial(String title)    //  Constructor
  10.     {
  11.         super(title);
  12.         setDefaultCloseOperation(EXIT_ON_CLOSE);
  13.         desk=new JDesktopPane();
  14.         setContentPane(desk);
  15.         txtarea=new JTextArea();
  16.         txtarea.setBounds(150,150,250,100);    
  17.         desk.add(txtarea);
  18.    }
  19.  
  20. public static void main(String args[])
  21. {
  22.      trial t=new trial("TextArea position");
  23.      t.setSize(500,500);
  24.      t.setVisible(true);
  25. }
  26. }
  27.  


Regards,
Viji nellaiappan
Feb 24 '09 #3

Expert 10K+
P: 11,448
If you do it that way you might wrap that txtArea in a JInternalFrame and add the latter to your JDesktop; you can move around your JInternalFrame over the desk top; minimize and maximize it; it's more fun that way.

kind regards,

Jos
Feb 25 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.