Solved

opening a pop-up JTextArea

Posted on 2004-04-28
2
432 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Every business owner understands the significance of online customer reviews and the impact it can have on sales and revenues. With technology advancing at such a rapid pace, getting online reviews has never been easier, especially when many regions…
Marketing can be an uncomfortable undertaking, especially if your material is technology based. Luckily, we’ve compiled some simple and (relatively) painless tips to put an end to your trepidation and start your path to success.
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:
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…
Suggested Courses

734 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