Q:

how to make a right side JPanel display always

I have two Jpanels in a line, first JPanel used for showing a number of buttons and second showing left and right buttons.
I want to show the left,right buttons always(when change the screen size)
    public class TestJPanel {
public static void main(String... args) {
    JFrame frame = new JFrame();
    JPanel panel = new JPanel();
    for (int i = 0; i < 10; i++) {
        panel.add(new JButton("Hello-" + i));
    }
    JPanel leftrightPanel=new JPanel();
    leftrightPanel.add(new Button("LEFT"));
    leftrightPanel.add(new Button("RIGHT"));
    JPanel contentPane = new JPanel();
    contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.LINE_AXIS));
    contentPane.add("West",panel);
    contentPane.add("East",leftrightPanel);
    frame.setContentPane(contentPane);
    frame.pack();
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.setSize(400,280);
    frame.setVisible(true);
}}

A:

Maybe you want something like:
JPanel contentPane = new JPanel();
contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.LINE_AXIS));
contentPane.add(panel);
contentPane.add(Box.createHorizontalGlue());
contentPane.add(leftrightPanel);

This will separate the two panels to the left and right side of the screen with space in the middle. The space in the middle will change as the frame is resized.
contentPane.add("West",panel);

Never use hard coded magic strings like that. The API will provide a field for you to use. When you are using a BorderLayout properly, you would use:
contentPane.add(panel, BorderLayout.LINE_START);

Read the Swing tutorial on How to Use BorderLayout for more information and working example on using the constraints and the proper add(...) method.

