Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8130599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T08:46:22+00:00 2026-06-06T08:46:22+00:00

I am trying to create a pdf viewer but I can’t separate view from

  • 0

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:

enter image description here

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);
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T08:46:23+00:00Added an answer on June 6, 2026 at 8:46 am

    Well, this is how I solved the problem.

    //frame.getContentPane().add(new LeftPanel(), BorderLayout.CENTER);
    JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new LeftPanel(), new ViewPanel());
    frame.getContentPane().add(pane);
    frame.setVisible(true);
    frame.setSize(1000, 700);
    //frame.pack();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    

    And this worked out well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create Pdf from java using iText. How Can I Add two
I am trying to create a PDF file of current view. Can anyone please
I'm trying to create a thumbnail from a pdf in coldfusion, but no thumbnail
I am trying to create Landscape PDF using iTextSharp but It is still showing
Trying to create Database as follows: USE Master GO IF NOT EXISTS(SELECT [Name] FROM
I am trying to create a basic PDF viewer for iOS, and I am
I'm trying to create a PDF file with a table of data.. But when
Hi Everyone I am trying to create PNG(thumbnail) images from the pdf for my
I am getting the response from a URL and trying to create pdf from
I'm trying to create a small web service to convert PDF files to a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.