call frame again

call frame again

View Answers

January 27, 2009 at 5:06 AM

Hi friend,



I am sending you a running code please implement following code according to requirement.

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class TextDemo extends JPanel implements ActionListener {
protected JTextField textField;
protected JTextArea textArea;
private final static String newline = "\n";

public TextDemo(){
super(new GridBagLayout());

textField = new JTextField(20);
textField.addActionListener(this);

textArea = new JTextArea(5, 20);
textArea.setEditable(false);
JScrollPane scrollPane = new JScrollPane(textArea);

//Add Components to this panel.
GridBagConstraints c = new GridBagConstraints();
c.gridwidth = GridBagConstraints.REMAINDER;

c.fill = GridBagConstraints.HORIZONTAL;
add(textField, c);

c.fill = GridBagConstraints.BOTH;
c.weightx = 1.0;
c.weighty = 1.0;
add(scrollPane, c);
}

public void actionPerformed(ActionEvent evt) {
String text = textField.getText();
textArea.append(text + newline);
textField.selectAll();
textArea.setCaretPosition(textArea.getDocument().getLength());
}

private static void createAndShowGUI() {
JFrame frame = new JFrame("TextDemo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

//Add contents to the window.
frame.add(new TextDemo());
frame.setSize(300,150);
frame.setVisible(true);
}

public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
}


---------------------------------------

Thanks.









Related Tutorials/Questions & Answers:
call frame again - Java Beginners
call frame again  d, thank's for your answer, but i can't combine... can run ,first i have one frameA in this frame have one jTextfield1,one jbutton1,second i have FrameB in this frame have one Jtextfield1 and jbutton1. I can
call frame - Java Beginners
call frame   dear java, I want to ask something about call frame to another frame and back to first frame. I have FrameA and FrameB. In frameA... String PAINT_ICON = "paint_icon"; //true if the next frame created should
Advertisements
how to call a frame having threading concept
how to call a frame having threading concept   i hav a frame having buttton on it .on click event of the button ,i want to call another frame which... of that frame ,frame is displaying but no other content. that frame contains
how to call a frame having threading concept
how to call a frame having threading concept   i hav a frame having buttton on it .on click event of the button ,i want to call another frame which... of that frame ,frame is displaying but no other content. that frame contains
Struts Login Validation. In This code setter of login page is called only one time again it doesnt call it. Why..?
Struts Login Validation. In This code setter of login page is called only one time again it doesnt call it. Why..?  **struts.xml** <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software
FRAME
FRAME  WHILE I'M RUNNINGFILE OF A GUI PROGRAMME(JDBC CONNECTION) INSTEAD OF OUTPUT FRAME ONLY TWO BLANK FRAMES ARE GETTING DISPLAYD... CAN ANYONE HELP ME TO SOLVE DS PROBLEM
FRAME
FRAME  WHILE I'M RUNNINGFILE OF A GUI PROGRAMME(JDBC CONNECTION) INSTEAD OF OUTPUT FRAME ONLY TWO BLANK FRAMES ARE GETTING DISPLAYD... CAN ANYONE HELP ME TO SOLVE DS PROBLEM
frame
frame  how to creat a frame in java   Hi Friend, Try the following code:ADS_TO_REPLACE_1 import java.awt.*; import javax.swing.*; import java.awt.event.*; class RetrieveDataFromTextFields{ public static void
frame update another frame.
frame update another frame.   How do I make a link or form in one frame update another frame
There and Back Again
There and Back Again       The weblog of Joshua Eichorn, AJAX, PHP and Open Source Read full DescriptionADS_TO_REPLACE_1
ModuleNotFoundError: No module named 'again'
ModuleNotFoundError: No module named 'again'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'again' How to remove the ModuleNotFoundError: No module named 'again'
ModuleNotFoundError: No module named 'again'
ModuleNotFoundError: No module named 'again'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'again' How to remove the ModuleNotFoundError: No module named 'again'
one frame update another frame
one frame update another frame  How do I make a link or form in one frame update another frame
Frame query
Frame query  Hi, I am working on Images in java. I have two JFrame displaying same image. We shall call it outerFrame and innerFrame.In innerFrame i am rotating the image.After all the rotations i need to display this image
panel and frame
panel and frame  What is the difference between panel and frame
Java Frame
Java Frame  What is the difference between a Window and a Frame
Hi..Again Doubt .. - Java Beginners
Hi..Again Doubt ..  Thank u for ur Very Good Response...Really great... call. It should add to the MS Acess table..Plz check this out.... hope u ill... bg; MainMenu menu; Vote(Frame frame,String str) { setLayout(null); con
billing frame
billing frame  how to generate billing frame using swing which contain sr. no, name of product, quantity, price & total
Image on frame
Image on frame   Hi, This is my code. In this I am unable to load... java.awt.event.*; public class AwtImg extends Frame { Image img; public...(); } AwtImg() { super("Image Frame"); MediaTracker mt=new
frame generation
frame generation  Hi I wnat to genarate one frame with two tabs working ,production..and I want two radiobuttons sector ,others in the frames..based on the tab selection I want to clikc the radio button..when i ckick the radio
again with xml - XML
again with xml  hi all i am a beginner in xml so pls give me the details regarding the methods used in it. wat will return the methods getElementsByTagName(), getChildNodes(), getParentNode(), nextSibling(),etc and when
again java - Java Beginners
again java  i will ask iam using servlets ,in one program my requirement is if there is a image(if u like) in anywhere and we browse that image and it is store in u r account like orkut. my doubt is if the image is stored
again java - Java Beginners
again java  Hi, i will ask iam using servlets ,in one program my requirement is if there is a image(if u like) in anywhere and we browse that image and it is store in u r account like orkut. my doubt is if the image
Frame
frame
java again - Date Calendar
java again  I can't combine your source code yesterday, can you help me again. My problem is how we get result jtextfield2 from if jtexfield1 we enter(jTextfield keypressed) then the result out to jTextfield2, This my jFrame
ModuleNotFoundError: No module named 'lambada-again'
ModuleNotFoundError: No module named 'lambada-again'  Hi, My... 'lambada-again' How to remove the ModuleNotFoundError: No module named 'lambada-again' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'lambada-again'
ModuleNotFoundError: No module named 'lambada-again'  Hi, My... 'lambada-again' How to remove the ModuleNotFoundError: No module named 'lambada-again' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'lambada-again'
ModuleNotFoundError: No module named 'lambada-again'  Hi, My... 'lambada-again' How to remove the ModuleNotFoundError: No module named 'lambada-again' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'n-again'
ModuleNotFoundError: No module named 'n-again'  Hi, My Python...-again' How to remove the ModuleNotFoundError: No module named 'n-again... to install padas library. You can install n-again python with following command
ModuleNotFoundError: No module named 'nested_again'
ModuleNotFoundError: No module named 'nested_again'  Hi, My Python... 'nested_again' How to remove the ModuleNotFoundError: No module named 'nested_again' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'showit-again'
ModuleNotFoundError: No module named 'showit-again'  Hi, My Python... 'showit-again' How to remove the ModuleNotFoundError: No module named 'showit-again' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'testpay-again'
ModuleNotFoundError: No module named 'testpay-again'  Hi, My... 'testpay-again' How to remove the ModuleNotFoundError: No module named 'testpay-again' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'testpay-again'
ModuleNotFoundError: No module named 'testpay-again'  Hi, My... 'testpay-again' How to remove the ModuleNotFoundError: No module named 'testpay-again' error? Thanks   Hi, In your python
Hi .Again me.. - Java Beginners
Hi .Again me..  Hi Friend...... can u pls send me some code... args[]){ JFrame frame = new JFrame("Button Group... the window. JFrame frame = new JFrame("RadioButtonDemo
how to create frame in swings
how to create frame in swings  how to create frame in swings
collection frame work
collection frame work  explain all the concept in collection frame work
link to other frame - Applet
link to other frame  how a button to open to another frame? and the frame can keyin the data and it can show at the previous frame
Read data again - Java Beginners
Read data again  Hey, i want to ask again about how to read data from txt, My DB: kd_div varchar(15), nm_div varchar(30), dep varchar(25... data from txt file and send to DB.i'm using one button to call.  Hi
collection frame work
collection frame work  explain the hierarchy of one dimensional collection frame work classes
collection frame work
collection frame work  could you please tell me detail the concept of collection frame work
call a constructor
call a constructor  How do you call a constructor for a parent class
call ireports
call ireports  how to call jrxml file in jsp or servlets pls give one example any one? please send one example any one
Iphone call
Iphone call  Do you have other method to make a call on Iphone,without openUrl
making call
making call  Hi, Is it possible to make a call from application... this the code for call to a number NSString *phoneStr = [[NSString alloc... for call to a number ADS_TO_REPLACE_2 NSString *phoneStr = [[NSString alloc
conference call
conference call  hi am a java beginner I want to develop a simple conference call system over a LAN can u please enlighten me on the basics that I have to do and kno first
conference call
conference call  hi am a java beginner I want to develop a simple conference call system over a LAN can u please enlighten me on the basics that I have to do and kno first
conference call
conference call  hi am a java beginner I want to develop a simple conference call system over a LAN can u please enlighten me on the basics that I have to do and kno first
conference call
conference call  hi am a java beginner I want to develop a simple conference call system over a LAN can u please enlighten me on the basics that I have to do and kno first
conference call
conference call  hi am a java beginner I want to develop a simple conference call system over a LAN can u please enlighten me on the basics that I have to do and kno first

Ads