Problem adding a table to scrollpane

Hi:
I have created a JTable that I want to be in a scrollpane. When I tried to add this JTable to a scrollpane I get a null pointer error at execution time. But when I add this table directly to the frame I get no error at execution time.
Here is my code:
import java.awt.*;
import java.awt.event .*;
import javax.swing.*;
import java.util.*;
import javax.swing.event.*;
import java.io.*;
import javax.swing.table.*;
import javax.swing.BorderFactory;
import javax.swing.border.Border;
import java.net.*;
import java.util.regex.*;
// METHODS
// =======
// private String returnSelectedString( int col ))
public class DialogFrame extends JFrame
{     //===================
//MEMBER VARIABLES
//===================
public JLabel topClassifiedLabel, bottomClassifiedLabel,printerCountLabel,defaultPrinterLabel ;
public JPanel panelForLabel,topClassificationPanel , bottomClassificationPanel, SecBotPanel, ClassificationPanel,Classification_botPanel,firstTopPanel, titlePanel,titlePanel2,displayPanel,labelPanel,buttonPanel;
public DefaultListModel listModel;
public final String screenTitle = "Printer Configuration "
+ " CSS - 105";
public JLabel localDisplay = new JLabel("Local: Printer directly connected to this computer");
public JLabel remoteDisplay = new JLabel("Remote: Printer connected to another computer");
public JLabel networkDisplay = new JLabel("Network: Printer connected to the LAN");
public char hotKeys[] = { 'A', 'D', 'Q','T','R','I','Q','H' };
public JPanel ConnectTypePanel = null, printCountPanel;
public JScrollPane tabScrollPane;
public JLabel l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,TitleLabel;
public JButton addPrinterButton,setDefaultButton,restartPrintSystemButton, deletePrinterButton, displayQueueButton,
ToggleBannerButton, RestartPrintSystemButton, InstallOpenPrintButton, QuitButton, continueButton,CancelButton,HelpButton;
public Vector columnNames;
public String line2 = "";
public addPrinterDialog aPDialog;
public printQueueDialog dQDialog;
public String nextElement,name,Type,Interface,Description,Status,Queue,BannerPage;
public JRadioButton networkButton, localButton, remoteButton;
public JLabel nameLabel, descriptionLabel, modelLabel,ClassificationLabel,ClassificationLabel_bot,setL,defaultL;
public JTextField nameTextField, descriptionTextField, modelTextField;
private int printerCount = 0;
static DefaultTableModel model;
public JTable table;
//=======================//
//**Constructor
//=========================//
public DialogFrame()
createTable();
public void createTable()
defaultPrinterLabel = new JLabel();
printerCountLabel = new JLabel();
//COLUMN FOR TABLE
columnNames = new Vector();
columnNames.add("Name");
columnNames.add("Type");
columnNames.add("Interface");
columnNames.add("Description");
columnNames.add("Status");
columnNames.add("Queue");
columnNames.add("BannerPage");
Vector tableRow = new Vector();
//tableRow = executeScript("perl garb.pl");
// tableRow = executeScript("perl c:\\textx.pl");
model = new DefaultTableModel( tableRow, columnNames ){
public boolean isCellEditable(int row,int col) {
return false;
public Dimension getPreferredScrollableViewportSize() {
return getPreferredSize();
table = new JTable(model);
JTableHeader header = table.getTableHeader();
TableColumnModel colmod = table.getColumnModel();
for (int i=0; i < table.getColumnCount(); i++)
DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
renderer.setHorizontalAlignment(SwingConstants.CENTER);
colmod.getColumn(i).setCellRenderer(renderer);
table.setPreferredScrollableViewportSize(new Dimension(500, 70));
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
table.setShowGrid( false );
table.getTableHeader().setReorderingAllowed( false );
table.setIntercellSpacing(new Dimension(0,0) );
table.addMouseListener( new MouseAdapter () {
public void mouseClicked( MouseEvent e) {
if ((e.getModifiers() & InputEvent.BUTTON1_MASK) !=0)
printSelectCell(table);
this.setSize(900,900);
//========================================//
// Technique for centering a frame on the screen
//===========================================//
Dimension frameSize = this.getSize();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation((screenSize.width - frameSize.width)/2,
(screenSize.height - frameSize.height)/2);
setResizable(false);
// CREATE A FEW PANELS
firstTopPanel = new JPanel();
BoxLayout box = new BoxLayout(firstTopPanel, BoxLayout.Y_AXIS);
firstTopPanel.setLayout(box);
topClassificationPanel = new JPanel();
topClassificationPanel.setBackground(new Color(45,145,71));
bottomClassificationPanel = new JPanel();
bottomClassificationPanel.setBackground(new Color(45,145,71));
SecBotPanel = new JPanel();
SecBotPanel.setLayout(new BorderLayout());
buttonPanel = new JPanel();
buttonPanel.setLayout(new GridLayout(1,8));
buttonPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 0));
buttonPanel.setBackground(new Color(170,187,119));
panelForLabel = new JPanel();
// panelForLabel.setBackground( Color.white );
//Border etchedBorder = BorderFactory.createEtchedBorder();
printerCountLabel.setHorizontalAlignment(SwingConstants.LEFT);
printerCountLabel.setPreferredSize(new Dimension(700, 20));
//printerCountLabel.setBorder(etchedBorder);
printerCountLabel.setForeground(Color.black);
defaultPrinterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
defaultPrinterLabel.setText("Default Printer: " + name);
defaultPrinterLabel.setForeground(Color.black);
panelForLabel.add(printerCountLabel);
panelForLabel.add(defaultPrinterLabel);
titlePanel = new JPanel( );
titlePanel.setBackground( Color.white );
ConnectTypePanel = new JPanel();
ConnectTypePanel.setBackground(new Color(219,223,224));
ConnectTypePanel.setLayout( new GridLayout(3,1) );
//CREATE A FEW LABELS
topClassifiedLabel = new JLabel("UNCLASSIFIED", SwingConstants.CENTER );
topClassifiedLabel.setForeground(Color.white);
bottomClassifiedLabel = new JLabel("UNCLASSIFIED", SwingConstants.CENTER );
bottomClassifiedLabel.setForeground(Color.white);
TitleLabel = new JLabel( screenTitle, SwingConstants.CENTER );
//ADD LABELS TO PANELS
topClassificationPanel.add( topClassifiedLabel );
bottomClassificationPanel.add( bottomClassifiedLabel );
titlePanel.add( TitleLabel, BorderLayout.CENTER );
ConnectTypePanel.add(localDisplay );
ConnectTypePanel.add(remoteDisplay );
ConnectTypePanel.add(networkDisplay );
//Create the scrollpane and add the table to it.
tabScrollPane = new JScrollPane(table);
JPanel ps = new JPanel();
ps.add(tabScrollPane);
getContentPane().setLayout(
new BoxLayout( getContentPane(), BoxLayout.Y_AXIS ) );
getContentPane().add(firstTopPanel);
getContentPane().add(panelForLabel);
getContentPane().add(header);
getContentPane().add(ps);//contain table
getContentPane().add(SecBotPanel);
WindowListener w = new WindowAdapter() {
public void windowClosing(WindowEvent e) {
DialogFrame.this.dispose();
System.exit(0);
this.addWindowListener(w);
//==================================//
// AddPrinterButton
//==================================//
addPrinterButton = new JButton();
addPrinterButton.setLayout(new GridLayout(2, 1));
l1 = new JLabel("Add", JLabel.CENTER);
l1.setForeground(Color.black);
l2 = new JLabel("Printer", JLabel.CENTER);
l2.setForeground(Color.black);
addPrinterButton.add(l1);
addPrinterButton.add(l2);
addPrinterButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event)
//(aPDialog == null) // first time
aPDialog = new addPrinterDialog(DialogFrame.this);
aPDialog.setLocationRelativeTo(null);
aPDialog.pack();
aPDialog.show(); // pop up dialog
//======================================
// DeletePrinterButton
//=====================================
deletePrinterButton = new JButton();
deletePrinterButton.setLayout(new GridLayout(2, 1));
l1 = new JLabel("Delete", JLabel.CENTER);
l1.setForeground(Color.black);
l2 = new JLabel("Printer", JLabel.CENTER);
l2.setForeground(Color.black);
deletePrinterButton.add(l1);
deletePrinterButton.add(l2);
deletePrinterButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event)
int sr = table.getSelectedRow();
if (sr == -1)
JOptionPane.showMessageDialog(null, "You have not selected a printer for this operation","NOSELECT",JOptionPane.INFORMATION_MESSAGE);
else
name = returnSelectedString(0);
int ans = JOptionPane.showConfirmDialog(null,"Are you sure you want to delete printer " + name + "?","Delete",JOptionPane.YES_NO_OPTION);
switch(ans) {
case JOptionPane.NO_OPTION:
return;
case JOptionPane.YES_OPTION:
// String machineName = returnSelectedString(0);
int rowNumber = table.getSelectedRow();
model.removeRow(rowNumber);
//TiCutil.exe("/usr/lib/lpadmin -x " + machineName);
decreasePrinterCount();
JOptionPane.showMessageDialog(null, "Printer " + name + " have been successfully deleted","SUCCEED",JOptionPane.INFORMATION_MESSAGE);
return;
//==============================//
//DisplayQueuePrinter //
//================================//
displayQueueButton = new JButton();
displayQueueButton.setLayout(new GridLayout(2, 1));
l5 = new JLabel("Display", JLabel.CENTER);
l5.setForeground(Color.black);
l6 = new JLabel("Queue", JLabel.CENTER);
l6.setForeground(Color.black);
displayQueueButton.add(l5);
displayQueueButton.add(l6);
displayQueueButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event)
Vector tab = new Vector();
int sr = table.getSelectedRow();
if (sr == -1)
JOptionPane.showMessageDialog(null, "You have not selected a printer for this" +
"operation","NOSELECT",JOptionPane.INFORMATION_MESSAGE);
else
name = returnSelectedString(0);
//PASS TABLE HERE
/*tab = executeScript("lpstat -o " + name + " | sed \'s/ on$//\'");
System.out.println("lpstat -o " + name + " | sed \'s/ on$//\'");
dQDialog = new printQueueDialog(DialogFrame.this, name, tab);
dQDialog.setLocationRelativeTo(null);
dQDialog.pack();
dQDialog.show(); // pop up dialog */
//===================================
// SetDefaultButton
//================================//
setDefaultButton = new JButton();
setDefaultButton.setLayout(new GridLayout(2, 1));
setL = new JLabel("Set", JLabel.CENTER);
setL.setForeground(Color.black);
defaultL = new JLabel("Default", JLabel.CENTER);
defaultL.setForeground(Color.black);
setDefaultButton.add(setL);
setDefaultButton.add(defaultL);
setDefaultButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event)
int sr = table.getSelectedRow();
if (sr == -1)
JOptionPane.showMessageDialog(null, "You have not selected a printer for this operation","NOSELECT",JOptionPane.INFORMATION_MESSAGE);
else
name = returnSelectedString(0);
JOptionPane.showMessageDialog(null, "printer " + name + " is now the default.","Succeed",JOptionPane.INFORMATION_MESSAGE);
defaultPrinterLabel.setText("Default Printer: " + name);
//==============================//
// ToggleBannerButton
//==============================//
ToggleBannerButton = new JButton();
ToggleBannerButton.setLayout(new GridLayout(2, 1));
l7 = new JLabel("Toggle", JLabel.CENTER);
l7.setForeground(Color.black);
l8 = new JLabel("Banner", JLabel.CENTER);
l8.setForeground(Color.black);
ToggleBannerButton.add(l7);
ToggleBannerButton.add(l8);
ToggleBannerButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event)
int sr = table.getSelectedRow();
System.out.println("sr :" + sr);
if (sr == -1)
JOptionPane.showMessageDialog(null, "You have not selected a printer for this operation","NOSELECT",JOptionPane.INFORMATION_MESSAGE);
else
String banner = returnSelectedString(6);
name = returnSelectedString(0);
String machineName = returnSelectedString(0);
Type = returnSelectedString(1);
if ( !(Type.equals("Remote")) )
if( banner.equals("Yes") )
JOptionPane.showMessageDialog(null,"Banner page will NOT be printed for printer "+ name ,"Succeed",JOptionPane.INFORMATION_MESSAGE);
//TiCutil.exe("sed -e 's/^BANNER=\"yes\"/BANNER=\"\"/' /etc/lp/interfaces/" + machineName + " > /tmp/delete.txt" );
//TiCutil.exe("mv /tmp/delete.txt /etc/lp/interfaces/" + machineName);
table.setValueAt("No",sr,6);
DefaultTableModel model = (DefaultTableModel)table.getModel();
model.fireTableCellUpdated(sr,6);
table.requestFocus();
else
JOptionPane.showMessageDialog(null,"Banner page WILL be printed for printer "+ name ,"Succeed",JOptionPane.INFORMATION_MESSAGE);
//TiCutil.exe("sed -e 's/^BANNER=\"\"/BANNER=\"yes\"/' /etc/lp/interfaces/" + machineName + " > /tmp/delete.txt");
//TiCutil.exe("mv /tmp/delete.txt /etc/lp/interfaces/" + machineName);
table.setValueAt("Yes",sr,6);
DefaultTableModel model = (DefaultTableModel)table.getModel();
model.fireTableCellUpdated(sr,6);
table.requestFocus();
else
JOptionPane.showMessageDialog(null,"Operation failed system respond \n" + "was:\n" + "cannot toggle the banner page for a\n" + "REMOTE printer." ,"OPFAIL",JOptionPane.INFORMATION_MESSAGE);
//==================================//
// RestartPrintSystemButton
//==================================//
restartPrintSystemButton = new JButton();
restartPrintSystemButton.setLayout(new GridLayout(2, 1));
l3 = new JLabel("Restart Print", JLabel.CENTER);
l3.setForeground(Color.black);
l4 = new JLabel("System", JLabel.CENTER);
l4.setForeground(Color.black);
restartPrintSystemButton.add(l3);
restartPrintSystemButton.add(l4);
restartPrintSystemButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event)
//==============================
// InstallOpenPrint
//================================
InstallOpenPrintButton = new JButton();
InstallOpenPrintButton.setLayout(new GridLayout(2, 1));
l11 = new JLabel("Install Open", JLabel.CENTER);
l11.setForeground(Color.black);
l12 = new JLabel("Print", JLabel.CENTER);
l12.setForeground(Color.black);
InstallOpenPrintButton.add(l11);
InstallOpenPrintButton.add(l12);
InstallOpenPrintButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event)
int ans = JOptionPane.showConfirmDialog(null,"Are you sure you want to install OPENPrint?","Delete",JOptionPane.YES_NO_OPTION);
switch(ans) {
case JOptionPane.NO_OPTION:
return;
case JOptionPane.YES_OPTION:
int cd,opinstall,banner_var,pwd;
opinstall = runIt("open_print.ksh");
banner_var = runIt("banner_var.ksh");
System.out.println("opinstall: " + opinstall );
System.out.println("banner_var: " + banner_var);
if ( opinstall == 0 && banner_var == 0)
JOptionPane.showMessageDialog(null, "OPENprint successfully added"
,"SUCCEED",JOptionPane.INFORMATION_MESSAGE);
return;
//==========================
//QuitButton
//============================
QuitButton = new JButton("Quit");
QuitButton.addActionListener (new ActionListener ()
{ public void actionPerformed (ActionEvent e){
System.exit (0); }
HelpButton = new JButton("Help");
//ADD BUTTONS TO PANEL
buttonPanel.add( addPrinterButton );
buttonPanel.add( deletePrinterButton );
buttonPanel.add( displayQueueButton );
buttonPanel.add( setDefaultButton);
buttonPanel.add( ToggleBannerButton );
buttonPanel.add( restartPrintSystemButton );
buttonPanel.add( InstallOpenPrintButton );
buttonPanel.add( QuitButton );
//buttonPanel.add( HelpButton );
//END OF BUTTONS CREATION
//ADD PANEL ON TO PANEL
SecBotPanel.add(ConnectTypePanel, BorderLayout.CENTER);
SecBotPanel.add(bottomClassificationPanel, BorderLayout.SOUTH);
firstTopPanel.add(topClassificationPanel);
firstTopPanel.add(titlePanel);
firstTopPanel.add(buttonPanel);
//===========================================================
// METHODS
//==========================================================
public int runIt(String targetCode)
int result = -1;
try{
Runtime rt = Runtime.getRuntime();
Process p = rt.exec( targetCode );
// Thread.sleep(20000);
p.waitFor();
result = p.exitValue();
catch( IOException ioe )
ioe.printStackTrace();
catch( InterruptedException ie )
ie.printStackTrace();
return result;
//====================================================
public void increasePrinterCount()
printerCount++;
printerCountLabel.setText("Printer: " + printerCount);
//===========================================================
public void decreasePrinterCount()
printerCount--;
printerCountLabel.setText("Printer: " + printerCount);
private String returnSelectedString( int col )
int row = table.getSelectedRow();
String word;
//javax.swing.table.TableModel model = table.getModel();
word =(String)model.getValueAt(row, col);
return word; //return string
//==============================================================================
private Vector executeScript(String str)
Vector tableOfVectors = new Vector();
try{          
String line;
Process ls_proc = Runtime.getRuntime().exec(str);
//get its output (your input) stream
BufferedReader in = new BufferedReader( new InputStreamReader( ls_proc.getInputStream() ));
//readLine reads in one line of text
int k = 1, i = 0;
//LOOK FOR THE "|"
Pattern p = Pattern.compile(" ");
while (( line = in.readLine()) != null)
Vector data = new Vector();
Matcher m = p.matcher(line);
if(m.find() == true)//find " "
line = line.replaceAll(" {2,}?", "|");
//creates a new vector for each new line read in
StringTokenizer t = new StringTokenizer(line,"|");
while ( t.hasMoreTokens() )
try
nextElement = t.nextToken().trim();
//add a string to a vector
data.add(nextElement.trim());
catch(java.util.NoSuchElementException nsx)
System.out.println(nsx);
tableOfVectors.add(data);
//COUNT THE NUMBER OF PRINTER
printerCount = k;
printerCountLabel.setText("Printer: " + printerCount);
k++;
}//END OF WHILE
in.close();
}//END OF TRY
catch (IOException e1) {
System.err.println(e1);
System.exit(1);
return tableOfVectors;
//==========================================================================================================
private String getDefaultPrinter(String str)
String groupStr = null;
try{          
String lin;
Process ls_proc = Runtime.getRuntime().exec(str);
BufferedReader in = new BufferedReader( new InputStreamReader( ls_proc.getInputStream() ));
Pattern p2 = Pattern.compile("system default destination: (\\S+)");
while (( lin = in.readLine()) != null)
Matcher m2 = p2.matcher(lin);
m2.reset(lin);
if (m2.find() == true )
groupStr = m2.group(1);
in.close();
catch (IOException e1) {
System.err.println(e1);
System.exit(1);
return groupStr;
//================================================================================
public synchronized void clearTable()
int numrows = model.getRowCount();
for ( int i = numrows -1 ; i >= 0 ; i--)
model.removeRow(i);
//=======================================================================================================
private void printSelectCell(JTable table )
int numCols = table.getColumnCount();
int row = table.getSelectedRow();
System.out.println(row);
javax.swing.table.TableModel model = table.getModel();
for(int j=0;j < numCols; j++)
System.out.println(" " + model.getValueAt(row,j));
System.out.println();
System.out.println("-----------------------------------------------");
//CREATE ADD PRINTER DIALOG
class addPrinterDialog extends JDialog
public addPrinterDialog(JFrame owner)
super(owner, "ap1", true);
final ButtonGroup rbg = new ButtonGroup();
JPane

Ok  I have the table  on the page  I created a css with a background image called .search  How to I link that to the table so It shows the image
I am only used to doing certain css items   Never didi this before
THXS STeve

Similar Messages

  • Problem about customized table in scrollpane

    I put a customized table whose's header and rows have some colors into a scrollpane(row 0, 2, 4 ... is white, row 1, 3, 5... is black, for example).when the width of scrollpane is big enough, the space area on the right of the table in the viewport has the default color, If I want to set the space area's color the same as the table just as if the space area is the last column of the table(even row is white, odd row is black).
    How can I do this?

    Try adding a dummy column to the table. then use:
    table.setAutoResizeMode(int mode)
    so that only the last column is resized.

  • Problem adding more than 1 table from a database

    I am running Crystal Reports 2008 on windows server 2008 and connecting to an ODBC database using IBM Client access driver.  When I create a new report and only add one table from the database, everything works fine.  If I try to go add a second table to the report, then I get an error - Crystal Reports has stopped working - there is no other useful information.  I have also tried creating a new report and adding 2 tables at the same time, it also blows up before I even get to the linking screen.
    I have also tried opening a report that was created in Crystal 11 that has 2 or more tables in it.  The report will open and run successfully in Crystal 2008.

    Hi Gwyn,
    Moved this post to the Database Connectivity Forum.
    Have you installed any CR patches? If not please do so. Also you can find our DataDirect ODBC drivers from this link also:
    http://service.sap.com/sap/bc/bsp/spn/bobj_download/main.htm
    Select Crystal Report, 2008 and you'll find Service Pack 2 and the Data Direct ODBC drivers. Try both and then reply if you have still have a problem or if it now works.
    Thank you
    Don

  • Adding Buttons to a ScrollPane??

    Hello Swing people,
    I have had this problem now for quite some time and still have had no luck in getting it right. I am coding an ordering system and on this form is a Jtable displaying product details. Beside the Jtable are category buttons one after the other in a vertical line and there are 18 of them - meaning they cannot fit on the screen!! Therefore i want these buttons to be in some kind of scollpane or list so they can all be viewed.
    I thought this would be a simple matter of adding buttons to a scrollpane and then to the panel but this has proved not the case! Does anyone know how i could do this as i have been trying this for too long without the help of you geniuses???
    To give u an idea of what i was trying here is a snippet of my code:
    import javax.swing.*;
    public class junk2 extends JFrame{
         junk2()    {
         JPanel panel = new JPanel();
         panel.setLayout(new java.awt.GridLayout(0, 1) );
         JButton []button = new JButton[20];
         for(int i=0; i<button.length; i++) {
              button=new JButton(""+(i+1) );
              panel.add(button[i]);
         JScrollPane scroll = new JScrollPane(panel);
         getContentPane().add(scroll, java.awt.BorderLayout.CENTER);
         setSize(50, 100);
         setDefaultCloseOperation( EXIT_ON_CLOSE );
         public static void main(String []args) {
              new junk2().show();
    This code is fine and puts buttons in a vertical line but the buttons only have numbers on them from 1-20, i want the names of the buttons i have declared to be in here - therefore allowing the action performed on these buttons to be recognised and therefore work too! - anyone know how to get around this??
    Also the scrollpane with these buttons in apears in a whole new frame being that it is a small test program but does anyone know how to ensure the buttons appear in the scrollpane only and not in a new frame??
    all 25 dukes if someone can sort this long problem out!!!

    Hi guys thanks a lot for your replies, i compiled both of them and they are fine! the first reply is more what i am looking for but there is still a problem, i am finding it difficult to incorporate this piece of code into my order form class.
    Im trying to take out the current declarations of my JButtons and replace it with the code i was given (reply 1) and obviously keep my action performed methods there as they will be the same but cant seem to do this!
    If anyone can add in the code from reply 1 into my code below or at least help me i will give u the 25 dukes, taking into consideration i still want the form (panel) to be displayed as well as the panel or scrollpane containing the JButtons???
    Can u help - cheers in advance!!
    Pc
    public class OrderForm extends JFrame implements ActionListener {
         private JPanel panel;
         private JButton saveArchive,unCompleted,submitOrder,checkSheet,clear,exit,bread,fruit,dairy,
    salads,cakes,frozen,meat,cheeses,sauces,dry,drinks,soup,cleaning,boxes,cups,cutlery,lids,misc,stick,soup2;
         private JScrollPane pane;
         private JTextField textorderno,textorderdate,textdelivdate,textemp,textshop,textsupp;
         private JLabel heading1,heading2,orderno,orderdate,delivdate,emp,shop,supplier;
         private String todaysDate, deliveryDate;
         private ResultSet result;
         private ResultSet shops;
         private int column_count;
         private JComboBox combobox;
         ResultSetTableModel model = new ResultSetTableModel();
         Result rs = new Result(); 
         Orders orderSaving = new Orders();
         ProductOrders tableSaving = new ProductOrders();
         private boolean save;
         JTable table;
         public OrderForm()throws SQLException {
              displayForm();
              displayFields();//Have not provided coz it aint needed for this
              displayButtons();//Wont need this anymore i dont think
              getContentPane().add(panel);
              setVisible(true);
         public void displayForm() throws SQLException{
              setTitle("Pret Ordering System");
              setSize(700,600);
              // Center the frame
              Dimension dim = getToolkit().getScreenSize();
              setLocation(dim.width/2-getWidth()/2, dim.height/2-getHeight()/2);
              //Creates the coloured bored around the panel
              panel = new JPanel();
              panel.setLayout( null );
              Border paneltitled = BorderFactory.createLineBorder(Color.red.darker().darker(),10);
              panel.setBorder(paneltitled);
              ResultSet result = rs.setBreadProds();
              model.fillTableModel(result);
              table = new JTable(model);
              for(int i = 0; i < column_count; i++) {          
                   table.getColumnModel().getColumn (i).setPreferredWidth (200);                   
              table.setSelectionForeground( Color.white );
              table.setSelectionBackground( Color.red.darker().darker() );
              pane = new JScrollPane(table);
                  pane.setBounds(190, 230, 440, 200);
                  panel.add(pane);
              combobox = new JComboBox();
              ResultSet shops = rs.getSupplierNames();
              while(shops.next()){  
                   combobox.addItem(shops.getString("supplier_name"));
    //Hope you can help - cheers

  • Problem with maintain table views SM30 Transaction

    Hello All,
    i have a problem with the table maintenance view SM30, it doesn't permit me to modify the rows in the table.
    we have added a field into the table and when i tried to change the table view from menu: Utilities ==> table maintenance generator==> change the system propose me a message that the screen 0001 will be deleted and recreated...but the system has deleted the screen and doesn't recreate it...in somewehere on internet we find that we should use the transaction SE55 menu:
    Environment==> modification ==> Maintenance screen ==> button Layout which open the tool Screen Painter and from that we have created our screen with 4 fields of our table...our result that the screen is created and i can see it from the SM30 transaction but i can't insert rows in the table...when i try to go to maintain table: menu: Utilities ==> Table maintenance generator to try if i can modify something the system give me a message: "set the compare flag dialog ZIV_DP_PLCHAR_LA"
    the ZIV_DP_PLCHAR_LA is the name of my table...
    can you give me some advices please how should i do to fix this problem to insert rows in table throughout the transaction
    SM30 "maintain table views: initial screen"
    if i want to delete the screen from the SE55 transaction to recreate it newly what should i do to take care about some options
    to have a new screen?
    thanks for all
    Bilal

    Hi
    First delete the old table maintainence generator.
    Now Recreate the screen and your table is good to go..
    These error messages come when we add new fields and different version of the table maintainence generator in database.

  • Added 3 tables in Entity framework

    I added 3 tables to my EF: 2 tables for data and the third for connection between them (= 3 columns in this table, first ID as
    the primary key, and the second and the third are FK to the other two tables).
    But the problem is that the third table was added with just the first column (= ID).
    Why is that?

    Hello shirley111,
    >>But the problem is that the third table was added with just the first column (= ID).
    Could you please tell which approach you are using, code first, model first or database first? And how do you define these three tables? Please also share them with us. Currently, we cannot understand what exactly happens on your side.
    Here are some information about many to many relationship in Entity Framework which might be helpful(from your description, it seems that you are trying to make a * to * relationship):
    Configure Many-to-Many relationship using Code First Approach
    Entity Relationships
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • StackOverflowError after adding a table to a TopLink Map

    Hello,
    I am really puzzled by the next problem. After adding a table (Customer) to an existing TopLink Map, I get the same kind of error for every query in the project that I use.
    ERROR J2EE EJB8006 [CustomerToplinkTestPublicFacade:public java.util.List com.companyname.toplinktest.model.CustomerToplinkTestPublicFacadeBean.findCustomersByCompany(java.lang.String,java.lang.String)] exception occurred during method invocation: javax.ejb.EJBException: java.lang.StackOverflowError
    I get this with every page and every query, just change the name “findCustomersByCompany” to the name of the named query. Otherwise all pages seems to have the correct behaviour Removing the Customer-table from the application solved all problems, and they reoccurred after adding the table again.
    I have no clue why this happens, the only thing that might be useful is the fact that the Customer-table is also a part of a database view which I already use.
    … but why would that cause errors on queries it has absolutely no relation to…
    Kind regards,
    Nemata

    hello,
    another update on my testcases. I have used the following procedure to narrow down the source of the problem.
    First I create one or more TopLink pojo's based on my database tables and views, add them to a session bean and create the data controls. I'm always working with the default named queries (selectAll).
    Then I create a .jspx file, drag and drop a data control from the data control palette to create an ADF table with the defaults...
    and run... with one of two outcomes.
    I either get all the data from the table (correct) or I get a message "no rows yet" and an error message in the log window "2006-05-04 12:37:40.214 ERROR J2EE EJB8006 [testCustomerSession:public java.util.List model.testCustomerSessionBean.findAllCompany()] exception occurred during method invocation: javax.ejb.EJBException: java.lang.StackOverflowError"
    This is an overview of the testing I have done:
    Objects created | ADF table | Error
    Customer | Customer | Yes
    Company | Company | No
    Customer and Company | Company | Yes
    Company and ViewOfCustomer | Company | No
    Company and ViewOfCustomer | ViewOfCustomer | No
    Company and Person | Company | No
    ViewOfCustomer is a database view with the same data as the Customer. So the table Customer seems to cause the problem.
    Does anybody have an idea why a database table might cause such distinct problems ?
    Kind regards,
    Nemata

  • Problems with 2 tables on same page (in tabs)

    i have two data tables bound to different data providers on a page
    the tables are presented in two of the tabs of a 5 tab tabset
    both tables bind to the data, refresh etc fine. i can customise the data, sort the tables, paginate and so on. no problems.
    however, both tables have an edit and a delete button. on table 1 these buttons work fine and fire the appropriate event handlers. on table 2 the buttons i have added to the second table don't seem to fire any event when they are clicked - i have run in debug mode and nothing is happening when the buttons are clicked at any point in the code that i can find
    has anyone had similar problems - anyone got any suggestions
    thanks
    ben

    Thanks Misha, for the help
    I actually ended up tracing it back to an issue with the data provider - essentially, I had changes some of the table structure behind the data provider and this seemed to cause the table in question to not fire the button events - it seemed that because part of the compound primary key was not selected in the data provider's source rowset, the provider could not get a row key and therefore the events did not fire - i have it working now though after modifying the backing query
    thanks again

  • Cannot place order ERROR: "There was a problem adding your product to cart"

    Hey guys,
    Well, once again Best Buy's online system is preventing me from making an order. It seems like nearly every time I log in I experience some new problem. This time, I'm unable to add anything to my cart. It doesn't matter what item I try to add to my cart or what browser I use or if I clear cookies...it happens every time, on every browser, with every product in the store. The error shows a red & white triangle with a message "There was a problem adding your product to cart".
    Just to clarify ahead of time: 1) I have already tried signing in using 4 different browsers (explorer, firefox, chrome, opera) & they all give the same error; 2) Prior to posting here I researched this problem & found out it is somewhat common & has been occurring since at least 2012 on BestBuy.com; 3) Every time someone posts in here about this problem, customer service offers the same "fix" every time - to sign out, clear their browser cache of cookies, shut down the browser, restart the browser, sign back in, etc.... The only problem is, this "solution" has not worked ONE time our of the many times this problem has cropped up in here over the past 3+ years. Why this "solution" keeps getting told to people even though it never works is beyond me. But, there you have it.
    Just to clarify: I have already tried this solution, And just like with everyone else before me, it didn't work for me either. So, what's the next step? There must be something else that can be done other than waiting a couple more days for it to magically fix itself (it seems that is the only thing that ever "works"...is to let several days go by and the problem ends up getting fixed in some back-end server-side patch up). 
    What I'm hoping for from you is a solution that can fix this immediately. This problem has already prevented me from making a couple purchases for items that were temporarily on sale over the past couple days. So, those are lost sales for Best Buy. What I'm hoping to do now is pre-order the Elder Scrolls Online (PS4) in order to take advantage of the $10 pre-order reward. The game releases on Tuesday the 9th. So, in order to get this done in time I need to place the order sometime today (on the 8th).
    With all these repeated technical problems making purchasing a chore & wasting my time every single time I want to buy a product it's almost as if Best Buy is telling customers "We don't care if our online system works reliably...go spend your money at Amazon instead". lol
    Thank you in advance for your timely help on this matter.
    -Marc (removed per forum guidelines)

    Hello mjswooosh,
    I'm very disheartened to hear that you've had ongoing problems when attempting to order from BestBuy.com. Our goal is ever to provide a fun and efficient shopping environment! Certainly creating aggravation serves neither you nor us and I apologize sincerely for this having been your experience.
    We recommend the troubleshooting steps you mentioned (i.e., clearing the browser cache, deleting temporary internet files and cookies) because this is the most common cause of this type of problem. I too have encountered this issue from time to time and these steps have almost always resolved the problem. I say almost always because there's one further step you can try: ensure that you have signed out of BestBuy.com, then perform the browser maintenance steps we've recommended. Afterward, before signing in to BestBuy.com, add your desired items to your cart and sign in as part of the checkout process. When the standard steps have not netted a resolution for me, this has solved the problem each time.
    I hope this helps. I'm very grateful that you took the time to write to us with your concerns and for sharing your very valuable feedback about your online experience.
    Sincerely,
    John|Social Media Specialist | Best Buy® Corporate
     Private Message

  • Problem adding HP J6400 all-in-one printer

    We have an HP Officejet J6400 all-in-one printer here at work, and all of our computers have had no problem adding this printer except one: an older iMac, PowerMac 6.1 (with the white domed base). The driver is installed, and the computer sees the driver, but when I click to add it eventually it gives me this error:
    "An error occurred while trying to add the selected printer. client-error-not-authorized"
    I was on the phone with HP for an hour and they couldn't figure it out on their end. Has anyone had a similar problem, or have a solution?

    Hi,
    I request you to try the following:
    For network connection:
    http://h10025.www1.hp.com/ewfrf/wc/document?docname=c03086294&tmp_task=useCategory&cc=us&dlc=en&lc=e...
     For USB:
    http://h10025.www1.hp.com/ewfrf/wc/document?docname=c03521864&tmp_task=useCategory&cc=us&dlc=en&lc=e...
    Although I am an HP employee, I am speaking for myself and not for HP.
    Say thanks by clicking the "
    Kudos! Thumps Up" which is on the right
    Make it easier for other people to find solutions, by marking my answer with "Accept as Solution" if it solves your issue
    Regards,
    Ray

  • Adding a table to an existing table results in wrong link

    This is the code being used to add a table to a report:
    private ISCRTable AddLinkTable(ILinkTable linkTable, string sourceTableAlias, ConnectionInfo connectionInfo)
    { // construct a new Table from its name
    ISCRTable newTable = new Table();
    newTable.ConnectionInfo = connectionInfo.Clone();
    newTable.Name = linkTable.LinkTableName;
    newTable.Alias = linkTable.LinkTableName + "_ThisIsTheLinkTable" + LinkTableId++;
    if (_dataServiceSettings.DataProvider == DataProvider.Oracle11G)
    newTable.QualifiedName = _dataServiceSettings.DatabaseUserName.ToUpper() + "." + newTable.Name.ToUpper();
    else
    newTable.QualifiedName = "dba." + newTable.Name;
    // add a field to this new Table
    newTable.DataFields.Add(AddDbField(linkTable.DataField, newTable.Alias));
    // join this table to another one named sourceTableAlias, using linkFields TableLink
    tableLink = new TableLink();
    tableLink.SourceTableAlias = sourceTableAlias;
    tableLink.TargetTableAlias = newTable.Alias;
    tableLink.JoinType = CrTableJoinTypeEnum.crTableJoinTypeEqualJoin;
    Strings sourceFields = new Strings();
    Strings targetFields = new Strings();
    for (int i = 0; i + 1 < linkTable.LinkFields.Length; i += 2)
    sourceFields.Add(linkTable.LinkFields[i]); targetFields.Add(linkTable.LinkFields[i + 1]);
    tableLink.SourceFieldNames = sourceFields;
    tableLink.TargetFieldNames = targetFields;
    TableLinks tableLinks = new TableLinks();
    tableLinks.Add(tableLink); _report.ReportClientDocument.DatabaseController.AddTable(newTable, tableLinks);
    _report.ReportClientDocument.DatabaseController.VerifyTableConnectivity(newTable);
    //AddFieldToReport("{" + newTable.Alias + "." + linkTable.DataField + "}");
    return newTable;
    This is the resulting query SELECT "Article"."ArtId", "Article"."ArtDescr", "ArticleGroup"."AgDescr1", "Article"."ArtPurchLevel", "Article"."ArtMaximum", "Article"."ArtAbc", "Article"."ArtContext", "Article"."ArtPurchPrice", "Article"."ArtServOutUnt", "ArticleSite"."ArtsSitId", "Article"."ArtRecStatus"
    FROM  (dba.Article "Article" LEFT OUTER JOIN dba.ArticleGroup "ArticleGroup" ON "Article"."ArtAgId"="ArticleGroup"."AgId")
    INNER JOIN "10_78_00"."dba"."ArticleSite" "ArticleSite" ON "Article"."ArtId"="ArticleSite"."ArtsPurch" WHERE  "Article"."ArtContext"=1 AND ("ArticleSite"."ArtsSitId"='63'
    OR "ArticleSite"."ArtsSitId"='64') AND "Article"."ArtRecStatus">=0 ORDER BY "Article"."ArtId"
    the link field artspurch is not the field I declared . It happens to be the first column of the table ArticleSite. This seems to be a bug. has anyone ever experienced anything like this?
    ( Fixed the formatting )
    Message was edited by: Don Williams

    Hi Henk,
    What was the SQL before you added the table?
    I reformatted your code but you may want to confirms it correct or simply copy it into Notepad and then paste into this post.
    I find the easiest way to confirm is ad the table and joins in CR Designer first and then look at what Debug mode returns using this:
    btnReportObjects.Text = "";
    string crJoinOperator = "";
    foreach (CrystalDecisions.ReportAppServer.DataDefModel.TableLink rasTableLink in rptClientDoc.DataDefController.Database.TableLinks)
        //get the link properties
        btnCount.Text = "";
        int y = rptClientDoc.DataDefController.Database.TableLinks.Count;
        btnCount.Text = y.ToString();
        string crJoinType = "";
        if (rasTableLink.JoinType == CrTableJoinTypeEnum.crTableJoinTypeAdvance)
            crJoinType = "-> Advanced ->";
        if (rasTableLink.JoinType == CrTableJoinTypeEnum.crTableJoinTypeEqualJoin)
            crJoinType = "-> = ->";
        if (rasTableLink.JoinType == CrTableJoinTypeEnum.crTableJoinTypeGreaterOrEqualJoin)
            crJoinType = "-> >= ->";
        if (rasTableLink.JoinType == CrTableJoinTypeEnum.crTableJoinTypeGreaterThanJoin)
            crJoinType = "-> > ->";
        if (rasTableLink.JoinType == CrTableJoinTypeEnum.crTableJoinTypeLeftOuterJoin)
            crJoinType = "-> LOJ ->";
        if (rasTableLink.JoinType == CrTableJoinTypeEnum.crTableJoinTypeLessOrEqualJoin)
            crJoinType = "-> <= ->";
        if (rasTableLink.JoinType == CrTableJoinTypeEnum.crTableJoinTypeLessThanJoin)
            crJoinType = "-> < ->";
        if (rasTableLink.JoinType == CrTableJoinTypeEnum.crTableJoinTypeNotEqualJoin)
            crJoinType = "-> != ->";
        if (rasTableLink.JoinType == CrTableJoinTypeEnum.crTableJoinTypeOuterJoin)
            crJoinType = "-> OJ ->";
        if (rasTableLink.JoinType == CrTableJoinTypeEnum.crTableJoinTypeRightOuterJoin)
            crJoinType = "-> ROJ ->";
        textBox1 = "Only gets Link type:" + rasTableLink.SourceTableAlias.ToString() + "." + rasTableLink.SourceFieldNames[0].ToString() +
            crJoinOperator + "." + crJoinType + rasTableLink.TargetTableAlias.ToString() + "." + rasTableLink.TargetFieldNames[0].ToString() + "\n";
        btnReportObjects.Text += textBox1;
        btnReportObjects.AppendText(" 'End' \n");
    There are some join types RAS is not capable of.
    Attach the report before and after you manually add the join and I'll see if I can get it to work also.
    Don
    ( PS - use the Advanced option to attach files and rename the reports to *.txt. )

  • Problem in Assigning  table to access sequence

    Dear All,
    i am facing problem in assigning table to access sequence for billing output type.
    I have created 1 table B902 with the combination of Sales org,plant ,Division,Billing doc type.
    but if i am going to assign with access sequence system is taking for Billing type & division & for other its showing red marks & errorr.Access sequence->Aceessess->Field.if i am clicking on field in I/O column for plant its displaying negative.
    bcause of this i am not able to make condtion record.
    Message is Select a document field for WERKS
    Regards
    ajit
    Edited by: SAP SD AJIT on Mar 1, 2010 3:18 PM

    Hi SAP SD AJIT ,
         Go to IMG --> Sales and Distribution --> Basic Functions --> Output control --> Output Determination --> Output Determination using condition technique --> Mantain  output  Determination for billing document --> Mantain condition table,  in the pop-up choose the option "Field catalog: Messages for billing documents", there you can add standard field into the catalog, so you can add WERKS and the other one "document structure" I don't know what field it is, but if it is and standard field you can add it. If you have a Z field you need ABAP help to add the Z field to the structure "KOMKBZ5" and then you can add it to the catalog.
    Regards,
    Mariano.

  • Problem in creation table for sap 4.6

    hello evrybody
    i have just a problem in creating table with se11;after saving and activite those table and zhen i select icon  of contents it bloocks and shoz this  error message :
    Error reading table TMCNV; RC = 4
    Message no. BMG 135
    thank you for your help
    Edited by: Rob Burbank on Apr 6, 2010 10:20 AM

    Seems like you have a material number field (domain with conversion routine MATN1 or alike) and table TMCNV does not have the entry with key 'MATCONV', check the where used-list of message BMG 135. I assume this entry comes delivered by SAP, so try to restore it.
    Also search for OSS notes with "TMCNV" or "BMG 135".
    Thomas

  • Problems with a table in PDF`S footer

    Dear sirs,
    We are having problems when trying to run a PDF with Adobe LiveCycle Designer tool.
    We are working with a PDF which is composed of a header, the main body and a footer. We have created a table (table1) at the footer and
    another one at the main body (table2). This last table (table2) may overflow therefore it will genarate two pages for our PDF.
    On both pages appear the header and the footer correctly but in the last page it does not write the data from the table included in the footer (table1).
    We have no problems with the table included in the main body
    In the attachments, I send you the screenshots of both pages in which I have marked in red the part where we have error.
    May you help us to solve our problem?
    Thanks in advance your help.
    Edited by: emgaitan on Mar 16, 2010 2:18 PM

    Wardell,
    Check the data in RSA3 for the extractor that you use to bring data .
    You must be using the data source 0CO_OM_CCA_09. Check the data and reconcile and you will get it.
    Let me know if you need anything else.
    Thanks
    Ravi Thothadri
    [email protected]

  • I upgraded to Mountain from Snow and find that there is now a problem adding iphoto to the cloud.  I have iphoto '08,version 7.1.5.  Tried to follow one poster's advice and upgrade to 9.1 but I need 9.0 first and I can't find that.  suggestions? thanks!

    I upgraded to Mountain from Snow and find that there is now a problem adding iphoto to the cloud.  I have iphoto '08,version 7.1.5.  Tried to follow one poster's advice and upgrade to 9.1 but I need 9.0 first and I can't find that.  suggestions? thanks!

    You have to buy iPhoto from the Mac App Store.

Maybe you are looking for

  • How to connect a database (Access)?

    can i know how to connect to MS ACCESS, the database file name is "account" I have column "name" with data "testing" and column "id" with data "123", can i know how to link the data and view it on JTextField? Thanks

  • THIS IS MY SPEC "URGENT HELP NEEDED"

    Posting date     VBRK – FKDAT     SO     Y      Fields to be retrieved:       VBRK - VBELN       VBRK - FKDAT       VBRK - VKORG       VBRK - SPART       VBRK - KUNAG       VBRK - NETWR       KNA1 - KUNNR       KNA1 - NAME1       VBRP - FKIMG Get the

  • FOP problems...

    Hi, I have the following problem. I have an J2EE application that i am starting from Jdeveloper at the embeded OC4J . When an transformation to PDF is called from a servlet in pdf transformer class responsible for transformation there is a call of: o

  • How do I upgrade my mac os x 10.4 panther to 10.5?

    I need help.

  • How to transfer an audio file from my laptop to my ipod?

    I need to tranfer an audio file to my i pod. How could I do that?