Solved

Display README file

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This video teaches viewers about errors in exception handling.

707 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