i am using the eclipse oxygen version. there i cannot able to find the jscrollpane too
This is the code
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import java.awt.Toolkit;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.awt.Color;
import javax.swing.JTable;
import com.mysql.jdbc.Connection;
import com.mysql.jdbc.PreparedStatement;
import net.proteanit.sql.DbUtils;
import javax.swing.UIManager;
public class instocklist {
private JFrame frmItemizationIn;
private JTable table;
/**
* Launch the application.
*/
public void update_table() {
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/gdlashmi?useSSL=false","root","");
PreparedStatement pst = (PreparedStatement) con.prepareStatement("SELECT `id`, `product_name`, `Purity`, `location`, `gross_weight`, date(`date&time`) as Date FROM `stocklist` WHERE flag = 1");
ResultSet rs = pst.executeQuery();
if(rs != null)
{
table.setModel(DbUtils.resultSetToTableModel(rs));
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
instocklist window = new instocklist();
window.frmItemizationIn.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public instocklist() {
initialize();
update_table();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frmItemizationIn = new JFrame();
frmItemizationIn.setTitle("ITEMIZATION - In Stock List");
frmItemizationIn.getContentPane().setBackground(ne w Color(176, 224, 230));
frmItemizationIn.setIconImage(Toolkit.getDefaultTo olkit().getImage("C:\\Users\\NirmalGds\\Downloads\ \itemization_logo.png"));
frmItemizationIn.setBounds(100, 100, 867, 399);
frmItemizationIn.setDefaultCloseOperation(JFrame.E XIT_ON_CLOSE);
table = new JTable();
new JScrollPane(table);
table.setBorder(UIManager.getBorder("ScrollPane.bo rder"));
GroupLayout groupLayout = new GroupLayout(frmItemizationIn.getContentPane());
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(25)
.addComponent(table, GroupLayout.DEFAULT_SIZE, 551, Short.MAX_VALUE)
.addContainerGap())
);
groupLayout.setVerticalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(28)
.addComponent(table, GroupLayout.PREFERRED_SIZE, 237, GroupLayout.PREFERRED_SIZE)
.addContainerGap(66, Short.MAX_VALUE))
);
frmItemizationIn.getContentPane().setLayout(groupL ayout);
}
}
please help me asap