FileDocCategorySizeDatePackage
ReporterFrame.javaAPI DocGlassfish v2 API6270Fri May 04 22:32:14 BST 2007com.sun.enterprise.util.diagnostics

ReporterFrame

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

Fields Summary
static Logger
_logger
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();

//Bug 4677074		System.out.println("*** vertSB.getMaximum(): " + vert.getMaximum());
//Bug 4677074		System.out.println("*** vertSB.getValue(): " + vert.getValue());
//Bug 4677074		System.out.println("*** getRows(): " + textArea.getRows());
		//System.out.println("*** getRowHeight(): " + textArea.getRowHeight());
//Bug 4677074		System.out.println("*** getLineCount(): " + textArea.getLineCount());
//Bug 4677074 begin
		_logger.log(Level.FINE,"*** vertSB.getMaximum(): " + vert.getMaximum());
		_logger.log(Level.FINE,"*** vertSB.getValue(): " + vert.getValue());
		_logger.log(Level.FINE,"*** getRows(): " + textArea.getRows());
		// _logger.log(Level.FINE,"*** getRowHeight(): " + textArea.getRowHeight());
		_logger.log(Level.FINE,"*** getLineCount(): " + textArea.getLineCount());
//Bug 4677074 end

		final int numLines = textArea.getLineCount();
		int endOffset;
		try
		{
			endOffset= textArea.getLineEndOffset(numLines - 1);
//Bug 4677074			System.out.println("***** numLines:  " + numLines + "  endOffset: " + endOffset);
//Bug 4677074 begin
			_logger.log(Level.FINE,"***** numLines:  " + numLines + "  endOffset: " + endOffset);
//Bug 4677074 end
		}
		catch(BadLocationException e)
		{
//Bug 4677074			System.out.println("***** Exception: " + e);
//Bug 4677074 begin
			_logger.log(Level.WARNING,"iplanet_util.badlocation_exception",e);
//Bug 4677074 end
		}
		*/
	
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)

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

//Bug 4677074		System.err.println("setStandAlone() here!!!");//NOI18N
//Bug 4677074 begin
		_logger.log(Level.FINE,"setStandAlone() here!!!");
//Bug 4677074 end
		standAlone = true;