Opening a new class (JFrame) from JButton Issue - java

just a disclaimer: I already checked most of Stack Overflow and couldn't find an answer on the website. I also asked some nice people on Reddit, but only fixed it halfway through.
So, I am trying the create a GUI application and I am new to the Java language (very, very new - so there is a big chance I am making a rookie mistake). I already designed my interface for my 'StartScreen' and I wanted to make button1 to open my second class ('NewUsers').
I was using the GUI Editor and I think this is probably the cause of my problems, as an answer to my question online I just saw people add
this.dispose();
new JFrame().setVisible(true);
This doesn't work on me however. I managed to fix it until a certain point and now I am able to close the frame on a click, but I still can't figure out how to open another frame from the button :(. Here is my code for Frame1('StartScreen'). Frame2 is just an empty window for now, but it's for testing purposes.
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
public class StartScreen {
private final JFrame frame;
private JButton newUserButton;
private JButton existingUserButton;
private JButton nonUserBookingButton;
private JPanel panell;
public StartScreen() {
this.frame = new JFrame("StartScreen");
frame.setContentPane(panell);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
newUserButton.addActionListener(this::onNewUserClicked);
}
public static void newuserscall
() {
NewUsers newuserscall = new NewUsers();
}
private void onNewUserClicked(ActionEvent event) {
frame.setVisible(false);
}
public static void main(String[] args) {
new StartScreen();
}
{
// GUI initializer generated by IntelliJ IDEA GUI Designer
// >>> IMPORTANT!! <<<
// DO NOT EDIT OR ADD ANY CODE HERE!
$$$setupUI$$$();
}
/**
* Method generated by IntelliJ IDEA GUI Designer
* >>> IMPORTANT!! <<<
* DO NOT edit this method OR call it in your code!
*
* #noinspection ALL
*/
private void $$$setupUI$$$() {
panell = new JPanel();
panell.setLayout(new GridBagLayout());
panell.setPreferredSize(new Dimension(600, 400));
final JPanel spacer1 = new JPanel();
GridBagConstraints gbc;
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 4;
gbc.fill = GridBagConstraints.VERTICAL;
gbc.insets = new Insets(30, 0, 0, 0);
panell.add(spacer1, gbc);
newUserButton = new JButton();
newUserButton.setText("Button");
gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 2;
gbc.gridwidth = 2;
gbc.fill = GridBagConstraints.BOTH;
panell.add(newUserButton, gbc);
existingUserButton = new JButton();
existingUserButton.setText("Button");
gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 4;
gbc.gridwidth = 2;
gbc.fill = GridBagConstraints.BOTH;
panell.add(existingUserButton, gbc);
nonUserBookingButton = new JButton();
nonUserBookingButton.setText("Button");
gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 6;
gbc.gridwidth = 2;
gbc.fill = GridBagConstraints.BOTH;
panell.add(nonUserBookingButton, gbc);
final JPanel spacer2 = new JPanel();
gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 3;
gbc.gridwidth = 2;
gbc.fill = GridBagConstraints.VERTICAL;
panell.add(spacer2, gbc);
final JPanel spacer3 = new JPanel();
gbc = new GridBagConstraints();
gbc.gridx = 2;
gbc.gridy = 5;
gbc.fill = GridBagConstraints.VERTICAL;
gbc.insets = new Insets(0, 250, 0, 0);
panell.add(spacer3, gbc);
final JPanel spacer4 = new JPanel();
gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 5;
gbc.fill = GridBagConstraints.VERTICAL;
panell.add(spacer4, gbc);
final JPanel spacer5 = new JPanel();
gbc = new GridBagConstraints();
gbc.gridx = 2;
gbc.gridy = 1;
gbc.fill = GridBagConstraints.VERTICAL;
gbc.insets = new Insets(25, 0, 0, 0);
panell.add(spacer5, gbc);
final JLabel label1 = new JLabel();
label1.setText("Label");
gbc = new GridBagConstraints();
gbc.gridx = 2;
gbc.gridy = 0;
panell.add(label1, gbc);
final JPanel spacer6 = new JPanel();
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 6;
gbc.fill = GridBagConstraints.VERTICAL;
gbc.insets = new Insets(30, 0, 0, 0);
panell.add(spacer6, gbc);
final JPanel spacer7 = new JPanel();
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 2;
gbc.fill = GridBagConstraints.VERTICAL;
gbc.insets = new Insets(30, 0, 0, 0);
panell.add(spacer7, gbc);
}
/**
* #noinspection ALL
*/
public JComponent $$$getRootComponent$$$() {
return panell;
}
}
Thanks in advance! I hope some of you can figure out a way I can fix my code :(
Regards

Well what I'll start out saying is that you are correct: never use a GUI Builder. I don't even mean when you're trying to learn, I mean never use it. It's mainly there for prototyping a concept and not meant for you to use it for learning or production code. Below is a cleaned up more precise example for you, but in your particular example, you need to add your
new JFrame().setVisible(true);
inside of your onNewUserClicked function. Also, note that when you do that, you're creating an empty frame, that will be the absolute minimum amount of size that it takes for your OS to create it because there's nothing in it, you never packed the frame, and never manually and explicitly set the size, so check around your top left area of your monitor - it's there.
Here is probably closer to what you want in terms of cleanliness.
public class Foo {
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
#Override
public void run() {
final JFrame jf = new JFrame();
JPanel jp = new JPanel();
JButton jb = new JButton("New Frame");
jb.addActionListener(new ActionListener() {
#Override
public void actionPerformed(ActionEvent e) {
jf.setVisible(false);
new JFrame().setVisible(true);
}
});
jp.setLayout(new FlowLayout());
jp.add(jb);
jf.setContentPane(jp);
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jf.setVisible(true);
jf.pack();
}
}
}
}
The reason why I say cleaner at all, is because of the control of a LayoutManager. GUI builders like the one you use always tend to use GridBagLayout because it's easier for it to dynamically (from your user input) place things precisely. But the code it generates is unmanageable. And things get worse when you consider that if you expand or contract your GUI, that the GridBagLayout is not flexible with this so now your Components are stuck exactly where you placed them when dragging them from the GUI Builder. Proper use of the correct LayoutManager will give you a flexible and manageable GUI. Check out this Oracle guide for more info and help: https://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html

That is because you are disposing the parent frame before showing the new one.
In this scenario your parent frame, from which you are calling
new JavaFrame2().SetVisibility(true);
contains the handle to the new JavaFrame. By disposing the parent frame you technically delete the parent -> you cant do something with it any more.
Try hiding the startscreen by calling .SetVisibility(false) instead of this.dispose();.

Related

Swing GridBagLayout: centering a button on the second row

I have this code that displays a label, a textfield and a button:
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Form extends JFrame implements ActionListener {
private JLabel label = new JLabel("What's your name:");
private JTextField field = new JTextField(15);
private JButton button = new JButton("Send");
public Form() {
setTitle("Name Form");
setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.insets = new Insets(10, 10, 10, 1);
gbc.anchor = GridBagConstraints.LINE_END;
gbc.gridx = 0;
gbc.gridy = 0;
add(label, gbc);
gbc = new GridBagConstraints();
gbc.insets = new Insets(10, 10, 10, 10);
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.gridx = 1;
gbc.gridy = 0;
add(field, gbc);
gbc = new GridBagConstraints();
gbc.insets = new Insets(10, 10, 10, 10);
gbc.anchor = GridBagConstraints.LINE_END;
gbc.gridx = 0;
gbc.gridy = 1;
add(button, gbc);
}
#Override
public void actionPerformed(ActionEvent event) {
}
public static void main(String[] args) {
Form myFrame = new Form();
myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
myFrame.pack();
myFrame.setVisible(true);
}
}
It shows this:
I need the button to be horizontally centered like this:
How do I do this with GridBagLayout? I tried different values for anchor but nothing worked.
EDIT:
Adding gbc.gridwidth = 2 showed this:
The button needs to stretch over the two columns, so set the gridwidth.
gbc.gridwidth = 2;
(Btw, you don't need to create a new GridBagConstraints for each component. Just reuse the say one and only change the properties that are different.)

How to add and remove components from particular coordinates in GridBagLayout?

I am new to swing, am trying to make a form in which you can navigate to different panels by the click of buttons on the left-hand side, to fill out forms(panels) appearing on the right-hand side, and I am using the GridBagLayout for the purpose. I am trying to remove the current panel on the click of the JButton and then add the corresponding panels I created by extending JPanel to classes. For ex., if I click on the accountDetailsButton, I wish to open up the accountDetails Panel, somewhat like switching tabs. I want to replace whichever panel is open on that position with the accountDetails Panel, and since any tab may be open, I need to exchange the panel on the basis of coordinates instead of the component name. I don't know how to go about it as I want to remove and add components on the basis of coordinates on the frame, and the name of the components may not be known. Here's the code.
Thanks a lot in advance!
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class FormWindow {
private CustomerProfile customerProfile;
private AccountDetails accountDetails;
private LoanDetails loanDetails;
private DocumentUpload documentUpload;
private JPanel mainPanel;
private JLabel logo;
private JButton customerProfileButton;
private JButton accountDetailsButton;
private JButton loanDetailsButton;
private JButton documentUploadButton;
private JPanel bufferPanel;
public static void main(String[] args) {
JFrame frame = new JFrame("FormWindow");
frame.setContentPane(new FormWindow().mainPanel);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
FormWindow() {
mainPanel = new JPanel();
bufferPanel = new JPanel();
mainPanel.setLayout(new GridBagLayout());
customerProfile = new CustomerProfile();
accountDetails = new AccountDetails();
loanDetails = new LoanDetails();
documentUpload = new DocumentUpload();
// fieldForm.setLayout(new GridBagLayout());
GridBagConstraints gbc;
gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 0;
gbc.gridheight = 5;
gbc.fill = GridBagConstraints.BOTH;
bufferPanel.add(customerProfile);
mainPanel.add(bufferPanel, gbc);
final GridBagConstraints gbcForms = gbc;
logo = new JLabel();
logo.setText("LOGO");
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.insets = new Insets(5, 5, 10, 5);
mainPanel.add(logo, gbc);
customerProfileButton = new JButton();
customerProfileButton.setText("Customer Profile");
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(5, 5, 5, 5);
mainPanel.add(customerProfileButton, gbc);
accountDetailsButton = new JButton();
accountDetailsButton.setText("Account Details");
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 2;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(5, 5, 5, 5);
mainPanel.add(accountDetailsButton, gbc);
loanDetailsButton = new JButton();
loanDetailsButton.setText("Loan Details");
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 3;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(5, 5, 5, 5);
mainPanel.add(loanDetailsButton, gbc);
documentUploadButton = new JButton();
documentUploadButton.setText("Document Upload");
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 4;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(5, 5, 5, 5);
mainPanel.add(documentUploadButton, gbc);
//adding action listeners to buttons
customerProfileButton.addActionListener(new ActionListener() {
#Override
public void actionPerformed(ActionEvent ae) {
}
});
accountDetailsButton.addActionListener(new ActionListener() {
#Override
public void actionPerformed(ActionEvent ae) {
}
});
loanDetailsButton.addActionListener(new ActionListener() {
#Override
public void actionPerformed(ActionEvent ae) {
}
});
documentUploadButton.addActionListener(new ActionListener() {
#Override
public void actionPerformed(ActionEvent ae) {
}
});
}
}
I wish to display the corresponding panel on the right-hand side of the frame when the corresponding button is clicked. For ex., if I click the accountDetailsButton, I want to replace the previously visible panel with the accountDetails panel (the code for accountDetails has the accountDetails class extending JPanel). This is done to get the feel of switching between tabs in a way.

how to add a TiltledBorder in a GridBagLayout?

I am trying to make an UI with Swing using only one Container with the GridBagLayout !
My problem is that I want to regroup some JtextFields and Jlabels under one title (TitledBorder) in my interface, is there a way to add the border directly in my container, or should I create another JPanel to regroup my components and then add the hole Panel to my GridBagLayout ?
Based on the pic you provided, the typical solution would be to have 2 separate panels, each with their own TitledBorder, and then place both of these panels on a third outer panel.
However, you could create a similar effect on a single panel by replacing the TitledBorders with a combination of a JLabel followed by a JSeparator.
The difference is that the logical "group" of fields is now only defined by title that isn't surrounding the whole group. Some people prefer this, others do not.
Here's a sample of your pic to give you the idea:
import java.awt.*;
import javax.swing.*;
public class Test implements Runnable
{
private JTextField firstName;
private JTextField lastName;
private JTextField title;
private JTextField nickname;
private JComboBox format;
public static void main(String[] args)
{
SwingUtilities.invokeLater(new Test());
}
public Test()
{
firstName = new JTextField(20);
lastName = new JTextField(20);
title = new JTextField(20);
nickname = new JTextField(20);
format = new JComboBox();
}
public void run()
{
JFrame frame = new JFrame();
frame.getContentPane().add(createPanel());
frame.pack();
frame.setVisible(true);
}
private JPanel createPanel()
{
JPanel p = new JPanel(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.insets = new Insets(4,4,4,4);
gbc.ipadx = 1;
gbc.ipady = 1;
gbc.anchor = GridBagConstraints.WEST;
JLabel nameHeader = new JLabel("Name:");
nameHeader.setForeground(Color.RED.darker());
p.add(nameHeader, gbc);
gbc.gridx = 1;
gbc.gridwidth = 3;
gbc.fill = GridBagConstraints.HORIZONTAL;
p.add(new JSeparator(JSeparator.HORIZONTAL), gbc);
gbc.gridx = 0;
gbc.gridy = 1;
gbc.gridwidth = 1;
gbc.fill = GridBagConstraints.NONE;
p.add(new JLabel("First Name"), gbc);
gbc.gridx = 1;
p.add(firstName, gbc);
gbc.gridx = 2;
p.add(new JLabel("Last Name"), gbc);
gbc.gridx = 3;
p.add(lastName, gbc);
gbc.gridx = 0;
gbc.gridy = 2;
p.add(new JLabel("Title"), gbc);
gbc.gridx = 1;
p.add(title, gbc);
gbc.gridx = 2;
p.add(new JLabel("Nickname"), gbc);
gbc.gridx = 3;
p.add(nickname, gbc);
gbc.gridx = 0;
gbc.gridy = 3;
p.add(new JLabel("Format"), gbc);
gbc.gridx = 1;
gbc.gridwidth = 3;
gbc.fill = GridBagConstraints.HORIZONTAL;
p.add(format, gbc);
return p;
}
}
You could play with the constraints to polish this up a bit, but you get the idea.
An upside to this approach is that when adding more fields for the Email section, you can get them to line up with the fields in the Name section. With separate panels, this would be more difficult (you could use a bunch of Box.createHorizontalStrut(...) for this).
The downside to this approach is that you now have a large panel with many fields, and it could get a bit unwieldy to maintain if you need to add more fields.
Try This :
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
class SwingLayoutDemo {
private JFrame mainFrame;
private JLabel headerLabel;
private JLabel statusLabel;
private JPanel controlPanel;
private JLabel msglabel;
public SwingLayoutDemo(){
prepareGUI();
}
public static void main(String[] args){
SwingLayoutDemo swingLayoutDemo = new SwingLayoutDemo();
swingLayoutDemo.showGridBagLayoutDemo();
}
private void prepareGUI(){
mainFrame = new JFrame("Java SWING Examples");
mainFrame.setSize(400,400);
mainFrame.setLayout(new GridLayout(3, 1));
headerLabel = new JLabel("",JLabel.CENTER );
statusLabel = new JLabel("",JLabel.CENTER);
statusLabel.setSize(350,100);
mainFrame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent windowEvent){
System.exit(0);
}
});
controlPanel = new JPanel();
controlPanel.setBorder(new TitledBorder (
new LineBorder (Color.black, 5),
"Title String"));
controlPanel.add(new JLabel("TitledBorder using LineBorder"));
controlPanel.setLayout(new FlowLayout());
mainFrame.add(headerLabel);
mainFrame.add(controlPanel);
mainFrame.add(statusLabel);
mainFrame.setVisible(true);
}
private void showGridBagLayoutDemo(){
headerLabel.setText("Layout in action: GridBagLayout");
JPanel panel = new JPanel();
panel.setBackground(Color.darkGray);
panel.setSize(300,300);
GridBagLayout layout = new GridBagLayout();
panel.setLayout(layout);
GridBagConstraints gbc = new GridBagConstraints();
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.gridx = 0;
gbc.gridy = 0;
panel.add(new JButton("Button 1"),gbc);
gbc.gridx = 1;
gbc.gridy = 0;
panel.add(new JButton("Button 2"),gbc);
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.ipady = 20;
gbc.gridx = 0;
gbc.gridy = 1;
panel.add(new JButton("Button 3"),gbc);
gbc.gridx = 1;
gbc.gridy = 1;
panel.add(new JButton("Button 4"),gbc);
gbc.gridx = 0;
gbc.gridy = 2;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.gridwidth = 2;
panel.add(new JButton("Button 5"),gbc);
controlPanel.add(panel);
mainFrame.setVisible(true);
}
}

Java Swing's GridBagLayout will not position component at the top of the grid cell

I have tried to boil this down as far as I can in code. I have been using GridBagLayout for a long time and for some reason I have never run into this situation.
JDialog dialog = new JDialog();
dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
dialog.setResizeable(true);
JPanel guiHolder = new JPanel();
guiHolder.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.anchor = GridBagConstraints.PAGE_START;
gbc.weightx = 1.0;
gbc.weighty = 1.0;
guiHolder.add(new JLabel("my test"), gbc);
dialog.add(guiHolder);
dialog.setSize(new Dimension(320, 240);
dialog.setSize(true);
The JLabel ends up square in the center of the screen. How can I get it to go to the top? I have looked at How To Use GridBagLayout. I am stumped...
Had you fixed your compile errors and wrapped your code into a runnable demo, you'd see that GridBagLayout works as advertised:
import java.awt.*;
import javax.swing.*;
public class Test implements Runnable
{
public static void main(String[] args)
{
SwingUtilities.invokeLater(new Test());
}
public void run()
{
JDialog dialog = new JDialog();
dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
dialog.setResizable(true); // fixed mispelling here
JPanel guiHolder = new JPanel();
guiHolder.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.anchor = GridBagConstraints.PAGE_START;
gbc.weightx = 1.0;
gbc.weighty = 1.0;
guiHolder.add(new JLabel("my test"), gbc);
dialog.add(guiHolder);
dialog.setSize(new Dimension(320, 240));
dialog.setVisible(true); // fixed wrong method name here
}
}

Java Swing. TextField inside a ScrolPane is not entirely visible

I have the structure as you can see in the picture.
For both panels, GridBagLayout is used.
The problem is that the text field inside the scrollpane is not entirely visible.
The parent panel stretches only for the buttons to become visible, but when the scroll bar appears, it just overlap with the text field.
Is there an easy solution to fix this (don't want to deal with setting custom / preferred / minimum heights)?
Panel structure :
Problem :
Ok, here is an SSCCE
public class Main {
JFrame frame;
private JPanel mainPanel;
private JButton button1;
private JButton button2;
private JTextField someTextTextField;
public static void main(String[] args) {
Main main = new Main();
main.show();
}
private void show() {
frame = new JFrame("Frame");
frame.setContentPane(mainPanel);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
{
$$$setupUI$$$();
}
/**
* Method generated by IntelliJ IDEA GUI Designer
* >>> IMPORTANT!! <<<
* DO NOT edit this method OR call it in your code!
*
* #noinspection ALL
*/
private void $$$setupUI$$$() {
mainPanel = new JPanel();
mainPanel.setLayout(new GridBagLayout());
mainPanel.setPreferredSize(new Dimension(209, 30));
final JPanel panel1 = new JPanel();
panel1.setLayout(new GridBagLayout());
GridBagConstraints gbc;
gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 0;
gbc.weightx = 0.5;
gbc.weighty = 1.0;
gbc.fill = GridBagConstraints.BOTH;
mainPanel.add(panel1, gbc);
button1 = new JButton();
button1.setText("Button");
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.fill = GridBagConstraints.HORIZONTAL;
panel1.add(button1, gbc);
button2 = new JButton();
button2.setText("Button");
gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 0;
gbc.fill = GridBagConstraints.HORIZONTAL;
panel1.add(button2, gbc);
final JScrollPane scrollPane1 = new JScrollPane();
scrollPane1.setAlignmentX(0.0f);
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.weightx = 0.5;
gbc.weighty = 1.0;
gbc.fill = GridBagConstraints.BOTH;
mainPanel.add(scrollPane1, gbc);
someTextTextField = new JTextField();
someTextTextField.setText("some text");
scrollPane1.setViewportView(someTextTextField);
}
/**
* #noinspection ALL
*/
public JComponent $$$getRootComponent$$$() {
return mainPanel;
}
}
Try and use a JTextArea instead of a JTextField. And if you don't want to set custom/preferred/minimum sizes, you can use the JTextArea.setRows(int rows) method. I hope that helps.

Categories

Resources