I am trying to create a pdf viewer but I can’t separate view from tabbed pane. I tried everything but not success,
- I tried adding JSplit pane, not it didn’t work. (I don’t need to add it now, just need to expand the right side panel.
- And I tried adjusting size of panels using
setSize(x, y). But it didn’t work either.
Here is a screen shot:

Here some code:
class Main
{
public static void main(String args[]){
JFrame frame = new JFrame("Pdf Reader");
frame.setJMenuBar(new MenuBar());
frame.getContentPane().add(new ToolBar(), BorderLayout.NORTH);
frame.getContentPane().add(new LeftPanel(), BorderLayout.CENTER);
frame.getContentPane().add(new ViewPanel(), BorderLayout.EAST);
frame.setVisible(true);
frame.setSize(1000, 700);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
class LeftPanel extends JPanel
{
private JTabbedPane tabs;
private JPanel panel1;
private JPanel panel2;
private JPanel panel3;
private JPanel panel4;
public LeftPanel(){
addTabs();
}
public void addTabs()
{
tabs = new JTabbedPane();
panel1 = new JPanel();
tabs.addTab("Thumbnails", panel1);
panel2 = new JPanel();
tabs.addTab("Annotations", panel2);
panel3 = new JPanel();
tabs.addTab("Bookmarks", panel3);
panel4 = new JPanel();
tabs.addTab("Search", panel4);
setLayout(new GridLayout(1, 1));
add(tabs, BorderLayout.CENTER);
}
}
class ViewPanel extends JPanel
{
private JLabel viewLabel;
public ViewPanel(){
viewLabel = new JLabel("Just a view...............................");
add(viewLabel);
}
}
Well, this is how I solved the problem.
And this worked out well.