Solved

Display README file

Posted on 2001-06-15
1
168 Views
Last Modified: 2010-03-31
Can any one give me a short sample app. where you pop-up larger (scrollable) document in a separate text window.
0
Comment
Question by:aljehin
1 Comment
 
LVL 3

Accepted Solution

by:
superschlonz earned 20 total points
ID: 6197194
The following application shows the first argument as title of the window and
the second as the text.

public TextFrame extends JFrame
{
  JTextField textfield = new JTextField();
  public TextFrame()
  {
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    getContentPane().setLayout( new BorderLayout() );
    JScrollPane sp = new JScrollPane();
    sp.getViewport().add( textfield, null );
    getContentPane().add( sp, BorderLayout.CENTER );
  }
  public void show( String title, String text )
  {
    setTitle( title );
    textfield.setText( text );
    setVisible( true );
  }
  protected void processWindowEvent(WindowEvent e)
  {
    if(e.getID() == WindowEvent.WINDOW_CLOSING)
    {
      super.processWindowEvent(e);
      System.exit(0);
    }
  }
  public static void main( String args[] )
  {
    TextFrame tf = new TextFrame();
    tf.show( args[0], args[1] );
  }
}
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Suggested Solutions

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
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:

808 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