Article View: borland.public.jbuilder.java.swing
Article #346Re: overridden JTextField in JDialog
From: Doychin Bondzhev
Date: Sun, 28 Aug 2005 07:34
Date: Sun, 28 Aug 2005 07:34
20 lines
1971 bytes
1971 bytes
try to call super.paint() before your paint code.
Doychin
Hiroshi wrote:
> 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:
<431168c2@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!tsicnews.teliasonera.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<43112344$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 111d45,bf940752da9e232e X-Google-Attributes: gid111d45,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Sun, 28 Aug 2005 10:34:06 +0300 From: Doychin Bondzhev <doychin@dsoft-bg.com> User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing Subject: Re: overridden JTextField in JDialog References: <43112344$1@newsgroups.borland.com> In-Reply-To: <43112344$1@newsgroups.borland.com> Content-Type: text/plain; charset=windows-1251; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 217.10.246.225 Message-ID: <431168c2@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1125214402 217.10.246.225 (28 Aug 2005 00:33:22 -0700) Lines: 20 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!tsicnews.teliasonera.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail