Article View: borland.public.jbuilder.java.swing
Article #10552Re: JTextField Help Urgent
From: Tad Frysinger
Date: Tue, 07 Sep 1999 00:00
Date: Tue, 07 Sep 1999 00:00
68 lines
2170 bytes
2170 bytes
In article <37C69921.813A6CAA@codetech.com>, musa@codetech.com says...
> Hi I need some urgent help
This works for me using JDK 1.2.2:
package tests;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class listtestframe extends JFrame
{
JPanel contentPane;
BorderLayout borderLayout1 = new BorderLayout();
JTextField text = new JTextField("test");
JScrollPane jScrollPane1 = new JScrollPane(text);
JButton jButton1 = new JButton();
//Construct the frame
public listtestframe()
{
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try
{
jbInit();
}
catch(Exception e)
{
e.printStackTrace();
}
}
//Component initialization
private void jbInit() throws Exception
{
contentPane = (JPanel) this.getContentPane();
contentPane.setLayout(borderLayout1);
jButton1.setText("Adjust Text");
jButton1.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
{
jButton1_actionPerformed(e);
}
});
contentPane.add( jScrollPane1, BorderLayout.CENTER );
contentPane.add(jButton1, BorderLayout.SOUTH);
this.setSize(new Dimension(400, 300));
this.setTitle("Frame Title");
}
//Overridden so we can exit on System Close
protected void processWindowEvent(WindowEvent e)
{
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING)
{
System.exit(0);
}
}
void jButton1_actionPerformed(ActionEvent e)
{
text.setText("adjusted");
}
}
Tad Frysinger (TeamB)
Technical Details
Message-ID:
<MPG.123ecdb57283c5a398969c@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<37C69921.813A6CAA@codetech.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,b94fa7a12f86ada8 X-Google-Attributes: gid111d45,public From: tfrysinger@earthlink.net (Tad Frysinger) Subject: Re: JTextField Help Urgent Date: 1999/09/07 Message-ID: <MPG.123ecdb57283c5a398969c@forums.borland.com> X-Deja-AN: 522110568 References: <37C69921.813A6CAA@codetech.com> Organization: RTOne Newsgroups: borland.public.jbuilder.java.swing