JTextArea position

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MiziaQ
    New Member
    • Nov 2007
    • 63

    JTextArea position

    is there a way to position the jtextarea on the content pane in a certain location ?
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    Originally posted by MiziaQ
    is there a way to position the jtextarea on the content pane in a certain location ?
    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

    Comment

    • Viji nellaiappan
      New Member
      • Jan 2009
      • 23

      #3
      JTextarea position

      I think this coding may help you...

      [code=java]
      import javax.swing.*;
      import java.awt.*;
      public class trial extends JFrame
      {

      JTextArea txtarea;
      JDesktopPane desk;

      public trial(String title) // Constructor
      {
      super(title);
      setDefaultClose Operation(EXIT_ ON_CLOSE);
      desk=new JDesktopPane();
      setContentPane( desk);
      txtarea=new JTextArea();
      txtarea.setBoun ds(150,150,250, 100);
      desk.add(txtare a);
      }

      public static void main(String args[])
      {
      trial t=new trial("TextArea position");
      t.setSize(500,5 00);
      t.setVisible(tr ue);
      }
      }
      [/code]



      Regards,
      Viji nellaiappan
      Last edited by Nepomuk; Feb 26 '09, 10:46 PM. Reason: Please use [CODE] tags

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        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

        Comment

        Working...