box layout java

JScrollPane listScroller = new JScrollPane(list);
listScroller.setPreferredSize(new Dimension(250, 80));
listScroller.setAlignmentX(LEFT_ALIGNMENT);
...
//Lay out the label and scroll pane from top to bottom.
JPanel listPane = new JPanel();
listPane.setLayout(new BoxLayout(listPane, BoxLayout.PAGE_AXIS));
JLabel label = new JLabel(labelText);
...
listPane.add(label);
listPane.add(Box.createRigidArea(new Dimension(0,5)));
listPane.add(listScroller);
listPane.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));

//Lay out the buttons from left to right.
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
buttonPane.add(Box.createHorizontalGlue());
buttonPane.add(cancelButton);
buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
buttonPane.add(setButton);

//Put everything together, using the content pane's BorderLayout.
Container contentPane = getContentPane();
contentPane.add(listPane, BorderLayout.CENTER);
contentPane.add(buttonPane, BorderLayout.PAGE_END);

0
0
Awgiedawgie 440220 points

                                    JScrollPane listScroller = new JScrollPane(list);
listScroller.setPreferredSize(new Dimension(250, 80));
listScroller.setAlignmentX(LEFT_ALIGNMENT);
...
//Lay out the label and scroll pane from top to bottom.
JPanel listPane = new JPanel();
listPane.setLayout(new BoxLayout(listPane, BoxLayout.PAGE_AXIS));
JLabel label = new JLabel(labelText);
...
listPane.add(label);
listPane.add(Box.createRigidArea(new Dimension(0,5)));
listPane.add(listScroller);
listPane.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));

//Lay out the buttons from left to right.
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
buttonPane.add(Box.createHorizontalGlue());
buttonPane.add(cancelButton);
buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
buttonPane.add(setButton);

//Put everything together, using the content pane's BorderLayout.
Container contentPane = getContentPane();
contentPane.add(listPane, BorderLayout.CENTER);
contentPane.add(buttonPane, BorderLayout.PAGE_END);

0
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
boxlayoutr java what is boxlayout in java create a boxlayout in java what is the layout of a box in java box layout java swing java boxlayout page box layout in java swing boxlayout java swing swing box layout example boxlayout constructor in java boxlayout.js box layout swing java swing boxlayout example use box layout java what is setLayout(false); swing boxlayout boxlayout swing boxlayout java example how to get items in a boxlayout centrated in java setLayout method java java boxlayout example setLayout java Java swing how to make a box java verticalbox JVertical box java jpanel boxlayout create table In an AWT or Swing container, Box Layout places the components in which form? JPanel with BoxLayout java seing hbox ow to add an empty box in jframe for design boxlayout in interal frame box layouts jswing set component orientation boxlayout java set component orientation box layout java new box layout can we add a boxlayout inside box country_state_city_picker with box layout what is boxlayout java swing add to boxlayout setting up a empty class as a container java box layout manager in java definition layout yaxis java swinf import javax.swing.BoxLayout; boxlayout tutorial how to use boxlayout how to use box layout How to get box layout to display items in the center java netbeans boxlayout in java how to use box layout in java netbeans horizontal gule in java java center layout in boxlayout top flowlayout and bo java swing box layout java jpanel boxlayout Box layout vertically in java use box layout withouut taking all of the panels java boxlayour java box layout javaSwing swing horizontal componets layout box layout 3 java create boxlayout java swing box alignment JPanel boxlayout java buttons in a top dopwn row java box layout example how to make frame boxlayout java boxlayout java gui boxlayout x alignment java gui boxlayout box layout in java how to use boxlayout in java netbeans box align in java swing how to create box using swing in java box layout java small boxes in java swing box layout how to put buttons in bottom of gui using flowlayout java how to put jbuttons on bottom of gui using flowlayout in java java box layout java swing boxlayout box layout in java gui boxlayout swing java java boxlayout BoxLayout java
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source