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


Groups > comp.lang.java.gui > #1190 > unrolled thread

how to dynamically add a

Started by"fenton.travers" <fenton.travers@THRWHITE.remove-dii-this>
First post2011-04-27 15:31 +0000
Last post2011-04-27 15:31 +0000
Articles 5 — 4 participants

Back to article view | Back to comp.lang.java.gui


Contents

  how to dynamically add a "fenton.travers" <fenton.travers@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
    Re: how to dynamically ad "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
    Re: how to dynamically ad "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
    Re: how to dynamically ad "IchBin" <ichbin@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000
    Re: how to dynamically ad "Brandon McCombs" <brandon.mccombs@THRWHITE.remove-dii-this> - 2011-04-27 15:31 +0000

#1190 — how to dynamically add a

From"fenton.travers" <fenton.travers@THRWHITE.remove-dii-this>
Date2011-04-27 15:31 +0000
Subjecthow to dynamically add a
Message-ID<1174053401.150153.259660@d57g2000hsg.googlegroups.com>
  To: comp.lang.java.gui
I'm just getting started with Swing.  I saw the NetBeans GUI builder
tutorial and this blew me away. http://www.netbeans.org/kb/55/quickstart-gui.html.
However, when I want to do something beyond a rather static form, I
feel like there is probably a heck of a lot more that I need to
learn.  Specifically if someone could point me in the right direction
to learn to do at least the following:

I have a single text jTextField, if the user types something in it I
want a second jTextField to show up.  I don't know where I should be
looking to come to understand how to do this type of ?animation?.  If
someone could point me in the general area.  Is this Java 2D?  Is this
something else?  I'd like to learn more on the topic, but first I need
to find out which topic I need to look into.  Any advice is much
appreciated.

Thx,

fenton

---
 * 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

[toc] | [next] | [standalone]


#1191 — Re: how to dynamically ad

From"Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this>
Date2011-04-27 15:31 +0000
SubjectRe: how to dynamically ad
Message-ID<1174053944.917961.253860@b75g2000hsg.googlegroups.com>
In reply to#1190
  To: comp.lang.java.gui
On Mar 17, 12:56 am, fenton.trav...@gmail.com wrote:
> I'm just getting started with Swing.  
...
> I have a single text jTextField, if the user types something in it I
> want a second jTextField to show up.  

First and most important question is Where?
It might be in a free floating JOptionPane or
JDialog or a borderless JWindow or another
JFrame.  If you mean within 'the panel' of
the current JTextField, do you mean above.
below, after, before, instead of?  If anything
besides 'instead of', what happens to the space?
Two text fileds would normally take up more space than
one, so the options are to
- have blank parts on the initial GUI,
ready for new components (yuck).
- resize the entire GUI when a new text field
is added (yuck).
- put the component(s) in a JScrollPane, or..
- a JSplitPane or..

>..I don't know where I should be
> looking to come to understand how to do this type of ?

Layouts.

> ..Any advice is much appreciated.

Try searching 'java tutorial layout'

HTH

Andrew T.

---
 * 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

[toc] | [prev] | [next] | [standalone]


#1192 — Re: how to dynamically ad

From"Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this>
Date2011-04-27 15:31 +0000
SubjectRe: how to dynamically ad
Message-ID<1174054069.579188.291490@y66g2000hsf.googlegroups.com>
In reply to#1190
  To: comp.lang.java.gui
On Mar 17, 12:56 am, fenton.trav...@gmail.com wrote:
> I'm just getting started with Swing.  

..as an aside, there are JTextField's and
JTextArea's, but no jTextField or jTextBox,
in core Swing.

Andrew T.

---
 * 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

[toc] | [prev] | [next] | [standalone]


#1193 — Re: how to dynamically ad

From"IchBin" <ichbin@THRWHITE.remove-dii-this>
Date2011-04-27 15:31 +0000
SubjectRe: how to dynamically ad
Message-ID<78adnZomlKg8JGfYnZ2dnUVZ_g6dnZ2d@ptd.net>
In reply to#1190
  To: comp.lang.java.gui
fenton.travers@gmail.com wrote:
> I'm just getting started with Swing.  I saw the NetBeans GUI builder
> tutorial and this blew me away. http://www.netbeans.org/kb/55/quickstart-gui.html.
> However, when I want to do something beyond a rather static form, I
> feel like there is probably a heck of a lot more that I need to
> learn.  Specifically if someone could point me in the right direction
> to learn to do at least the following:
> 
> I have a single text jTextField, if the user types something in it I
> want a second jTextField to show up.  I don't know where I should be
> looking to come to understand how to do this type of ?animation?.  If
> someone could point me in the general area.  Is this Java 2D?  Is this
> something else?  I'd like to learn more on the topic, but first I need
> to find out which topic I need to look into.  Any advice is much
> appreciated.
> 
> Thx,
> 
> fenton
> 

Personally I would not use a GUI builder if you are trying to lean the 
swing objects. Look at Sun's Really Big Index, 
http://java.sun.com/docs/books/tutorial/reallybigindex.html

Particularly the chapter "Creating a GUI with JFC/Swing".
http://java.sun.com/docs/books/tutorial/uiswing/index.html

IMHO - Netbeans Matisse is nice but in the long run is very inflexible 
and by far the wrong way to learn swing GUI programming because you will 
not.

The fact that you are referring to GUI objects that do not exist is a 
good indicator.

-- 
Thanks in Advance...           http://weconsultants.prophp.org
IchBin, Pocono Lake, Pa, USA   http://ichbinquotations.awardspace.com
______________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)

---
 * 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

[toc] | [prev] | [next] | [standalone]


#1208 — Re: how to dynamically ad

From"Brandon McCombs" <brandon.mccombs@THRWHITE.remove-dii-this>
Date2011-04-27 15:31 +0000
SubjectRe: how to dynamically ad
Message-ID<45fcda8d$0$28103$4c368faf@roadrunner.com>
In reply to#1190
  To: comp.lang.java.gui
fenton.travers@gmail.com wrote:
> I'm just getting started with Swing.  I saw the NetBeans GUI builder
> tutorial and this blew me away. http://www.netbeans.org/kb/55/quickstart-gui.html.
> However, when I want to do something beyond a rather static form, I
> feel like there is probably a heck of a lot more that I need to
> learn.  Specifically if someone could point me in the right direction
> to learn to do at least the following:
> 
> I have a single text jTextField, if the user types something in it I
> want a second jTextField to show up.  I don't know where I should be
> looking to come to understand how to do this type of ?animation?.  If
> someone could point me in the general area.  Is this Java 2D?  Is this
> something else?  I'd like to learn more on the topic, but first I need
> to find out which topic I need to look into.  Any advice is much
> appreciated.
> 
> Thx,
> 
> fenton
> 

To actually provide useful information unlike the other guys' responses, 
I'll give you a few points of advice. Issues concerning where you want 
the new field to show up within the same containing component such as 
above/below your existing field are irrelevant to providing some advice. 
If you want the new field to be in a dialog window then that would 
change the advice though.

Under the assumption you want another text field to show up in the same 
component (Jpanel or Jframe) as the original text field you will need to 
  probably need a document listener on the first textfield if you want 
simple typing to be the trigger for the 2nd field's appearance.  Have 
the appropriate method of the document listener (DocumentListener is the 
class I believe) call the code that creates another JTextField. You will 
need to call the repaint() method of the component that contains those 
JTextField's so that the new field is actually visible.  Issues 
concerning resizing, etc. will need addressed; I use the gridbag layout 
so I can define grid values for new components and that way I know 
exactly where they will show up.

I believe the best practice for something like this though is to have 
the 2nd field always be visible but to be disabled until its use is 
required. That way the user is not surprised when the 2nd field appears 
out of no where (especially if you code it such that the window is 
automatically resized which you shouldn't do).

---
 * 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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.gui


csiph-web