Im making this program for fun and i got stuck because the program was running off the screen. how do i implement a scroll bar without having to change my code completely.
public static void main(String args[]) throws IOException
{
String ai,ia,ny;
JTextField field1 = new JTextField();
JTextField field2 = new JTextField();
JTextField field3 = new JTextField();
JTextField field4 = new JTextField();
JTextField field5 = new JTextField();
JTextField field6 = new JTextField();
JTextField field7 = new JTextField();
JTextField field8 = new JTextField();
JTextField field9 = new JTextField();
JTextField field10 = new JTextField();
JTextField field11 = new JTextField();
JTextField field12 = new JTextField();
JTextField field13 = new JTextField();
JTextField field14 = new JTextField();
JTextField field15 = new JTextField();
JTextField field16 = new JTextField();
JTextField field17 = new JTextField();
JTextField field18 = new JTextField();
JTextField field19 = new JTextField();
JTextField field20 = new JTextField();
JTextField field21 = new JTextField();
JTextField field22 = new JTextField();
JTextField field23 = new JTextField();
Object[] message = {
"Rent:", field1,
"Water:", field2,
"Light:", field3,
"DTV:", field4,
"Sprint:", field5,
"stf:", field6,
"Tithe:", field7,
"sff:", field8,
"trr:", field9,
"Citi:", field10,
"Chase:", field11,
"Walmart:", field12,
"Miss:", field13,
"Charter",field14,
"Insurance:",field15,
"Contribution", field16,
"Lowes", field17,
"Stream", field18,
//"Water", field19,
//"", field,
};
//user input
//final ImageIcon icon = new ImageIcon("icon.jpg");
int option = JOptionPane.showConfirmDialog(field1, message, "Enter all your info", JOptionPane.OK_CANCEL_OPTION);
if (option == JOptionPane.OK_OPTION)
{
String Rent = field1.getText();
String Water = field2.getText();
String Light = field3.getText();
String Dtv = field4.getText();
String Sprint = field5.getText();
String Par = field6.getText();
String Tit = field7.getText();
String sd = field8.getText();
String sdd = field9.getText();
String Citi = field10.getText();
String Chase = field11.getText();
String Wal = field12.getText();
String sd = field13.getText();
String Chasrt = field14.getText();
String ds = field15.getText();
String sdd = field16.getText();
String Lowes = field17.getText();
String Stream = field18.getText();