class ListToolsFrame extends JInternalFrame
	{
		JLabel titleLabel;
		JButton exitButton;
		JTextArea outputArea;
		RandomAccessFile rafFile;
		
		ListToolsFrame(RandomAccessFile raf)
		{
			StringBuffer buf2;
			rafFile = raf;
			try {
				rafFile.seek(0);
			} catch (IOException e1) {
				
				System.err.println("rafFile.seek(0)");
			}
			JPanel jp = new JPanel(new BorderLayout());
			buf2 = listTools();
			titleLabel = new JLabel("List Of Tools");
			exitButton = new JButton("Exit");
			outputArea = new JTextArea(20, 10);
			outputArea.append("Record Number/t/tTool Name/t/tQuantity/t/tPrice");
			outputArea.setText(buf2.toString());
			final JScrollBar scroller = new JScrollBar();
			scroller.add(outputArea);
			setLayout(new BorderLayout());
			jp.add(titleLabel, BorderLayout.NORTH);
			jp.add(exitButton, BorderLayout.SOUTH);
			jp.add(scroller, BorderLayout.CENTER);
			jp.validate();
			//validate();
			
			exitButton.addActionListener(new ActionListener()
			{
				public void actionPerformed(ActionEvent e)
				{
					outputArea.setText("");
					setVisible(false);
					mainView.setVisible(true);
				}
			});
			
			this.getContentPane().add(jp);
			//this.setSize(400, 300);
			this.getContentPane().setVisible(true);
		}
	}

Why isn't my JTextArea showing up on the JPanel inside my JInternalFrame? Any suggestions? Thanks.

-- Curtis

I think you want

final JScrollPane scroller = new JScrollPane();

and not

final JScrollBar scroller = new JScrollBar();

I can't see the bit where you add the TextArea to your JPanel or any part thereof (?)

I can't see the bit where you add the TextArea to your JPanel or any part thereof (?)

Because he's adding it to the ScrollBar (which is why it should probably be a ScrollPane).

Yes, right.

But even after making the suggested change with respect to JScrollPane vs. JScrollbar (and despite the fact that I think you are right) the area shows up but there is no text being displayed. When I change the outputArea to being directly added to the JPanel the text displays , but when I add the outputArea to the JScrollPane nothing happens.

Suggestions?

-- Curtis

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.