textPane = new JTextPane();
		textPane.setBounds(337, 33, 290, 198);
		textPane.setBackground(Color.LIGHT_GRAY);
		textPane.setEditable(false);
		textPane.setLayout(new GridLayout());
		JScrollPane scrollPane = new JScrollPane(textPane);
		scrollPane.setBounds(337, 33, 290, 198);
		add(scrollPane);
		
searchButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				List<MainManagement> sList = new ArrayList<MainManagement>();
				MainMngDao mmd = new MainMngDao();
				sList = mmd.search();
				for(int i = 0; i < sList.size(); i++) {
					textPane.setText(sList.get(i).toString());
				}
			}
		});

this is just part of the codes
i used textpane and it can show everything in the list.why?
please give me a pointer
no matter what way i do it , iterator or for() loop, i can acheive it...

Simple

for(int i = 0; i < sList.size(); i++) {
    textPane.setText(sList.get(i).toString());
}

Any previously added text is overwritten by new setText() in your loop.
Simplest workaround put whole list in StringBuilder and get one string that is added to JTextPane.
Advanced, create StyledDocument


PS: This is not 24/7 answer service just for you. We answer when we can and when we have time, not when you demand.

hmmm

textPane.setText(textPane.getText() + "\LineSepartor" + sList.get(i).toString());

hmmm

textPane.setText(textPane.getText() + "\LineSepartor" + sList.get(i).toString());

That is functional, but it is much of get & set for graphical component. I would prefer to provide text pane in this case with single set

bump,

now is corresponding with topic

scrollPane.setVerticalScrollBarPolicy(               JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
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.