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.

Similar Messages

  • Problem of custom table model

    Hi,
    i m leaning JTable recently, following is an experimental code which i wrote, it has a custom table model and custom tablecellrenderer, the custom tablecellrender determine the column of # of Years greater or equal than 5 should display color green, less than 5 should display color red, it works well, however, the custom table model should be smart enough to know that the # of Years column contains numbers (which should generally be right aligned and have a particular format), it also should know that the Vegetarian column contains boolean values, which can be represented by check boxes, but it didn't, i don't know why, i have implement a getColumnClass method,
    but it seems not work, have i make any mistakes? Any idea? Thanks
    import java.awt.BorderLayout;
    import java.awt.Container;
    import java.awt.Dimension;
    import javax.swing.JFrame;
    import javax.swing.JTable;
    import javax.swing.table.AbstractTableModel;
    import javax.swing.table.TableColumn;
    import javax.swing.table.DefaultTableCellRenderer;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.UIManager;
    import java.awt.Color;
    import java.util.Vector;
    public class CellRenderTestVector extends JFrame {
         protected JTable table;
         protected int width = 100;
         protected MyCustomTableModel model;
         public CellRenderTestVector() {
              JPanel pan0 = new JPanel(new BorderLayout());
              Container contentPane = getContentPane();
              pan0.setPreferredSize(new Dimension(500,200));
              model = new MyCustomTableModel();
              table = new JTable();
              table.setAutoCreateColumnsFromModel(false);
              table.setModel(model);
              table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
                            TableColumn column = null;
              for (int i = 0; i < model.getColumnCount(); i++) {
                   DefaultTableCellRenderer renderer = new
                     ColoredTableCellRenderer();
                   column = new TableColumn(i,
                              width, renderer, null);
                              table.addColumn(column);
              TableColumn t_column = table.getColumnModel().getColumn(2);
              System.out.println(table.getColumnModel());
              JScrollPane scrollPane = new JScrollPane(table);
              pan0.add(scrollPane, BorderLayout.CENTER);
              contentPane.add(pan0);
                public class ColoredTableCellRenderer extends DefaultTableCellRenderer {
              public void setValue(Object value) {
                   Color  m_color;
                   Color GREEN = new Color(0, 128, 0);
                   Color RED = Color.red;
                   if (value instanceof Integer) {
                        Integer m_data = (Integer)value;
                        m_color = m_data.intValue() >= 5 ? GREEN : RED;
                                           setForeground(m_color);
                               setText(m_data.toString());
                   else {
                        super.setValue(value);
         public class Columndata {
              protected String m_title;
              public Columndata(String title) {
                   m_title = title;
         public class Rowdata {
              protected String fname;
              protected String lname;
              protected String sport_type;
              protected Integer no_year;
              protected Boolean vegetarian;
              public Rowdata(String fn, String ln,
                        String sp, int ny, boolean vg) {
                   fname = fn;
                   lname = ln;
                   sport_type = sp;
                   no_year = new Integer(ny);
                   vegetarian = new Boolean(vg);
         public class MyCustomTableModel extends AbstractTableModel {
              protected final Columndata m_column[] =
                        {new Columndata("First Name"),
                         new Columndata("Last Name"),
                         new Columndata("Sport"),
                         new Columndata("# of Years"),
                         new Columndata("Vegetarian")
              protected Vector m_vector;
              public MyCustomTableModel() {
                   m_vector = new Vector();
                   setDefaultData();
              public void setDefaultData() {
                   m_vector.removeAllElements();
                   m_vector.addElement(new Rowdata("Mary", "Campione",
                                                           "Snowboarding", 5, false));
                   m_vector.addElement(new Rowdata("Alison", "Huml",
                                                           "Rowing",3,true));
                   m_vector.addElement(new Rowdata("Kathy", "Walrath",
                                                           "Knitting",2, false));
                   m_vector.addElement(new Rowdata("Sharon", "Zakhour",
                                                           "Speed reading",20,true));
                   m_vector.addElement(new Rowdata("Philip", "Milne",
                                                           "Pool",10,false));
              public int getColumnCount() {
                   return m_column.length;
              public int getRowCount() {
                   return m_vector==null ? 0 : m_vector.size();
              public String getColumnName(int col) {
                   return m_column[col].m_title;
              public Object getValueAt(int nRow, int nCol) {
                   if (nRow < 0 || nRow>=getRowCount()) return "";
                   Rowdata row = (Rowdata)m_vector.elementAt(nRow);
                   switch (nCol) {
                   case 0: return row.fname;
                   case 1: return row.lname;
                   case 2: return row.sport_type;
                   case 3: return row.no_year;
                   case 4: return row.vegetarian;
                   return "";
              public Class getColumnClass(int c) {
                   return getValueAt(0, c).getClass();
         public static void createAndShowGUI() {
              try {
                UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
              } catch (Exception evt) {}
                   JFrame f = new CellRenderTestVector();
                   f.setTitle("TableTest");
                   f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                   f.pack();
                 f.setVisible(true);
         public static void main(String[] args) {
              javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    }

    You need to write your custom TableCellRenderes/Editors for each type. And don't forget to register your custom renderes via myTable.setDefaultRendere().

  • Lock object problem on custom table

    Hi all.
    I am having a bit of an issue with a lock object on a home made table. We're using the UWL and a custom IView to display an extended invoice. No problem releasing the workitem lock, just the table entry lock.
    I can see the lock in SM12. Tried dequeue/dequeue all RFCs from backend, no luck.
    The lock is set from a custom RFC. This RFC succesfully releases the lock when used in SAPGUI, and we have an RFC enabled wrapper around it. However, once used in the portal, the locks aren't released. My suspicion is that it has to do with sessions and I can't see a way to control that since dynpro uses a connection pool IIRC.
    Anyone have any ideas on how to solve this?

    Small correction if you are not aware. Do not create your custom tables in APPS schema? Custom tables are supposed to created in custom schema such as XXPO and a synonym created for the table in APPS schema.
    When creating an EO, you do not need to provide the schema name. You would need to enter only the table name.
    Hope this helps.

  • 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

  • Problem about java table.help me

    i have two pages.one pages i enter the data and another page i use a table where it shows me the enter information.But when i enter the data it successfully enter access database.but it does not show me in the table.if i set a button to table page for refreah then it refresh and show me data successfully othereise it does not work.My question is if i enter data it automaticaly refresh table page how .please help me .

    Are these webpages you are talking about? If the second page is accessed after the first page updates the database and there is code in the second page to access the db, the data should be visible. Explain more clearly if this is not what you mean.

  • My problems about reload table

    hi guys,
    i hava some problems now ,but i think they are easy for u.i need your help,thanks.
    1.in my mini application i save the data of JTable in txt format.i have a File menu,and the menuitems are New , Open ,Save ,Save As ,and exit.When i trigger the New or Open events how can i know whether another table is opening and editing.if so ,i must make a dialog pop up to inquire the user whether save the editing table.
    2.how can i know the editing table has been saved, so when i modified the table and trigger the Save event the table saves while the JFileChooser dialog dont pop up.
    3.when i open a saved table,the blank cells display null.i want to replace the null with the String "".i tried
    FileInputStream fin = new FileInputStream(filename);
    InputStreamReader isr = new InputStreamReader(fin);
    BufferedReader br = new BufferedReader(isr);
    StringTokenizer st1 = new StringTokenizer(br.readLine(), "|");
    while( st1.hasMoreTokens() )
         columnNames.addElement(st1.nextToken());
    while ((aLine = br.readLine()) != null)
         StringTokenizer st2 = new StringTokenizer(aLine, "|");
         Vector row = new Vector();
         while(st2.hasMoreTokens())
         String s = st2.nextToken();
         if (s!=null)
              row.addElement(st2.nextToken());
         else
              row.addElement("");     }
    data.addElement( row );
    br.close();
    and the table's coustructor is
    model = new DefaultTableModel(data,columnNames);
    table = new JTable(model);
    it failed,how can i do?
    Can u help me,guys?
    thank you in advance.

    1. This is really up to how you've programmed your application. In effect you've simply got to determine if there's a JTable in your UI (you probably know the container it will be in so just need to check its children)
    2. Your table model will have to support the notion of being "updated". If your table model contains a flag that indicates whether it has been saved you can then set the flag when you save it and reset it when a table cell is updated. This table model can also save the File to which the table model was saved.
    3. Are you sure your text file doesn't contain the string "null" anywhere? Null values in table models are usually rendered as the empty string anyway - perhaps the problem is with how you saved the data?
    Hope this helps

  • Problem about custom preloader in Flex 1.5

    I read the article written by Eric Anderson and test his
    sample.But i met some problems.
    the codes is on
    http://weblogs.macromedia.com/eanderson/archives/2004/12/preloader_in_fl.cfm
    I can only see the "Loading Your Application View . . . ",
    but can not see "LOADED:" or "TOTAL:" in the function
    setProgress().It seems that the function is never called.
    What's wrong?
    thanks in advance.

    The setProgress() method is only called when downloading the
    SWF from a
    remote location. Is your SWF on a server? You also need to
    clear the cache
    before each download.
    Glenn

  • Problem about custom package.

    Hi all,
    I am a new beginner. When I tested a program in a book, the complier cannot resolve MyString class. Can you teach me how to fix it? Thanks.
    Here's the code:
    The code of PackageSample.class:
    import com.BitC.test.*;
    public class PackageSample
         public static void main(String args[])
              MyString a_MyString = new MyString();
              char str[] = {'J','a','v','a',' ','2'};
              a_MyString.setData(str);
              System.out.println(a_MyString.getData());
    The code of MyString.class:
    package com.BitC.test;
    public class MyString
         protected char name[];
         public void setData(char i_name[])
              name = new char[i_name.length];
              System.arraycopy(i_name,0,name,0,i_name.length);
         public char[] getData()
              return name;

    This link may help.
    http://java.sun.com/docs/books/tutorial/java/interpack/packages.html
    The class MyString is part of a package named com.BitC.test so you need a directory structure that matches - a com directory that contains a BitC directory that contains a test directory that contains the MyString.class file. In addition, the directory that contains the com directory must be in your classpath.

  • Custom table - delivery class?

    I need to create a z-table to list the email-ids that I want to notify to, in case of program errors. Should I make the delivery class of this table 'C'? And is best practise to make the data transportable? Or should my users just enter data in each system.
    I am kind of confused...Could any of you please clear me on this concept of Deliver class please. Your help is very much appreciated.
    thanks!

    Vishnu,
    Did you try? I tried these things long back and documented the behavior
    May be you tried it very long back, indeed. Atleast for releases > ECC6.0 EhP3 client-independent customizing tables prompt for WB requests.
    ... C, G, and E will only trigger customizing requests ....
    Unfortunately you're wrong! Did you check the transaction FILE? All the tables involved are of Delv. Class 'G'; but still when you try to save a logical file it asks for a WB request, ever wondered why?
    Still not convinced, check [this|https://picasaweb.google.com/lh/photo/kBwoENEIkUTsGuJUTn9Q5tMTjNZETYmyPJy0liipFm0?feat=directlink]!
    Suhas Saha wrote. "Customizing TRs are raised for client-dependent tables & workbench for client-independent ones!"
    This was w.r.t customizing tables & not application tables, as you were talking about customizing tables in your previous response.
    I can create a table with MANDT assign delivery class A or S and can trigger workbench requests on it.
    I know it does. IMHO type 'A' tables are for storing master and/or transational data & it does not make sense to transport these data.  For e.g., BKPF is type 'A' & not transportable, but T001 is type 'C' & transportable.
    If i want to transport the data across my landscape i would make it 'C' & not 'A'.
    BR,
    Suhas

  • Event Alert on Custom Table not working

    Hi
    Custom table is registered in Custom schema, created synonym in apps and granted all priviliges to apps.
    Creates event alert based on insert on custom table, though custom table is getting populated from concurrent program event alert seems to be not firing
    not sure why is this happening.
    Thanks
    Kamalakar.G

    Hi,
    Please see these threads.
    Alerts -- Can we create Alerts on custom table under Custom Application?
    Re: Alerts -- Can we create Alerts on custom table under Custom Application?
    Table used in Event Alert
    Re: Table used in Event Alert
    Problem with Custom Table Registration
    Re: Problem with Custom Table Registration
    Thanks,
    Hussein

  • Customized Table is giving Short Dump .Want to extract data in Production S

    Hi ,
    I have a problem in customized table .Table is giving a data after trying to access 185th record.There is some problem in the table.But I want to pull out all the data from the table..Is it possible to download it .Pls suggest..
    Even If I put one select query also it is givning dump..
    Pls suggest some other technique to download it..
    Regards
    Arun.P

    Hi Arun,
    Where there you are using WHERE condition  in select statement while fetching the records?
    if yes means check for the fields are primary key, available in WHERE condition, or else create secondary index for those
    non Primary key Fields in WHERE condition.
    This may help you.
    Thanks and Regards,
    Prakash.K

  • Setting up event Alert on custom table

    I appologize for placing my question in probably the wrong forum, but I know you guys are the sharpest and I'm spent on this problem.
    Overview: I have a form that runs a report to print out some of the form's data. If the user wants to email that same data, after the print job is completed, the form updates a table with the output file name created by running the report. Here's where my problem comes in... I'm trying to create an event driven alert, but I get the below error when I go to save:
    Event Table : REPORT_HDRS
    ORACLE ID : APPS
    The listed ORACLE ID is missing the event table or does not have the correct privileges to Application Object Library or Oracle Alert objects.
    Please verify that the event table exists, or re-register the ORACLE ID with Application Object Library as necessary. Then re-enable (or disable)
    the event alert as desired.
    If the ORACLE ID is for a shared installation of an application, it may be normal for the event table to not be present.
    Any ideas as to what I'm missing would be greatly appreciated.

    Hi,
    Please see these threads.
    Alerts -- Can we create Alerts on custom table under Custom Application?
    Re: Alerts -- Can we create Alerts on custom table under Custom Application?
    Table used in Event Alert
    Re: Table used in Event Alert
    Problem with Custom Table Registration
    Re: Problem with Custom Table Registration
    Thanks,
    Hussein

  • Diff between custom table and cutomized table

    hi,
    can any one let me know the terms custom table and customized table is same or is there any difference in between these two.
    in case of any difference please let me know.
    regards

    hi,
    Customizing table is
    a very SPECIAL MASTER TABLE
    where VERY IMPORTANT RECORDS
    are maintained.
    2. Such records, affect calculations / flow / logic etc .
    3. Important thing about customizing table,
    is that it will ask for REQUEST NUMBER,
    whenever we try to add / modify any record in it.

  • Problem while saving date field in custom table

    Hi,
    Iam facing the following problem while saving a date field in custome table
    i have a date field zdate in which the value is 02082010.
    now when i try to insert this value in the custom table it is getting updated as 20/10/0208 , but it should be 08/02/2010
    How can i correct it..
    Regards
    Kumar

    just before saving u might have to use a string reverse FM and then save it..
    CALL FUNCTION 'STRING_REVERSE'
      EXPORTING
        STRING          = p_string
        LANG            = sy-langu
    IMPORTING
       RSTRING          = r_string
    EXCEPTIONS
       TOO_SMALL        = 1
       OTHERS           = 2

  • Problem while downloading file from custom table

    Hi All,
    Im trying to download the file from the custom table where i have stored the uploaded files through apex.
    I have created the download procedure as mentioned in the oracle docs ,
    And given the execute grant for public user.
    and calling that procedure by calling the URL -- #OWNER#.download_my_file?p_file=#ID#
    But im getting the below error
    Forbidden
    You don't have permission to access /pls/apex/owner.download_my_file on this server.
    Oracle-Application-Server-10g/10.1.2.0.2 Oracle-HTTP-Server Server at servername Port number
    Can any one tell whats the problem here.
    Thanks in advance
    regards,
    Arumugam KR

    Your function apex_util.get_blob_file_src under region, the first argument must be the name of page item anywhere in your application that is of type "file browse." So if your form for uploading the blob content is on page 11 and the file browse item is "P11_FILE_NAME" then your query would look like below:
    SELECT FILE_ID
         , FILE_NAME
          , CASE WHEN NVL(dbms_lob.getlength(BLOB_CONTENT),0) = 0
           THEN NULL
            ELSE
                  CASE WHEN attach_mimetype like 'image%'
                THEN '<img src="'||apex_util.get_blob_file_src('P11_FILE_NAME',id)||'" />'
                ELSE
                     '<a href="'||apex_util.get_blob_file_src('P11_FILE_NAME',id)||'">Download</a>'
               end
           END new_img
        FROM TABLE_NAME
    GET_BLOB_FILE_SRC FunctionAs an alternative to using the built-in methods of providing a download link, you can use the APEX_UTIL.GET_BLOB_FILE_SRC function. One advantage of this approach, is the ability to more specifically format the display of the image (with height and width tags). Please note that this approach is only valid if called from a valid Oracle Application Express session. Also, this method requires that the parameters that describe the BLOB to be listed as the format of a valid item within the application. That item is then referenced by the function.>
    [url http://docs.oracle.com/cd/E14373_01/apirefs.32/e13369/apex_util.htm]GET_BLOB_FILE_SRC

Maybe you are looking for

  • Compra de frete para revenda - CTe de entrada

    Pessoal, boa tarde! Tenho o seguinte processo na empresa: Temos um armazém onde presto serviço de armazenagem (materiais de terceiros) e transporte, meus clientes (dono do estoque) solicitam a entrega de seus produtos no cliente deles. Até ai tudo be

  • Spry validation problem for long forms

    I used the Spry Validation Widgets for my form validation. It works great, BUT the problem is that if you have a very long form and the user doesn't fill in one of the top required fields, it doesn't scroll the browser back up to the required field,

  • Highlighted Photo - Does Not Display

    HELP! (Aperture 2.0.1) This just started happening... When I'm working in the Aperture library (within any project), After about five or so minutes of use the viewer just stops displaying the currently selected photo. I can click on any photo, but th

  • TOC problem; lost Search and Keyword boxes

    I inherited a Robohelp X5 project that was originally started by a person very familiar with these types of programs, then ultimately messed up by someone who knew nothing about them or the content. I spent most of my time re-writing and updating the

  • Shared objects in servlet?

    Consider this code snippet public class MyServlet extends HttpServlet {   //declare session object private HttpSession session; public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { session = req.