Solved

opening a pop-up JTextArea

Posted on 2004-04-28
2
412 Views
Last Modified: 2013-11-28
I have a java application with a button that connects to a database and retrieves some information.
When I click the button I want another window(a JTextArea with scrollPane) to pop-open seperately and display the information.

Does anyone have an idea how to do this?
I cant seem to find anything suitable on the web.

thanks.
0
Comment
Question by:credit
2 Comments
 
LVL 7

Accepted Solution

by:
maheshexp earned 250 total points
ID: 10940494
just place the new window invoking code in a action listener of the button u need to click
class OtherWindow extends JFrame{
           public OtherWindow(){
               /* codes */
              this.setSize(300,400);
              this.show();
           }
}

class CurrentWindowextends JFrame{

    public CurrentWindow(){
         JButton bt1 = new JButton("open");
          bt1.addActionListener( new ActionListener(){
                    public void actionPerformed(ActionEvent e){
                          /* code for the new Window to open */
                             new OtherWindow();
                   }
         });
   
          this.getContentPane().add(bt1);
        this.setSize(100,200);
           this.show();
    }

     public static void main(String[] args){
           new CurrentWindow();
     }
}
0
 

Author Comment

by:credit
ID: 10941154
That worked grand!

thanks maheshexp.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Read about the 3 stages of the buyer's journey: awareness, consideration, and decision.
Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This video teaches viewers about errors in exception handling.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now