Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

opening a pop-up JTextArea

Posted on 2004-04-28
2
Medium Priority
?
465 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 1000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

In this post we will learn different types of Android Layout and some basics of an Android App.
A great marketing strategy is diverse.  Read about the not so popular, yet effective, marketing tactics you can start using today!
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.
Suggested Courses

971 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