Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2006

Tip: Looking for answers? Try searching our database.

JTextField inactive in a JWindow

Thread view: 
aaronfude@gmail.com - 24 Aug 2006 02:31 GMT
Hi,

In my working application, I changed from a JFrame to a JWindow and my
JTextField's have ceased to be editable.

How do I fix this?

Thanks!

Aaron Fude
Andrew Thompson - 24 Aug 2006 03:30 GMT
..
> In my working application,

?

>..I changed from a JFrame to a JWindow and my
> JTextField's have ceased to be editable.

<sscce>
import javax.swing.*;

public class EditableTextFieldTest {
 public static void main(String args[]) {
   JTextField tf1 = new JTextField("Frame", 20);
   JTextField tf2 = new JTextField("Owned Window", 20);
   JTextField tf3 = new JTextField("Free Window", 20);

   JFrame f = new JFrame(System.getProperty("java.version"));
   f.getContentPane().add( tf1 );
   f.pack();
   f.setLocation(50,50);
   f.setVisible(true);

   JWindow wO = new JWindow(f);

   wO.getContentPane().add( tf2 );
   wO.pack();
   wO.setLocation(100,100);
   wO.setVisible(true);

   JWindow wF = new JWindow();

   wF.getContentPane().add( tf3 );
   wF.pack();
   wF.setLocation(150,150);
   wF.setVisible(true);
 }
}
</sscce>

Andrew T.
aaronfude@gmail.com - 24 Aug 2006 12:26 GMT
Thanks, that was very insightful!

It doesn't seem to work unless the JFrame is visible and my whole point
of using a JWindow is not no frame is visible and that there's nothing
on the taskbar.

How can *that* be accomplisher?

Thanks!

Aaron Fude
Andrew Thompson - 24 Aug 2006 12:47 GMT
> Thanks, that was very insightful!

No worries..

> It doesn't seem to work unless the JFrame is visible and my whole point
> of using a JWindow is not no frame is visible and that there's nothing
> on the taskbar.
>
> How can *that* be accomplisher?

Well.. fussy, fussy..

<sscce>
import javax.swing.*;

public class EditableTextFieldTest {
 public static void main(String args[]) {
   JTextField tf1 = new JTextField("Frame", 20);
   JTextField tf2 = new JTextField("Owned Window", 20);
   JTextField tf3 = new JTextField("Free Window", 20);

   JFrame f = new JFrame();
   f.getContentPane().add( tf1 );
   f.pack();
   f.setLocation(-100,-100);
   f.setVisible(true);

   JWindow wO = new JWindow(f);

   wO.getContentPane().add( tf2 );
   wO.pack();
   wO.setLocation(100,100);
   wO.setVisible(true);

   JWindow wF = new JWindow();

   wF.getContentPane().add( tf3 );
   wF.pack();
   wF.setLocation(150,150);
   wF.setVisible(true);
 }
}
</sscce>

;-)

Andrew T.
aaronfude@gmail.com - 24 Aug 2006 14:53 GMT
Thanks, but this will still cause an application button to appear on
the taskbar in Windows. Is it possible to avoid that? Thanks!
Thomas Weidenfeller - 24 Aug 2006 15:03 GMT
> Thanks, but this will still cause an application button to appear on
> the taskbar in Windows. Is it possible to avoid that? Thanks!

Why didn't you specify this requirement in your original posting? We
can't read your mind. Use a JDialog and turn its decoration off.

/Thomas
Signature

The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/

aaronfude@gmail.com - 24 Aug 2006 15:24 GMT
Thanks!

(FWIW, I did specify in my second post.)


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.