I am having this problem with the JScrollPane where the scroll bar positions itself in the center, and not at the top and I can't figure out why.
Here is a code snippet:
JPanel userProfilePanel= new JPanel();
userProfilePanel.setSize(new Dimension(600,800));
userProfilePanel.setPreferredSize(new Dimension(600,800));
JScrollPane userProfileScrollPane=new JScrollPane(userProfilePanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
userProfileScrollPane.setSize(new Dimension(600,600));
JTabbedPane tabbedPane=new JTabbedPane();
tabbedPane.setSize(new Dimension(600,600));
tabbedPane.addTab("Profile", null, userProfileScrollPane,"Does nothing");
JDialog screen=new JDialog();
screen.getContentPane().add(tabbedPane);
userProfileScrollPane.getHorizontalScrollBar().setValue(0);
userProfileScrollPane.getVerticalScrollBar().setValue(0);
screen.repaint();
screen.setVisible(true);
Does anyone have an idea what it is doing this?