Hi! Is there a posibility to use the FlowLayout and JScrollPane in one JFrame/JApplet? My Problem is that I hava a text splitted in many JLabels and want to show this text in an Applet with the help of the FlowLayout. But I need a vertical srollbar, if the text is too long. But when I add the JPanel with the FlowLayout to the Applet, the hole text is shown in one line without a line break. Here a part of the code: ... JPanel MyJPanel=new JPanel(new FlowLayout(FlowLayout.LEFT,4,4)); ... Iterator it=labelList.iterator(); while (it.hasNext()) MyJPanel.add((Component)it.next()); ... JScrollPane scrollpaneExercise = new JScrollPane(MyJPanel); getContentPane().add(BorderLayout.CENTER, scrollpaneExercise); ... Nick
It sounds like you are expecting FlowLayout to insert line breaks into your series of JLabels if they flow over the JApplet/JFrame side. An't gonna happen. FlowLayout goes from left to right (or from right to left in appropriate locales) in a single row.