Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #1037

Re: Creating JTextArea on

From gethostbyname@gmail.com.remove-dii-this
Subject Re: Creating JTextArea on
Message-ID <1172460407.485560.119190@k78g2000cwa.googlegroups.com> (permalink)
Newsgroups comp.lang.java.gui
References <1172458566.252530.165100@z35g2000cwz.googlegroups.com>
Date 2011-04-27 15:31 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
On 25 fev, 23:56, "gethostbyn...@gmail.com" <gethostbyn...@gmail.com>
wrote:
> On 25 fev, 20:52, "TonyB" <t...@kerrisway.freeserve.co.uk> wrote:
>
> > I'm trying out a simple gui. I'm trying to create an text area to allow me
> > to display some text from inside the app if a menu item is clicked. I think
> > JTextArea will do the job, but I'm having problems making it appear.
> > The code to add to my container is
> >         Container contentPane = frame.getContentPane();
> >         JTextArea itemArea = new JTextArea();
> >         contentPane.add(itemArea);
> > is the contentPane the main area of the window ?
> > Tony
>
> Post the complete source code to I understand what you are doing with
> frame reference.
>
> Look a simple working source code:
>
> -------------------------------------------------------------
> package javaapplication3;
>
> import javax.swing.JFrame;
> import javax.swing.JTextArea;
>
> public class Main extends JFrame {
>     private JTextArea textArea;
>
>     public Main() {
>         super("PH");
>
>         setSize(500,500);
>         setVisible(true);
>
>         textArea = new JTextArea();
>         getContentPane().add(textArea);


Forgive me. Put

setVisible(true);

after the

getContentPane().add(textArea);

Maybe, this is your source code problem too.

>
>     }
>
>     public static void main(String[] args) {
>         Main application = new Main();
>         application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
>     }
>
> }
>
> -------------------------------------------------------------
>
> gethostbyname


gethostbyname

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Creating JTextArea on mai "TonyB" <tonyb@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
  Re: Creating JTextArea on gethostbyname@gmail.com.remove-dii-this - 2011-04-27 15:31 +0000
    Re: Creating JTextArea on gethostbyname@gmail.com.remove-dii-this - 2011-04-27 15:31 +0000
      Re: Creating JTextArea on "TonyB" <tonyb@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
  Re: Creating JTextArea on "Michael Dunn" <michael.dunn@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
  Re: Creating JTextArea on gethostbyname@gmail.com.remove-dii-this - 2011-04-27 15:31 +0000

csiph-web