Solved

Display README file

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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
fibonacci ten numbers 4 54
hibernate example using maven 12 82
Problem to Alipay 10 72
Hibernate Inheritance Strategy for Abstract Base class and two concrete classes 3 20
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

730 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