FileDocCategorySizeDatePackage
ReporterFrame.javaAPI DocGlassfish v2 API5213Fri May 04 22:35:54 BST 2007com.sun.enterprise.tools.common.util.diagnostics

ReporterFrame

public class ReporterFrame extends JFrame implements ActionListener
version
1.01 June 6, 2000
author
Byron Nevins

Fields Summary
private JButton
wrapButton
private JButton
noWrapButton
private JTextArea
textArea
private JScrollPane
scrollPane
private static final String
titleRoot
private static boolean
standAlone
Constructors Summary
ReporterFrame(String title)

  
		addButtonPanel();
		addTextPanel();

		setTitle(titleRoot + " -- " + title);//NOI18N
		setSize(900, 300);
		if(standAlone)
		{
			addWindowListener(new WindowAdapter()
			{  
				public void windowClosing(WindowEvent e)
				{  
					System.exit(0);
				}
			} );
			
			for(int i = 0; i < 1000; i++)
				textArea.append("This is line# " + i + "\n");//NOI18N
			
			show();
		}
	
Methods Summary
public voidactionPerformed(java.awt.event.ActionEvent evt)

  
		Object source = evt.getSource();
	
		if(source == wrapButton)
		{  
			textArea.setLineWrap(true);
			scrollPane.validate();
		}
		else if(source == noWrapButton)
		{  
			textArea.setLineWrap(false);
			scrollPane.validate();
		}

		
		
		/* trying to make it auto-scroll!!!
		//JViewport vp = textArea.getViewport();
		JScrollBar vert = scrollPane.getVerticalScrollBar();

		System.out.println("*** vertSB.getMaximum(): " + vert.getMaximum());
		System.out.println("*** vertSB.getValue(): " + vert.getValue());
		System.out.println("*** getRows(): " + textArea.getRows());
		//System.out.println("*** getRowHeight(): " + textArea.getRowHeight());
		System.out.println("*** getLineCount(): " + textArea.getLineCount());

		final int numLines = textArea.getLineCount();
		int endOffset;
		try
		{
			endOffset= textArea.getLineEndOffset(numLines - 1);
			System.out.println("***** numLines:  " + numLines + "  endOffset: " + endOffset);
		}
		catch(BadLocationException e)
		{
			System.out.println("***** Exception: " + e);
		}
		*/
	
private voidaddButtonPanel()

		JPanel panel = new JPanel();
		wrapButton = new JButton("Wrap");//NOI18N
		panel.add(wrapButton);
		wrapButton.addActionListener(this);

		noWrapButton = new JButton("No wrap");//NOI18N
		panel.add(noWrapButton);
		noWrapButton.addActionListener(this);

		getContentPane().add(panel, "South");//NOI18N
	
private voidaddTextPanel()

		//textArea	= new JTextPane();
		textArea	= new JTextArea(800, 200);
		scrollPane	= new JScrollPane(textArea);
		getContentPane().add(scrollPane, "Center");//NOI18N
	
public voidpr(java.lang.String s)

		//textArea.setText(textArea.getText() + s + "\n");//NOI18N
		textArea.append(s + "\n");//NOI18N
	
static voidsetStandAlone()

		System.err.println("setStandAlone() here!!!");//NOI18N
		standAlone = true;