Article View: borland.public.jbuilder.java.swing
Article #345overridden JTextField in JDialog
From: Hiroshi
Date: Sun, 28 Aug 2005 02:36
Date: Sun, 28 Aug 2005 02:36
16 lines
1677 bytes
1677 bytes
Hi everyone, a JTextField in a JDialog (or its extended class)ends up with mostly-overridden by paint() for the dialog. Below is the code to demonstrate the problem. When paint() is not included in the dialog class, the field is normally shown, but with it, the field is almost lost. Will you tell me why and how I can avoid this problem? (I do need to include paint() in the dialog class.) Thank you.
PS paint() is called right after add() and not called after show().
import java.awt.*; import javax.swing.*;
class testDlg {
static JDlgExt dlg=new JDlgExt();
public static void main (String args[]) {
dlg.getContentPane().setLayout(new FlowLayout());
dlg.setBounds(10,10,200,200);
dlg.getContentPane().add(new JTextField("text field",12));
dlg.show();
} }
class JDlgExt extends JDialog
{public void paint(Graphics g) {System.out.println("paint!");}}
Technical Details
Message-ID:
<43112344$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 111d45,bf940752da9e232e,start X-Google-Attributes: gid111d45,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Hiroshi" <hiroshinakata@hotmail.com> Sender: "Hiroshi" <hiroshinakata@hotmail.com> Reply-To: "Hiroshi" <hiroshinakata@hotmail.com> Subject: overridden JTextField in JDialog Newsgroups: borland.public.jbuilder.java.swing X-User-Info: 69.192.157.16 NNTP-Posting-Host: 207.105.83.66 Message-ID: <43112344$1@newsgroups.borland.com> Date: 27 Aug 2005 19:36:52 -0700 X-Trace: newsgroups.borland.com 1125196612 207.105.83.66 (27 Aug 2005 19:36:52 -0700) Lines: 16 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail