Add button to unused space in JTableHeader

I have modified my JTable so that I can have multiple rows of column headers. I did this by extending BasicTableHeaderUI. In my particular instance, the first column of the table will never have more than one row in the header (unlike other implementations of multi-row headers I have seen, my column headers don't automatically fill upwards to take up all usable space in the header). So, I have "unused" space in the header above the first column.
I would like to put some buttons there that are relevant to the table, but so far every effort to do so has failed.
In the SSCCE below I have created a very stripped down version of my TableHeaderUI. It doesn't contain any of the code to create multiple row headers, it just pushes down the standard column headers to create some space. I try adding a button to the rendererPane, but it doesn't show up. There is a commented out line that paints the button which does work in terms of showing the button, but that's probably not the right way to do this (and the button doesn't work anyway).
So, why isn't the button showing up? Am I doing this the right way (i.e. adding the button within the UI)? Thanks in advance for you help.
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Enumeration;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.plaf.basic.BasicTableHeaderUI;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
public class HeaderButtonTable extends JPanel {
     public HeaderButtonTable() {
          String[] colNames = {"column 1", "column2", "column3"};
          Object[][] data = {{"a","b","c"},{"d","e","f"}};
          JTable table = new JTable(data, colNames);
          table.setPreferredScrollableViewportSize(new Dimension(400,100));
          table.setFillsViewportHeight(true);
          table.getTableHeader().setUI(new ButtonHeaderUI());
          JScrollPane scrollPane = new JScrollPane(table);
          add(scrollPane);
     public class ButtonHeaderUI extends BasicTableHeaderUI {
          public void paint(Graphics g, JComponent c) {
               Rectangle clip = g.getClipBounds();
               Point left = clip.getLocation();
               Point right = new Point( clip.x + clip.width - 1, clip.y );
               TableColumnModel cm = header.getColumnModel();
               int cMin = header.columnAtPoint(left);
               int cMax = header.columnAtPoint(right);
               if (cMin == -1) cMin =  0;
               if (cMax == -1) cMax = cm.getColumnCount()-1;
               TableColumn draggedColumn = header.getDraggedColumn();
               int columnWidth;
               Rectangle cellRect = header.getHeaderRect(cMin);
               TableColumn aColumn;
               for(int column = cMin; column <= cMax ; column++) {
                    aColumn = cm.getColumn(column);
                    columnWidth = aColumn.getWidth();
                    cellRect.width = columnWidth;
                    if (aColumn != draggedColumn) {
                         paintCell(g, cellRect, column);
                    cellRect.x += columnWidth;
              JButton test = new JButton("test");
              test.addActionListener(new ActionListener(){
                    public void actionPerformed(ActionEvent e) {
                         System.out.println("pressed");
              test.setBounds(2, 2, 60, 15);
              rendererPane.add(test);  //why isn't this showing up?
              //this line will display the button, but button doesn't work
//          rendererPane.paintComponent(g, test, header, 2, 2, 60, 15);
          private Component getHeaderRenderer(int columnIndex) {
               TableColumn aColumn = header.getColumnModel().getColumn(columnIndex);
               TableCellRenderer renderer = aColumn.getHeaderRenderer();
               if (renderer == null) renderer = header.getDefaultRenderer();
               return renderer.getTableCellRendererComponent(header.getTable(),
                    aColumn.getHeaderValue(), false, false, -1, columnIndex);
          private void paintCell(Graphics g, Rectangle cellRect, int columnIndex) {
               Component component = getHeaderRenderer(columnIndex);
               rendererPane.paintComponent(g, component, header,
                    cellRect.x, cellRect.y + 30, cellRect.width,
                    cellRect.height - 30, true);
          public Dimension getPreferredSize(JComponent c) {
               long width = 0;
               Enumeration enumeration = header.getColumnModel().getColumns();
               while (enumeration.hasMoreElements()) {
                    TableColumn aColumn = (TableColumn)enumeration.nextElement();
                    width = width + aColumn.getPreferredWidth();
               return new Dimension((int)width, 60);
     public static void main(String[] args) {
          JFrame frame = new JFrame();
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.add(new HeaderButtonTable());
          frame.pack();
          frame.setVisible(true);
}

Yes, I've seen similar links/posts about how to activate buttons in the header of a table, but those do it by adding listeners to the renderer. My buttons would be directly in the CellRendererPane that is the container for the table header. I would have thought that by putting the button directly in the Cell RendererPane that it would have nothing to do with the rest of the table header. CellRendererPane extends Container. Is it not possible to put a JButton in a Container? JFrame extends indirectly from Container and you can add buttons to that.
Edited by: Bob.B on Oct 28, 2009 10:57 PM

Similar Messages

  • How to add button in reuse_alv not in gui status

    hi guys,
    my question how can i add button to reuse_alv not in gui_status or pf_status ? and also i have an internal table which contains a checkbox field when user select one or more check box and push button , new table will be sended to batch input program.how can i do add button part, the rest of it is done.?

    Hi,The following sample report ZUS_SDN_ALV_BUTTON_CLICK_LTXT shows a possible way how to handle the BUTTON_CLICK event in order to retrieve a longtext for a ALV entry. Please note that for the sake of simplicity I have choosen an obsolete function module for text editing (only enter numerical values otherwise the function module crashes).
    *& Report ZUS_SDN_ALV_BUTTON_CLICK_LTXT
    *& Screen '0100' contains no elements.
    *& ok_code -> assigned to GD_OKCODE
    *& Flow logic:
        * PROCESS BEFORE OUTPUT.
        * MODULE STATUS_0100.
        * PROCESS AFTER INPUT.
        * MODULE USER_COMMAND_0100.
    *& PURPOSE: Demonstrate event BUTTON_CLICK for entering long text
    REPORT zus_sdn_alv_button_click_ltxt.
    TYPE-POOLS: icon.
    TYPES: BEGIN OF ty_s_outtab.
    INCLUDE TYPE knb1.
    TYPES: button TYPE iconname.
    TYPES: line TYPE bapi_line.
    TYPES: END OF ty_s_outtab.
    TYPES: ty_t_outtab TYPE STANDARD TABLE OF ty_s_outtab
    WITH DEFAULT KEY.
    DATA:
    gd_okcode TYPE ui_func,
    gd_repid TYPE syst-repid,
    go_docking TYPE REF TO cl_gui_docking_container,
    go_grid TYPE REF TO cl_gui_alv_grid,
    gt_fcat TYPE lvc_t_fcat,
    gt_variant TYPE disvariant,
    gs_layout TYPE lvc_s_layo.
    DATA:
    gs_outtab TYPE ty_s_outtab,
    gt_outtab TYPE ty_t_outtab.
        * CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
    PUBLIC SECTION.
    CLASS-METHODS:
    handle_button_click FOR EVENT button_click OF cl_gui_alv_grid
    IMPORTING
    es_col_id
    es_row_no
    sender.
    ENDCLASS. "lcl_eventhandler DEFINITION
        * CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
    METHOD handle_button_click.
        * define local data
    DATA:
    ld_answer(1) TYPE c,
    ls_outtab TYPE ty_s_outtab.
    CHECK ( sender = go_grid ).
    READ TABLE gt_outtab INTO ls_outtab INDEX es_row_no-row_id.
    " Note: This function module is obsolete and crashes if
    " non-numerical values are entered. Choose a more
    " appropriate way of entering the longtext.
    CALL FUNCTION 'POPUP_TO_GET_VALUE'
    EXPORTING
    fieldname = 'LINE'
    tabname = 'BAPITGB'
    titel = 'Enter Longtext'
    valuein = ls_outtab-line
    IMPORTING
    answer = ld_answer
    valueout = ls_outtab-line
    EXCEPTIONS
    fieldname_not_found = 1
    OTHERS = 2.
    IF sy-subrc 0.
        * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    IF ( ld_answer NE 'C' ). " 'C' = cancel
    MODIFY gt_outtab FROM ls_outtab INDEX es_row_no-row_id
    TRANSPORTING line.
    ENDIF.
        * Triggers PAI of the dynpro with the specified ok-code
    CALL METHOD cl_gui_cfw=>set_new_ok_code( 'REFRESH' ).
    ENDMETHOD. "handle_button_click
    ENDCLASS. "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
    SELECT * FROM knb1
    INTO CORRESPONDING FIELDS OF TABLE gt_outtab
    WHERE bukrs = '1000'.
    CLEAR: gs_outtab.
    gs_outtab-button = icon_change_text.
    MODIFY gt_outtab FROM gs_outtab
    TRANSPORTING button LINE
    where ( bukrs NE space ). " modify all lines
    PERFORM build_fieldcatalog.
        * Create docking container
    CREATE OBJECT go_docking
    EXPORTING
    parent = cl_gui_container=>screen0
    ratio = 90
    EXCEPTIONS
    OTHERS = 6.
    IF sy-subrc 0.
        * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
        * Create ALV grids
    CREATE OBJECT go_grid
    EXPORTING
    i_parent = go_docking
    EXCEPTIONS
    OTHERS = 5.
    IF sy-subrc 0.
        * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
        * Set event handler
    SET HANDLER: lcl_eventhandler=>handle_button_click FOR go_grid.
        * Display data
    gs_layout-grid_title = 'Customers'.
    CALL METHOD go_grid->set_table_for_first_display
    EXPORTING
    is_layout = gs_layout
    CHANGING
    it_outtab = gt_outtab
    it_fieldcatalog = gt_fcat
    EXCEPTIONS
    OTHERS = 4.
    IF sy-subrc 0.
        * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
        * Link the docking container to the target dynpro
    gd_repid = syst-repid.
    CALL METHOD go_docking->link
    EXPORTING
    repid = gd_repid
    dynnr = '0100'
        * CONTAINER =
    EXCEPTIONS
    OTHERS = 4.
    IF sy-subrc 0.
        * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
        * NOTE: dynpro does not contain any elements
    CALL SCREEN '0100'.
        * Flow logic of dynpro (does not contain any dynpro elements):
    *PROCESS BEFORE OUTPUT.
        * MODULE STATUS_0100.
    *PROCESS AFTER INPUT.
        * MODULE USER_COMMAND_0100.
    END-OF-SELECTION.
    *& Module STATUS_0100 OUTPUT
        * text
    MODULE status_0100 OUTPUT.
    SET PF-STATUS 'STATUS_0100'. " contains push button "DETAIL"
        * SET TITLEBAR 'xxx'.
    CALL METHOD go_grid->refresh_table_display
        * EXPORTING
        * IS_STABLE =
        * I_SOFT_REFRESH =
        * EXCEPTIONS
        * FINISHED = 1
        * others = 2
    IF sy-subrc 0.
        * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDMODULE. " STATUS_0100 OUTPUT
    *& Module USER_COMMAND_0100 INPUT
        * text
    MODULE user_command_0100 INPUT.
    CASE gd_okcode.
    WHEN 'BACK' OR
    'END' OR
    'CANC'.
    SET SCREEN 0. LEAVE SCREEN.
        * Refresh -> pass PAI and PBO where flushing occurs
    WHEN 'REFRESH'.
    WHEN OTHERS.
    ENDCASE.
    CLEAR: gd_okcode.
    ENDMODULE. " USER_COMMAND_0100 INPUT
    *& Form BUILD_FIELDCATALOG
        * text
        * --> p1 text
        * <-- p2 text
    FORM build_fieldcatalog .
        * define local data
    DATA:
    ls_fcat TYPE lvc_s_fcat,
    lt_fcat TYPE lvc_t_fcat.
    REFRESH: gt_fcat.
    CLEAR: lt_fcat.
    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
    i_structure_name = 'KNB1'
    CHANGING
    ct_fieldcat = lt_fcat
    EXCEPTIONS
    OTHERS = 99.
    IF sy-subrc 0.
        * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    APPEND LINES OF lt_fcat TO gt_fcat.
    CLEAR: lt_fcat.
    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
    i_structure_name = 'BAPITGB'
    CHANGING
    ct_fieldcat = lt_fcat
    EXCEPTIONS
    OTHERS = 99.
    IF sy-subrc 0.
        * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    READ TABLE lt_fcat INTO ls_fcat
    WITH KEY fieldname = 'LINE'.
    IF ( syst-subrc = 0 ).
    INSERT ls_fcat INTO gt_fcat INDEX 4.
    ENDIF.
    CLEAR: lt_fcat.
    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
    i_structure_name = 'ICON'
    CHANGING
    ct_fieldcat = lt_fcat
    EXCEPTIONS
    OTHERS = 99.
    IF sy-subrc 0.
        * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    READ TABLE lt_fcat INTO ls_fcat
    WITH KEY fieldname = 'NAME'.
    IF ( syst-subrc = 0 ).
    ls_fcat-fieldname = 'BUTTON'.
    ls_fcat-style = cl_gui_alv_grid=>mc_style_button.
    INSERT ls_fcat INTO gt_fcat INDEX 4.
    ENDIF.
    LOOP AT gt_fcat INTO ls_fcat.
    ls_fcat-col_pos = syst-tabix.
    MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
    ENDLOOP.
    ENDFORM. " BUILD_FIELDCATALOG[/code]
    Reward If Found Useful.

  • No "Add" button for new SDKs!

    OK, I'm trying to add the new 3.4 SDK to my Flex Builder 3 and I'm trying to follow the directions that I found here: http://blog.flexexamples.com/2008/08/01/downloading-and-installing-flex-sdk-builds-from-op ensourceadobecom/
    But I don't have an "Add" button anywhere on the Flex - Installed Flex SDK.... I have Reset SDK List and Apply and thats it.. nothing else... what am I missing here?

    Thanks for the tips. I did some research myself and I believe I've found a solution of my own. What I do is click window>preferences and select the "general" section on the left. Then I close the preferences window and open it again. Then I resize this window so there is a lot of space on the right, where the buttons should appear and when my window is big enough I go to Flex>Installed Flex SDKs. Voila! I can see all the buttons I need Sounds crazy, I know but it works everytime.
    Oh, and I'm also running on a 64b system (win7), so I guess that's the main problem here.

  • Where did 30GB of unused space on my SSD main drive go?  I have a mid 2011 iMac that until yesterday had just 54GB of space occupied on the primary drive.  I imported 45 minutes of video from an SD card.  Could that have used up the space?

    Where did 30GB of unused space on my SSD main drive go?  I have a mid 2011 iMac that until yesterday had just 54GB of space occupied on the primary drive.  I imported 45 minutes of video from an SD card.  Could that have used up the space?

    I added an SSD to my 27" 2011 iMac.  Although Sahidus is absolutely correct, it is much easier to add an SSD replacing the optical drive, it wasn't that bad to add it using an entirely seperate cable using SATA-III.  To me it is worth the extra hassle to install a SATA-III SSD.  This is where you are going to get maximum performance.
    Although it appears complicated, if you go slow, the procedure to install an SSD drive isn't too bad.  It takes at most 3 hours, as long as you are prepared and have all the parts and tools.
    http://www.btobey.com/learn/imac-ssd-install.php
    This describes how I did it.  Now I get awesome data performance from my iMac!
    I think the 21.5" may be more difficult to find where to place the SSD.  But im sure it is possible.  Just be creative.

  • OBIEE - add button for exporting report into specified folder

    Hi all,
    How do I add button for exporting report into specified folder?
    See example below (this is print screen from working OBIEE report)
    http://s9.postimage.org/xqs9cellb/BI_report_export.png
    Oracle Business Intelligence 11.1.1.6.0

    What version of Crystal Reports are you using?  Any service packs or hot fixes installed?
    Can you open other xls files with 2007?  
    Have you ever exported to excel before?
    I export to -excel (97-2003) data only- and open the files with Excel 2007 with no problems. Excel 2007 complains about the old format (xls) and wants to convert it to the new excel format. I alsways ignor it.
    Maybe the 'garbage' you are seeing is because the layout of your crystal report is not working for the export. Is all the data there but you have extra cells and/or lines, or the data is pushed to the left? I find that I must have the fields packed tightly with no space between them and no space above or below the fields, or I get extra cells between and lines above or below them.
    Most of my exports are detail lines with a single line header and columns are set to match the detail line. When exporting multiple lines where the fields do not line up exactly with the ones above them, I may use one or more empty text fields that matches the size of the fields above them to fill the empty space. Sort of like:
    line 1:{field1.}{field2...}{field 3}
    line 2:(text...}{text.....}{field 4)
    And you may need to turn off 'can grow' on all fields as they may cause miss-alignment. All the data will be there when you export it, even what you can not see in Crystal. You will just need to format the cells in Excel to see it.
    Debi  (hi Don)

  • Add data to the table in the database with the use of add button

    The name of my database is Socrates.
    The name of the table in the database is Employees
    I want to be able to add data to the database. i am presently working on the add button such that when i enter date into the textfield and press the add button it should automatically register in the table.
    The error upon compilation is with this line of code
    If (ae.getSource() == jbtnA)// it says that ";" is expected
    Below is the entire code
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Mainpage extends JFrame implements ActionListener
         JTextField jFirstName = new JTextField(15);
         JTextField jSurname = new JTextField(12);
         JTextField jCity = new JTextField(10);
         JTextField jCountry = new JTextField(12);
         JTextField jSSN = new JTextField(8);
         JLabel jFirstLab = new JLabel("First Name");
         JLabel jSurnameLab = new JLabel("Surname");
         JLabel jCityLab = new JLabel("City");
         JLabel jCountryLab = new JLabel("Country");
         JLabel jSSNLab = new JLabel("Social Security Number (SSN)");
         JButton jbtnA = new JButton ("Add");
         JButton jbtnPrv = new JButton ("Previous");
         JButton jbtnNt = new JButton ("Next");
         JButton jbtnDl= new JButton ("Delete");
         JButton jbtnSrch = new JButton ("Search");
         public Mainpage (String title)
              super (title);
              Container cont = getContentPane();
              JPanel pane1 = new JPanel();
              JPanel pane2 = new JPanel();
              JPanel pane3 = new JPanel();
              pane1.setLayout (new GridLayout (0,1));
              pane2.setLayout (new GridLayout(0,1));
              pane3.setLayout (new FlowLayout());
              pane1.add(jFirstLab);
              pane1.add(jSurnameLab);     
              pane1.add(jCityLab);
              pane1.add(jCountryLab);
              pane1.add(jSSNLab);
              pane2.add(jFirstName);
              pane2.add(jSurname);
              pane2.add(jCity);
              pane2.add(jCountry);
              pane2.add(jSSN);
              pane3.add(jbtnA);
              pane3.add(jbtnPrv);
              pane3.add(jbtnNt);
              pane3.add(jbtnDl);
              pane3.add(jbtnSrch);
              cont.add(pane1, BorderLayout.CENTER);
              cont.add(pane2, BorderLayout.LINE_END);
              cont.add(pane3, BorderLayout.SOUTH);
              jFirstName.addActionListener(this);
              jSurname.addActionListener(this);
              jCity.addActionListener(this);
              jCountry.addActionListener(this);
              jSSN.addActionListener(this);
              jbtnA.addActionListener(this);
              jbtnPrv.addActionListener(this);
              jbtnNt.addActionListener(this);
              jbtnDl.addActionListener(this);
              jbtnSrch.addActionListener(this);
              validate();
              setVisible(true);
              setDefaultCloseOperation(EXIT_ON_CLOSE);
              pack();
              setResizable(false);
         public void actionPerformed(ActionEvent ae)
                   If (ae.getSource() == jbtnA)
                                    fst = jFirstName.getText();
                        srn = jSurname.getText();
                        cty = jCity.getText();
                        cnty = jCountry.getText();
                        int sn =
    Interger.parseInt(jSSN.getText());
                                    String ad = "Insert into Employees
    (Firstname,Surname,City,Country,SSN)" +
    "values('"fst"','"srn"','"cty"','"cnty"','"sn"')";
                        Statement stmt = con.createStatment();
                        int rowcount = stmt.executeUpdate(ad);
                        JOptionPane.showMessageDialog("Your
    details have been registered");
                        Statement stmt = con.createStatment();
                        int rowcount = stmt.executeUpdate(ad);
    public static void main (String args[])
              Mainpage ObjFr = new Mainpage("Please fill this
    registration form");
              try
                   Class.forname("sun.jdbc.odbc.JdbcOdbcDriver");
                   String plato = "jdbc:odbc:socrates";
                   Connection con =
    DriverManager.getConnection(plato);
              catch(SQLException ce)
                   System.out.println(ce);
    }

    i have restructured the code, but the following line of code is giving error:
    String plato = jdbc:odbc:socrates;
    the entire code is below:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.sql.*;
    public class Mainpage extends JFrame implements ActionListener
         JTextField jFirstName = new JTextField(15);
         JTextField jSurname = new JTextField(12);
         JTextField jCity = new JTextField(10);
         JTextField jCountry = new JTextField(12);
         JTextField jSSN = new JTextField(8);
         JLabel jFirstLab = new JLabel("First Name");
         JLabel jSurnameLab = new JLabel("Surname");
         JLabel jCityLab = new JLabel("City");
         JLabel jCountryLab = new JLabel("Country");
         JLabel jSSNLab = new JLabel("Social Security Number (SSN)");
         JButton jbtnA = new JButton ("Add");
         JButton jbtnPrv = new JButton ("Previous");
         JButton jbtnNt = new JButton ("Next");
         JButton jbtnDl= new JButton ("Delete");
         JButton jbtnSrch = new JButton ("Search");
         Statement stmt;
            String ad;
            public Mainpage (String title)
              super (title);
              Container cont = getContentPane();
              JPanel pane1 = new JPanel();
              JPanel pane2 = new JPanel();
              JPanel pane3 = new JPanel();
              pane1.setLayout (new GridLayout (0,1));
              pane2.setLayout (new GridLayout(0,1));
              pane3.setLayout (new FlowLayout());
              pane1.add(jFirstLab);
              pane1.add(jSurnameLab);     
              pane1.add(jCityLab);
              pane1.add(jCountryLab);
              pane1.add(jSSNLab);
              pane2.add(jFirstName);
              pane2.add(jSurname);
              pane2.add(jCity);
              pane2.add(jCountry);
              pane2.add(jSSN);
              pane3.add(jbtnA);
              pane3.add(jbtnPrv);
              pane3.add(jbtnNt);
              pane3.add(jbtnDl);
              pane3.add(jbtnSrch);
              cont.add(pane1, BorderLayout.CENTER);
              cont.add(pane2, BorderLayout.LINE_END);
              cont.add(pane3, BorderLayout.SOUTH);
              jFirstName.addActionListener(this);
              jSurname.addActionListener(this);
              jCity.addActionListener(this);
              jCountry.addActionListener(this);
              jSSN.addActionListener(this);
              jbtnA.addActionListener(this);
              jbtnPrv.addActionListener(this);
              jbtnNt.addActionListener(this);
              jbtnDl.addActionListener(this);
              jbtnSrch.addActionListener(this);
              validate();
              setVisible(true);
              setDefaultCloseOperation(EXIT_ON_CLOSE);
              pack();
              setResizable(false);
              try
                   Class.forname(sun.jdbc.odbc.JdbcOdbcDriver);
                   String plato = jdbc:odbc:socrates;
                   Connection con = DriverManager.getConnection(plato);
                   stmt = con.createStatment();
              catch(SQLException ce)
                   System.out.println(ce);
              catch(ClassNotFoundException ce)
                   System.out.println(ce);
         public void actionPerformed(ActionEvent ae)
                   try
                        if(ae.getSource().equals(jbtnA))
                                         fst = jFirstName.getText();
                             srn = jSurname.getText();
                             cty = jCity.getText();
                             cnty = jCountry.getText();
                             int sn = Interger.parseInt(jSSN.getText());
                                         ad = "Insert into Employees
    values('"+fst+"',"+srn+"','"+cty+"','"+cnty+"','"+sn+"')";
                             stmt.executeUpdate(ad);
                             JOptionPane.showMessageDialog(this, "Your details have been
    registered");
                   catch(SQLException ce)
                        System.out.println(ce);
    public static void main(String args[])
              Mainpage ObjFr = new Mainpage("Please fill this registration form");
    }

  • How to add button in ALV report (Class method )?

    Hello experts,
    I have developed one ALV report using classes.
    I want to add one more  button on the report like already is there named DISPLQUA
    How ca i do that here?
    Following the code of CLASS definition & implimentation
    CLASS lcl_handle_events DEFINITION.
      PUBLIC SECTION.
        METHODS:
          handle_on_user_command FOR EVENT added_function OF cl_salv_events
            IMPORTING e_salv_function.
    ENDCLASS.                    "lcl_handle_events DEFINITION
          CLASS lcl_handle_events IMPLEMENTATION
    CLASS lcl_handle_events IMPLEMENTATION.
      METHOD handle_on_user_command.
        CASE e_salv_function.
          WHEN 'DISPLQUA'.
            PERFORM show_quant_record.
         WHEN 'DISPQM03'.                                " Here i want to add button
           PERFORM display_quality_notification.
          WHEN OTHERS.
        ENDCASE.
      ENDMETHOD.                    "handle_on_user_command
    ENDCLASS.                    "lcl_handle_events IMPLEMENTATION

    HI Ronny.
    Code snippet for reference.
    CLASS LCL_EVENT_HANDLER DEFINITION .
      PUBLIC SECTION.
        METHODS :
    *--Toolbar control
          HANDLE_TOOLBAR FOR EVENT TOOLBAR
            OF CL_GUI_ALV_GRID IMPORTING E_OBJECT
                                         E_INTERACTIVE,
    ENDCLASS
    CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
    *--handle toolbar
      METHOD HANDLE_TOOLBAR.
    * append a separator to normal toolbar
        CLEAR G_TOOLBAR.
        G_TOOLBAR-BUTN_TYPE = 3.
        APPEND G_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
        CLEAR G_TOOLBAR.
        G_TOOLBAR-FUNCTION = 'SAVE'.
        G_TOOLBAR-ICON = ICON_SYSTEM_SAVE.
        G_TOOLBAR-BUTN_TYPE = 0.
        G_TOOLBAR-QUICKINFO = 'Save the Customer'(203).
        APPEND G_TOOLBAR TO E_OBJECT->MT_TOOLBAR.
      ENDMETHOD.                    "HANDLE_TOOLBAR
    Hope this helps.
    Gary.
    <REMOVED BY MODERATOR>
    Edited by: Alvaro Tejada Galindo on Apr 7, 2008 5:41 PM

  • Clicking add button to display the values

    requrement is like this
    Could anyone give suggestions with some code .
    we have lovs using this one we are searching for the value(ex emloyee name) that value is returned to the base page filed like message text input . we have add button, when ever we click that button to display the value(ex employee name ,desigantion this is from another table )on that same page.

    I could not understand your requirement. Post more details of the requirement with specific details.
    Message was edited by:
    Srini

  • Add button to the transaction SM30

    HI
       Whether it is possible to add a buton to application tool bar in the transaction SM30.
    help reg this.

    Hi,
    Yes, it is possible to add button for the transaction SM30.
    This is possible through Menu exit.
    Procedure for Menuexit:-
    Go to SM30 ->System -> Status
    Repository data -> Transaction -> Double click on it
    Copy package name
    Go to SMOD
    Press F4 then a popup will open
    Click on information system
    Enter package name and press Enter
    Then we will get Exit
    Put cursor on that exit and press Enter
    Go to change mode and save it.
    Go to CMOD or alternatively we can use the path tools -> ABAP/4 Workbench -> Utilities -> Enhancements ->Project Management
    Specify Project name in the enhancement text box
    Click on Create icon on the application toolbar.
    Enter description for the project and save it
    Click on Enhancement Assignment button on the application toolbar
    Give Exit  and save it
    Go to Components on the application toolbar
    Double Click on MENUS001
    Write function text which we want to add to menu item and save it with an request      number
    Double Click on Exit and write code there to display menu item in the screen
    Activate the include program and finally activate the project.
    Please reward points if helpful.

  • Add button to SNC screen

    Dear Experts,
    I have a requirement in SNC system.
    Requirement: Add a new button on screen Due List for Purchasing Documents, if we click on the button it has to open a new screen where we should have a file browse filed, browse and upload buttons to upload ASN details from presentation server.
    am using,
    WebDynpro Component: /SCF/UIWD
    WebDynpro Application: /scf/snc_s
    I have used following details to add button and acheived to add button alone, but how can I assing action/event, where can I create the screen, where can I write code and how can I assign this to button action.
    ApplicationID: ICH
    ScreenID: DUELIST
    ComponentID: DLRLTLR1
    Please help me out, almost from 2 weeks am doing R and D on it.
    Thanks in advance
    Pallu

    Thanks for your inputs Sai, but here the screen design is not static as normal webdynpro, normally we add a button and in OnAction property we create new action and we write code for the corresponding method, but in my case (expecially in SNC) everything I need to do with configurations, the transaction for screeen configuraitons is /N/SCF/SCREENCFG, and the BADI which I used for adding button is /SCF/UIMDL_APPCUST, you can find these details only in SNC (Supply Network and Collaboration) system.
    Please try with inputs again.
    Thanks again in advance!
    Pallu!!

  • I just installed itunes 11.1.5.5.  Now the format in Itunes is changed.  when I am trying to add music to my iphone, there is no longer an add button under the Iphone device.  Why did they have to change this?  Can anyone help, Im tryiong to add music.

    How do you add musci to the Iphone?  I just installed itunes 11.1.5.5.  Now the format in Itunes is changed.  when I am trying to add music to my iphone, there is no longer an add button under the Iphone device.  Why did they have to change this?  Can anyone help, Im tryiong to add music.

    Correct.  When you purchase devices, they would have stated the OS they needed to work, on the box.  This can be overlooked, but it is very important to check when purchasing. 
    You current OS, is so old, that they technology build into the new devices, is not something your OS understands.  It didn't exist when your OS was created, and therefore you need to upgrade the OS to work with the newer technology of these devices.
    10.6 software is not downloadable.  You must purchase a DVD disc.  You can order it from the on-line apple store
    - http://store.apple.com/us/product/MC573/mac-os-x-106-snow-leopard.

  • Add Button Column in IR

    Hi,
    I have created an Interactive report on a table. I want to add two buttons in each row: Accept and Reject, so that i can change the status(db column) of the corresponding record on button action.
    How can I do so?

    Hi poojaC,
    Try the below code,
    i am giving the idea to add buttons..may be this is not the way you want.
    step1
    -- put this code in report region
    select "ROWID",
    '<input type="button" value="Accept"  onclick="func('||EMPNO||')">'  as "Accept",
    '<input type="button" value="Reject"  onclick="func('||EMPNO||')">'  as "Reject",
    "EMPNO",
    "ENAME",
    "JOB",
    "MGR",
    "HIREDATE",
    "SAL",
    "COMM",
    "DEPTNO"
    from "#OWNER#"."EMP"
    -- edit the Accept and reject column and change Display type to "standard report column"Step 2 : create one function in page header like
    -- here you can execute your process on button action
    <script>
    function func(id)
    alert(id);
    </script>Hope this will give you some idea.
    Regards,
    Jitendra

  • Add button inactive in Match record step in Import manager

    Hello,
    In the Main table, I want to see the country data as 'US; United States' in country field.
    I have made both 'country code' and 'country description' as display fields in the country flat lookup table.
    When I load country code and country description from import manager from an excel file, the 'Add' button in Match records step is inactive for both the fields.
    How can I do the matching in import manager without sacrificing my requirement of showing country as 'US; United States' in main table ?
    Thanks,

    answer to this question is already available in forum.

  • How can I add buttons that do different things to each row of an rpt result

    Hi there,
    I'm trying to figure out how to add buttons to each row of a report. Here is the scenario:
    report query returns a set of data that needs to be "approved". The options are "Append", "Replace", or "Reject" (I want to make the results look like so:)
    Person1 today blah, blah blah... Append button Replace button Reject button
    Person2 today blah, blah, blah... Append button Replace button Reject button
    PersonA today something, blah... Append button Replace button Reject button
    and so on.
    I'd like to set up the page so that there is an append, replace, reject button for each row returned by the report. So when the "Approver" clicks on the append button, something happens for that row, etc. How does one do this? So far I can only get the buttons to show up in the region. I also thought it might be possible to somehow turn the append, replace, reject text into links that called a plsql proceedure that would handle the action, but I'm not having any success with that idea either.
    Edited by: user10361829 on Sep 29, 2009 12:10 PM

    What I've done is make my report query as follows:
    select field_a, field_b, field_c, 'Append', 'Replace', 'Reject'
    from table_x
    where field y = :PX_ID
    That gives me the words (append, replace, reject) in the report. Then I go to the report attributes section and make a link out of the columns (append, replace, reject) so far, so good.
    Next question is how to make clicking on those links activate an update action on tableN. In the column_link section there is a box marked "Request" that looks like it might be relevant because Request is a term connected to buttons, but I've no idea how to use it. Or, can one use the tabluar form element section of the report attributes page to connect the Append (pseudo column) to an action? I've looked at your example (Sam) with the delete button, but what I really need to see is the Apex menu that sets it up because there are so many levels in the interface it is not intuitive (at least for me). I know exactly what I want it to look like but I'm missing the crucial step to get there... Thanks for your help so far.
    Column link section is described below :
    Column Link     Top
    Link Text      flashlight          
         [*Append*][Icon 1][Icon 2][Icon 3][Icon 4][Icon 5]
    Link Attributes      
    Target: *"Page in this application"*     Page: *10*     
    Reset Pagination
    Request Clear Cache      
    Name     Value
    Item 1      Px_page_item flashlight *#????#*          flashlight
    Item 2      flashlight          flashlight
    Item 3      flashlight          flashlight
    URL      
    Page Checksum

  • Can we add button in query region  along with go and clear

    Hi Friends,
    i have a requirement as below steps-
    1)i have developed search pgae by using query regiion
    2) in pgae,first we have search items,go and clear(submit buttons), table region.
    3)here go and clear buttons came automatically.
    4) i can able to add button in front of the page and end of the page.
    4) my requirement is i need to add one more button along with go and clear(here go and clear button are in between search items and table region) .
    5)i am not able to add button along with go and clear.
    Can any one know how to do this--
    Thanks in Advance
    vamshi

    Hi Vamshi,
    You can not create extra buttons in Standard Query region.
    Alternatively you can create your custom region for the search and there you can add a button. If you don't need advanced region, you can create the custom region in place of standard one.
    Anoop

Maybe you are looking for

  • Maximum Open Cursors Exceeded - Oracle & Java

    I am using NetBeans ( Forte 5) for developing an application with Oracle Database. My application makes use of executeUpdate, executeQuery statements inorder to access Database. After few insertions and deletions of data through the host language( Ja

  • Hierarchial query problem

    Hi, We are trying to convert some old sql code to using Hierarchical queries, but am finding that the connect by expression is causing some errors for us. I have tried to follow the managedEmployees example from the web site but am not getting the pa

  • How to have the library updated between two computers?

    I have two computers. One is running Windows XP(always on) with iTunes and the whole library in it. I share this iTune library wirelessly so that my MacBook Pro can access it. The problem is - whenever I update my library from one of this computers,

  • Backing file init method always called for proxy portlets

    Hello, We are currently using Weblogic Portal 10 MP1. Deployed within our Portal EAR is a local proxy portlet and attached to this proxy portlet is a backing file, which currently implements the init() and prerender() methods from the backing interfa

  • Motion effects in effects panel gone

    It seems like somehow the Motion effects in my effects panel have dissapeared. Any one knows how to fix this? It's weird that it would even be possible to remove this function, since it's a frequently used tool. I'm using Adobe Premiere CS5 Hope to h