import java.awt.*; import mlsoft.mct.*; import java.util.Vector; public class GlobalResources { // You will want to change all of these for // the specifics of your site. private String titleBar = "Customers JDBC Search Example"; private String tableName = "CUSTOMERS"; private String driverClassLocation = "sun.jdbc.odbc.JdbcOdbcDriver"; private String dataSourceName = "jdbc:odbc:Access"; private int numberOfFieldsInTable = 4; public MlResources setGridResources(int n) { MlResources res = new MlResources(); res.clear(); res.add("cellBackground", "#ffffff"); res.add("cellAlignment", "ALIGNMENT_LEFT"); res.add("cellForeground", "#000000"); res.add("allowColumnResize", true); res.add("selectionPolicy", "SELECT_BROWSE_ROW"); res.add("headingRows", 1); res.add("columns", 4); // You will need to change the next two lines // to represnt the fields in your table and the // sizes alotted to each field res.add("simpleHeadings", " Customer ID | First Name | Last Name | E-Mail "); res.add("simpleWidths", "20c 20c 20c 20c"); res.add("rows", n); res.add("visibleRows", 5); res.add("vsbDisplayPolicy", "DISPLAY_ALWAYS"); res.add("hsbDisplayPolicy", "DISPLAY_ALWAYS"); return res; } //////////////////////////////////////////////////////////// // No need to Change Remaining Code // //////////////////////////////////////////////////////////// public GlobalResources() { } public int getNumberOfFieldsInTable() { return numberOfFieldsInTable; } public String getTableName() { return tableName; } public String getDataSourceName() { return dataSourceName; } public String getDriverClassLocation() { return driverClassLocation; } public String getTitleBar() { return titleBar; } public GridBagConstraints defineLayoutConstraints(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m, int n) { GridBagConstraints layoutConstraints = new GridBagConstraints(); layoutConstraints.gridx = a; layoutConstraints.gridy = b; layoutConstraints.gridwidth = c; layoutConstraints.gridheight = d; layoutConstraints.weightx = e; layoutConstraints.weighty = f; layoutConstraints.ipadx = g; layoutConstraints.ipady = h; layoutConstraints.fill = i; layoutConstraints.anchor = j; layoutConstraints.insets.top = k; layoutConstraints.insets.bottom = l; layoutConstraints.insets.right = m; layoutConstraints.insets.left = n; return layoutConstraints; } public Vector parsePipeDelimitedLine(String s) { String stringToParse = s; Vector v = new Vector(); while (stringToParse.length() > 0) { try { v.addElement(stringToParse.substring(0, stringToParse.indexOf('|'))); stringToParse = stringToParse.substring((stringToParse.indexOf('|')+1)); } catch (Exception e) { v.addElement(stringToParse); stringToParse = ""; } } return v; } }