Solved

Display README file

Posted on 2001-06-15
1
166 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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
The viewer will learn how to implement Singleton Design Pattern in Java.

832 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