class ListToolsFrame extends JInternalFrame
		JLabel titleLabel;
		JButton exitButton;
		JTextArea outputArea;
		RandomAccessFile rafFile;
		ListToolsFrame(RandomAccessFile raf)
			StringBuffer buf2;
			rafFile = raf;
			try {;
			} catch (IOException e1) {
			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");
			final JScrollBar scroller = new JScrollBar();
			setLayout(new BorderLayout());
			jp.add(titleLabel, BorderLayout.NORTH);
			jp.add(exitButton, BorderLayout.SOUTH);
			jp.add(scroller, BorderLayout.CENTER);
			exitButton.addActionListener(new ActionListener()
				public void actionPerformed(ActionEvent e)
			//this.setSize(400, 300);

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

-- Curtis

Recommended Answers

All 5 Replies

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).

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.


-- 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.