How to add CheckBoxs to a scrollPane

I have a file I�m getting user info out of and finding certain information the
User enters, I�m making a query, I�m taking the found items and making an array of Checkboxes out of them witch is working my problem is adding the Checkboxes to the scroll Pane
public class Frame1 extends JFrame{
public static Panel listan = new Panel();
JCheckBox[] jCheckBox1 ;
JScrollPane scrollPane1 = new JScrollPane(list);
//other Window objects
//first method
private void jbInit() throws Exception {
//puts all window objects together
// Constructs user screen
list.setLayout(verticalFlowLayout1);
panel1.add(scrollPane1, new XYConstraints(118, 32, 128, 195));
// i have a find buttion that takes all infoamtion out of file
// and puts in an array then finds user enterd infomation
// this is just example code that just adds CheckBoxs to the scrollPane
// and is Basically the same way the other program does
// second method
void addcheckbox_actionPerformed(ActionEvent e) {
jCheckBox1 = new JCheckBox[50];
for (int i = 0; i < 50; i++) {
String checkboxText = ("Checkbox #: " + (i + 1));
jCheckBox1[i] = new JCheckBox(checkboxText);
for (int i = 0; i < 50; i++) {
list.add(jCheckBox1, null);
My problem is that I can�t add the checkboxes at the second method but it works in the first, I can add in the first because I initialize in the second.

If you want something to compile here is all my example code
I will incorporate it to my 30 page program
Here is what I want my code to do
package list;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;
import java.awt.Checkbox;
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2008</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
public class Frame1 extends JFrame {
  public static boolean ch=true;
  JPanel contentPane;
  GridLayout gridLayout1 = new GridLayout();
  JPanel panel1 = new JPanel();
  XYLayout xYLayout1 = new XYLayout();
  JButton jButton1;
  JButton jButton2;
  JButton addcheckbox;
  JCheckBox[] jCheckBox1 ;
  JScrollPane scrollPane1 = new JScrollPane();
  JPanel list = new JPanel();
  VerticalFlowLayout verticalFlowLayout1 = new VerticalFlowLayout();
  //Construct the frame
  public Frame1() {
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    try {
      jbInit();
    catch (Exception e) {
      e.printStackTrace();
  //Component initialization
// method one
  private void jbInit() throws Exception {
    contentPane = (JPanel)this.getContentPane();
    jButton1 = new JButton();
    jButton2 = new JButton();
    addcheckbox = new JButton();
    this.setContentPane(contentPane);
    this.setLocale(java.util.Locale.getDefault());
    this.setResizable(false);
    this.setSize(new Dimension(400, 300));
    this.setState(Frame.NORMAL);
    this.setTitle("Frame Title");
    contentPane.setOpaque(true);
    contentPane.setRequestFocusEnabled(true);
    contentPane.setLayout(gridLayout1);
    panel1.setLayout(xYLayout1);
    jButton1.setSelected(false);
    jButton1.setText("Print");
    jButton1.addActionListener(new Frame1_jButton1_actionAdapter(this));
    jButton2.setText("select all/none");
    jButton2.addActionListener(new Frame1_jButton2_actionAdapter(this));
    addcheckbox.setBorderPainted(true);
    addcheckbox.setText("add");
    addcheckbox.addActionListener(new Frame1_addcheckbox_actionAdapter(this));
    scrollPane1.setLocale(java.util.Locale.getDefault());
    list.setLayout(verticalFlowLayout1);
    contentPane.add(panel1, null);
    panel1.add(scrollPane1, new XYConstraints(118, 32, 128, 195));
    scrollPane1.getViewport().add(list, null);
    //scrollPane1.add(listan, null);
    panel1.add(jButton1, new XYConstraints(261, 92, 90, 39));
    panel1.add(jButton2,   new XYConstraints(262, 152, 108, 30));
    panel1.add(addcheckbox, new XYConstraints(25, 49, -1, 35));
  //Overridden so we can exit when window is closed
  protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if (e.getID() == WindowEvent.WINDOW_CLOSING) {
      System.exit(0);
  void jButton1_actionPerformed(ActionEvent e) {
    String checkprint = "selected:\n";
    for (int x = 0; x < jCheckBox1.length; x++) {
      if (jCheckBox1[x].isSelected()) {
         checkprint = checkprint + jCheckBox1[x].getText()+"\n";
    System.out.println(checkprint);
  void jButton2_actionPerformed(ActionEvent e) {
    for (int x = 0; x < jCheckBox1.length; x++) {
      if (ch == true) {
        jCheckBox1[x].setSelected(true);
      else{
        jCheckBox1[x].setSelected(false);
if (ch == true)
      ch=false;
    else
      ch=true;
//method two
  void addcheckbox_actionPerformed(ActionEvent e) {
    jCheckBox1 = new JCheckBox[50];
        for (int i = 0; i < 50; i++) {
          String checkboxText = ("Checkbox #: " + (i + 1));
          jCheckBox1[i] = new JCheckBox(checkboxText);
        for (int i = 0; i < 50; i++) {
         list.add(jCheckBox1, null);
class Frame1_jButton1_actionAdapter implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_jButton1_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
public void actionPerformed(ActionEvent e) {
adaptee.jButton1_actionPerformed(e);
class Frame1_jButton2_actionAdapter implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_jButton2_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
public void actionPerformed(ActionEvent e) {
adaptee.jButton2_actionPerformed(e);
class Frame1_addcheckbox_actionAdapter implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_addcheckbox_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
public void actionPerformed(ActionEvent e) {
adaptee.addcheckbox_actionPerformed(e);
}doesn�t work but if I take all of method two and put it in one it workspackage list;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;
import java.awt.Checkbox;
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2008</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
public class Frame1 extends JFrame {
public static boolean ch=true;
JPanel contentPane;
GridLayout gridLayout1 = new GridLayout();
JPanel panel1 = new JPanel();
XYLayout xYLayout1 = new XYLayout();
JButton jButton1;
JButton jButton2;
JButton addcheckbox;
JCheckBox[] jCheckBox1 ;
JScrollPane scrollPane1 = new JScrollPane();
JPanel list = new JPanel();
VerticalFlowLayout verticalFlowLayout1 = new VerticalFlowLayout();
//Construct the frame
public Frame1() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
jbInit();
catch (Exception e) {
e.printStackTrace();
//Component initialization
private void jbInit() throws Exception {
// this is the same code in method two
jCheckBox1 = new JCheckBox[50];
for (int i = 0; i < 50; i++) {
String checkboxText = ("Checkbox #: " + (i + 1));
jCheckBox1[i] = new JCheckBox(checkboxText);
for (int i = 0; i < 50; i++) {
list.add(jCheckBox1[i], null);
contentPane = (JPanel)this.getContentPane();
jButton1 = new JButton();
jButton2 = new JButton();
addcheckbox = new JButton();
this.setContentPane(contentPane);
this.setLocale(java.util.Locale.getDefault());
this.setResizable(false);
this.setSize(new Dimension(400, 300));
this.setState(Frame.NORMAL);
this.setTitle("Frame Title");
contentPane.setOpaque(true);
contentPane.setRequestFocusEnabled(true);
contentPane.setLayout(gridLayout1);
panel1.setLayout(xYLayout1);
jButton1.setSelected(false);
jButton1.setText("Print");
jButton1.addActionListener(new Frame1_jButton1_actionAdapter(this));
jButton2.setText("select all/none");
jButton2.addActionListener(new Frame1_jButton2_actionAdapter(this));
addcheckbox.setBorderPainted(true);
addcheckbox.setText("add");
addcheckbox.addActionListener(new Frame1_addcheckbox_actionAdapter(this));
scrollPane1.setLocale(java.util.Locale.getDefault());
list.setLayout(verticalFlowLayout1);
contentPane.add(panel1, null);
panel1.add(scrollPane1, new XYConstraints(118, 32, 128, 195));
scrollPane1.getViewport().add(list, null);
//scrollPane1.add(listan, null);
panel1.add(jButton1, new XYConstraints(261, 92, 90, 39));
panel1.add(jButton2, new XYConstraints(262, 152, 108, 30));
panel1.add(addcheckbox, new XYConstraints(25, 49, -1, 35));
//Overridden so we can exit when window is closed
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
void jButton1_actionPerformed(ActionEvent e) {
String checkprint = "selected:\n";
for (int x = 0; x < jCheckBox1.length; x++) {
if (jCheckBox1[x].isSelected()) {
checkprint = checkprint + jCheckBox1[x].getText()+"\n";
System.out.println(checkprint);
void jButton2_actionPerformed(ActionEvent e) {
for (int x = 0; x < jCheckBox1.length; x++) {
if (ch == true) {
jCheckBox1[x].setSelected(true);
else{
jCheckBox1[x].setSelected(false);
if (ch == true)
ch=false;
else
ch=true;
void addcheckbox_actionPerformed(ActionEvent e) {
class Frame1_jButton1_actionAdapter implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_jButton1_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
public void actionPerformed(ActionEvent e) {
adaptee.jButton1_actionPerformed(e);
class Frame1_jButton2_actionAdapter implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_jButton2_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
public void actionPerformed(ActionEvent e) {
adaptee.jButton2_actionPerformed(e);
class Frame1_addcheckbox_actionAdapter implements java.awt.event.ActionListener {
Frame1 adaptee;
Frame1_addcheckbox_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
public void actionPerformed(ActionEvent e) {
adaptee.addcheckbox_actionPerformed(e);
}Edited by: deme on Feb 27, 2008 6:48 AM
Edited by: deme on Feb 27, 2008 6:51 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Similar Messages

  • How to Add Checkbox and icon in ALVGRID

    Hi Experts,
      i have one Requirement. i need to add Checkbox, Selectall,icon(Unlock or inactive) infront of Contracts of ALV GRID.How to achive that.
    Thanks,
    Venkat.

    Hi
    For check box
    At declaring field catalog using structure LVC_S_FCAT
    mark CHECKBOX = 'X' and also EDIT = 'X'.
    For reference check below subroutine in program BCALV_EDIT_05.
    form build_fieldcat changing pt_fieldcat type lvc_t_fcat.
    data ls_fcat type lvc_s_fcat.
    call function 'LVC_FIELDCATALOG_MERGE'
    exporting
    i_structure_name = 'SFLIGHT'
    changing
    ct_fieldcat = pt_fieldcat.
    *§A2.Add an entry for the checkbox in the fieldcatalog
    clear ls_fcat.
    ls_fcat-fieldname = 'CHECKBOX'.
    * Essential: declare field as checkbox and
    * mark it as editable field:
    ls_fcat-checkbox = 'X'.
    ls_fcat-edit = 'X'.
    * do not forget to provide texts for this extra field
    ls_fcat-coltext = text-f01.
    ls_fcat-tooltip = text-f02.
    ls_fcat-seltext = text-f03.
    * optional: set column width
    ls_fcat-outputlen = 10.
    append ls_fcat to pt_fieldcat.
    endform.
    For Icon:
    CONSTANTS:
         icon_id_failure            LIKE icon-id   VALUE ' ((Content component not found.)) @',
         icon_id_okay              LIKE icon-id   VALUE ' ((Content component not found.)) @'.
    TYPES: BEGIN OF ls_tab,
           matnr LIKE equi-matnr,
           maktx LIKE makt-maktx,
           b_werk  LIKE equi-werk,
           b_lager LIKE equi-lager,
           lgobe LIKE t001l-lgobe,
           sernr LIKE equi-sernr,
           icon LIKE icon-id,
           objnr LIKE equi-objnr,
          END OF   ls_tab.
    *Table that display the data for the ALV.
    DATA: itab  TYPE ls_tab OCCURS 0 WITH HEADER LINE.
        PERFORM get_h_date .
        IF h_date => sy-datum .
          itab-icon = icon_id_okay.
        ELSE .
          itab-icon = icon_id_failure.
         ENDIF.
    Regards
    Sudheer

  • How to add checkboxes to frame

    So I have two classes in my package. I am having trouble adding the checkbox group to my frame. I got it to add to my applet but I can not figure out how to add it to my frame. Here is what I have so far. When I run this program it puts the checkboxes in my applet and not in my frame.
    this is my painter class:
    package pt;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2006</p>
    * <p>Company: </p>
    * @author unascribed
    * @version 1.0
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    public class painter extends Applet {
    private int xValue=-10, yValue=-10;
    MyFrame x;
    Checkbox Red, Black, Magenta, Blue, Green, Yellow;
    CheckboxGroup cbg;
    public void init()
    x= new MyFrame("Christie's Window");
    x.show();
    x.resize(250,100);
    cbg = new CheckboxGroup();
           Red = new Checkbox("Red", cbg,true);
           Black = new Checkbox("Black", cbg,false);
           Magenta = new Checkbox("Magenta",cbg,false);
           Blue = new Checkbox("Blue", cbg, false);
           Green = new Checkbox("Green", cbg, false);
           Yellow = new Checkbox("Yellow", cbg, false);
           add(Red);
           add(Black);
           add(Magenta);
           add(Blue);
           add(Green);
           add(Yellow);
         addMouseMotionListener(new MotionHandler(this));
    public void paint(Graphics g)
    g.drawString("Drag the mouse to draw", 10, 20);
    g.fillOval(xValue, yValue, 4,4);
    //Override Component class update method to allow all ovals
    // to remain on the screen by not clearing the background
    public void update(Graphics g)   { paint(g); }
    // set the drawing coordinates and repaint
    public void setCoordinates(int x, int y)
      xValue = x;
      yValue = y;
      repaint();
    // Class to handle only mouse drag events for the Drag applet
    class MotionHandler extends MouseMotionAdapter {
      private painter dragger;
      public MotionHandler(painter d)  { dragger = d; }
      public void mouseDragged( MouseEvent e)
        { dragger.setCoordinates( e.getX(), e.getY() );   }
        } and here is MyFrame class:
    package pt;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2006</p>
    * <p>Company: </p>
    * @author unascribed
    * @version 1.0
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    public class MyFrame extends Frame {
    MyFrame(String x){
       super(x);
        public boolean handleEvent(Event evtObj) {
          if(evtObj.id==Event.WINDOW_DESTROY) {
            hide();
            return true;
          return super.handleEvent(evtObj);
    }

    here's your conversion, with listeners to change the color
    //import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    //public class painter extends Applet {
    class painter extends Frame {
    Color color = Color.RED;
    private int xValue=-10, yValue=-10;
    //MyFrame x;
    Checkbox Red, Black, Magenta, Blue, Green, Yellow;
    CheckboxGroup cbg;
    //public void init()
    public painter()
    //x= new MyFrame("Christie's Window");
    setTitle("Christie's Window");
    //x.show();
    //x.resize(250,100);
    setSize(600,400);
    setLocation(200,100);
    cbg = new CheckboxGroup();
           Red = new Checkbox("Red", cbg,true);
           Red.addItemListener(new ItemListener(){
            public void itemStateChanged(ItemEvent ie){
              if(Red.getState()) color = Color.RED;}});
           Black = new Checkbox("Black", cbg,false);
           Black.addItemListener(new ItemListener(){
            public void itemStateChanged(ItemEvent ie){
              if(Black.getState()) color = Color.BLACK;}});
           Magenta = new Checkbox("Magenta",cbg,false);
           Magenta.addItemListener(new ItemListener(){
            public void itemStateChanged(ItemEvent ie){
              if(Magenta.getState()) color = Color.MAGENTA;}});
           Blue = new Checkbox("Blue", cbg, false);
           Blue.addItemListener(new ItemListener(){
            public void itemStateChanged(ItemEvent ie){
              if(Blue.getState()) color = Color.BLUE;}});
           Green = new Checkbox("Green", cbg, false);
           Green.addItemListener(new ItemListener(){
            public void itemStateChanged(ItemEvent ie){
              if(Green.getState()) color = Color.GREEN;}});
           Yellow = new Checkbox("Yellow", cbg, false);
           Yellow.addItemListener(new ItemListener(){
            public void itemStateChanged(ItemEvent ie){
              if(Yellow.getState()) color = Color.YELLOW;}});
    Panel p = new Panel();
           p.add(Red);
           p.add(Black);
           p.add(Magenta);
           p.add(Blue);
           p.add(Green);
           p.add(Yellow);
    add(p,BorderLayout.NORTH);
         addMouseMotionListener(new MotionHandler(this));
    addWindowListener(new WindowAdapter(){
          public void windowClosing(WindowEvent we) { System.exit(0); }});
    public void paint(Graphics g)
    super.paint(g);
    g.setColor(color);
    g.drawString("Drag the mouse to draw", 10, 75);
    g.fillOval(xValue, yValue, 4,4);
    //Override Component class update method to allow all ovals
    // to remain on the screen by not clearing the background
    public void update(Graphics g)   { paint(g); }
    // set the drawing coordinates and repaint
    public void setCoordinates(int x, int y)
      xValue = x;
      yValue = y;
      repaint();
    // Class to handle only mouse drag events for the Drag applet
    class MotionHandler extends MouseMotionAdapter {
      private painter dragger;
      public MotionHandler(painter d)  { dragger = d; }
      public void mouseDragged( MouseEvent e)
        { dragger.setCoordinates( e.getX(), e.getY() );   }
      public static void main(String[] args){new painter().setVisible(true);}
    }

  • Hi Experts, oo hierarchical alv, how to add checkbox on every header?

    Hi Experts,
    I am working on oo hierarchical alv, how can I add checkbox on every header? thanks in advance!
    Kind regards
    Dawson

    Hi Dawson,
    Just refer the below program & pass the check box functionality (mentioned in bold) in REUSE_ALV_HIERSEQ_LIST_DISPLAY in your program.
    TYPE-POOLS : slis.
    Data
    DATA : BEGIN OF itab OCCURS 0.
    INCLUDE STRUCTURE t001.
    DATA : flag tyPE c,
    END OF itab.
    DATA : alvfc TYPE slis_t_fieldcat_alv.
    DATA : alvly TYPE slis_layout_alv.
    Select Data
    SELECT * FROM t001 INTO TABLE itab.
    *------- Field Catalogue
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_program_name = sy-repid
    i_internal_tabname = 'ITAB'
    i_inclname = sy-repid
    CHANGING
    ct_fieldcat = alvfc
    EXCEPTIONS
    inconsistent_interface = 1
    program_error = 2
    OTHERS = 3.
    Display
    alvly-box_fieldname = 'FLAG'.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    it_fieldcat = alvfc
    i_callback_program = sy-repid "<-------Important
    i_callback_user_command = 'ITAB_USER_COMMAND' "<------ Important
    is_layout = alvly
    TABLES
    t_outtab = itab
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    CALL BACK FORM
    FORM itab_user_command USING whatcomm TYPE sy-ucomm whatrow TYPE
    slis_selfield.
    LOOP AT itab.
    itab-flag = 'X'.
    MODIFY itab.
    ENDLOOP.
    IMPORTANT.
    WHATROW-REFRESH = 'X'.
    ENDFORM. "ITAB_user_command
    Regards
    Abhii...

  • How to add Checkbox in Table

    Hi,
    I want to add CheckBox in Table. my requirement is multiselection. I Implemented the following steps, but it's not working. anyone can tell me,what mistake i did?
    I created two "Value Attribute"(check,Name) under a "Value Node"(Student) in context.
    check - Boolean
    Name - mapped a Dictionary simple Type(5 values)
    Include a Table in Layout and select Create Binding on right clicking of Table.
    Checked only Student and check -> Next
    Selected the Editor as checkbox -> Finish
    Selected Name from context and assigned to checkbox text property.
    Then I deployed the application. But only one checkbox is displayed in Table without any text.
    Please give me the suggestion, how to do this.
    Thanks in Advance
    Rajakumar

    Hello,
    I think you have a fundamental misunderstanding on how Checkboxes work. A Checkbox triggers a boolean value with true (checked) or false (uncheked).
    When you map your name attribut to text you will see the content of that attribute as text behind. But not the metadata.
    You may want to use a RadiobuttonGroup or CheckboxGroup for your purpose.
    Frank

  • How to add checkboxes to frames?

    Hi,
    I am trying to add checkboxes to a frame which will then be instantiated from an applet. I can launch the frame correctly from my applet but it always displays the last checkbox added only. So in my code below it would always display the 'Black' checkbox.
    Could anyone please tell me what I am doing wrong or not doing here?
    import java.awt.*;
    import java.applet.*;
    class Chooser extends Frame {
         Chooser(String title) {
              super(title);
              Checkbox cRed;
              Checkbox cBlack;
              CheckboxGroup cbg = new CheckboxGroup( );
              cRed = new Checkbox("Red", cbg, true);
              cBlack = new Checkbox("Black", cbg, false);
              add(cRed);
              add(cBlack);
            public boolean handleEvent(Event evtObj) {
              if (evtObj.id == Event.WINDOW_DESTROY) {
                   hide( );
                   return true;
              return super.handleEvent(evtObj);
         public void paint(Graphics g) {
              g.drawString("Chooser Frame",10,40);
    }Thanks
    Avi
    Message was edited by:
    avi22
    Message was edited by:
    avi22

    add a pack() statement to your Chooser constructor as the last statement before the end of the constructor
      Chooser(String title){
    //    your code here
        this.pack();

  • How to add checkbox in ALV OO?

    how to change editable mode and able to input???
    REPORT  ZZ_ALV_TEST.
    data:
          ispfli type table of spfli.
    data: gr_table type ref to cl_salv_table.
    data: gr_functions type ref to cl_salv_functions.
    data: gr_display type ref to cl_salv_display_settings.
    DATA: GR_COLUMNS TYPE REF TO CL_SALV_COLUMNS_TABLE,
          GR_COLUMN  TYPE REF TO CL_SALV_COLUMN_TABLE.
    start-of-selection.
    select * into table ispfli from spfli.
    cl_salv_table=>factory( importing r_salv_table = gr_table changing
    t_table = ispfli ).
    gr_functions = gr_table->get_functions( ).
    gr_functions->set_all( abap_true ).
    GR_COLUMNS = GR_TABLE->GET_COLUMNS( ).
      TRY.
          GR_COLUMN ?= GR_COLUMNS->GET_COLUMN( 'CARRID' ). "Column which you
    * want to make checkbox
          GR_COLUMN->SET_CELL_TYPE( 1 ).
        CATCH CX_SALV_NOT_FOUND.
      ENDTRY.
    gr_table->display( ).

    I understand the CARRID column is not a checkbox, so you might mean something else entirely. If all you need is to toogle a checkbox value on click, then
    - first make the checkbox a hotspot
    gr_column->set_cell_type(  if_salv_c_cell_type=>checkbox_hotspot ). " constant value 6
    - implement a handler to the hotspot event
    DATA gr_events TYPE REF TO cl_salv_events_table.
        gr_events = gr_table->get_event( ).
        SET HANDLER ??->handle_hotspot_click FOR gr_events.
    - Your handler must toogle the checkbox value and refresh the display, something like
        METHOD handle_hotspot_click.
        FIELD-SYMBOLS <ls_item> TYPE spfli.
        READ TABLE ispfli INDEX row ASSIGNING <ls_item>.
        CHECK sy-subrc EQ 0.
        CASE column.
          WHEN 'CARRID'.  " your checkbox column
    *       Toogle Value
            IF <ls_item>-carrid EQ 'X'.
              <ls_item>-carridl = space.
             ELSE.
              <ls_item>-carrid = 'X'.
            ENDIF.
            gr_table->refresh( ).
        ENDCASE.
      ENDMETHOD.
    J.N.N

  • Eclipse: How to add checkbox on screen

      Hi,
    I am working on Eclipse, can u please give me example how we can create Checkbox.

    Hi Nishant ,
    Follow the API documentation of SAP UI 5 for all the simple and complex controls.
    Here is the link for the checkbox control - CheckBox - SAPUI5 Demo Kit
    Example :
    // create a simple CheckBox
    var oCB = new sap.ui.commons.CheckBox({
    text : 'I want to receive the newsletter',
    tooltip : 'Newsletter checkbox',
    checked : true,
    change : function() {if(oCB.getChecked()){alert('YES')}else{alert('NO')};}
    // attach it to some element in the page
    oCB.placeAt("sample1");

  • How to add checkbox in dropdown box

    hi to all
      please help me urgent
      can we add check box in to the drop down box in screen painter..?
    if yes then please tell me in detail.
    thank you...

    Hi,
    In drop down ( combo box) u can select only one item at a time. so why do u need check box ?

  • How to add checkboxes in InDesign CS3 for use in pdf?

    I need to create a page with checkboxes for the user to select various options. I can create buttons and hyperlinks, but I am unable to create checkboxes. Is it even possible to do so in InDesign?

    Thanks Bob. Just wondering though, I need to generate an electronic form, meaning I need to be able to use these checkboxes for scripting. I don't think the auto form recognition feature works for that... does it?

  • How to add selected values from table(selected using checkbox)to table?

    Hi All,
    i have created simple page with search panel with table in table i have created one column as check box for selecting.
    here what my requirement is i need to do search multiple times to add some roles to from some different categories.here whenever i searched i ll get some roles into table there i ll select some role and i ll click add buttion. whenever i click add i need to add those roles into some other table finally i ll submit added roles.
    here i followed one link http://www.oracle.com/technetwork/developer-tools/adf/learnmore/99-checkbox-for-delete-in-table-1539659.pdf
    i used same code and able to see selected row in console, as object array how to add these into table.
    please help me out
    Thanks in advance
    siva shankar

    Thank you for a quick reply
    i used the same thing before i go for table check box concept.here what i observed is when i search i am getting some results i am able to shuttle.but if i search again the shuttle is refreshing with new values even not available list its refreshing selected list. IF dont want refresh selected ones.
    my usecase after make some searches I will select some roles from different categories at finally i ll submit.
    i hope you understand me requirement. please suggest me is this requirement is possible in shuttle component? if yes please guide me.
    thanks
    Siva Sankar

  • How to add a checkbox to dynamic itab  so that i can select some records

    How to add a checkbox to dynamic itab  so that i can select some records in the alv and can display them in another alv using a button
    I have requirement where i have to display the dynamic itab records in an alv ....Some records from this alv output has to be selected through checkbox  provided in the first column .( I will get to know the structure of the itab only at runtime ,so iam using dynamic itab)

    Hi,
       I tried and finally i got it , Just try for it.
    type-pools : slis.
    PARAMETERS : p_tab type dd02l-tabname.
    data : ref_tabletype  type REF TO cl_abap_tabledescr,
           ref_rowtype TYPE REF TO cl_abap_structdescr.
    field-symbols  : <lt_table>  type   standard TABLE ,
           <fwa> type any,
           <field> type abap_compdescr.
    data : lt_fcat type lvc_t_fcat,
           ls_fcat type lvc_s_fcat,
           lt_fldcat type SLIS_T_FIELDCAT_ALV,
           ls_fldcat like line of lt_fldcat.
    data : ref_data type REF TO data,
            ref_wa type ref to  data.
    ref_rowtype ?= cl_abap_typedescr=>DESCRIBE_BY_name( p_name = p_tab ).
    TRY.
    CALL METHOD cl_abap_tabledescr=>create
      EXPORTING
        p_line_type  = ref_rowtype
      receiving
        p_result     = ref_tabletype.
    CATCH cx_sy_table_creation .
    write : / 'Object Not Found'.
    ENDTRY.
    *creating object.
    create data ref_data type handle ref_tabletype.
    create data ref_wa type handle ref_rowtype.
    *value assignment.
    ASSIGN ref_data->* to <lt_table>.
    assign ref_wa->* to <fwa>.
    loop at ref_rowtype->components ASSIGNING <field>.
      ls_fcat-fieldname = <field>-name.
      ls_fcat-ref_table = p_tab.
      append ls_fcat to lt_fcat.
    if lt_fldcat[] is  INITIAL.
        ls_fldcat-fieldname = 'CHECKBOX'.
        ls_fldcat-checkbox = 'X'.
        ls_fldcat-edit = 'X'.
        ls_fldcat-seltext_m = 'Checkbox'.
        append ls_fldcat to lt_fldcat.
      endif.
      clear ls_fldcat.
      ls_fldcat-fieldname = <field>-name.
      ls_fldcat-ref_tabname = p_tab.
      append ls_fldcat to lt_fldcat.
    endloop.
    loop at lt_fldcat into ls_fldcat.
      if sy-tabix = 1.
        ls_fldcat-checkbox = 'X'.
        ls_fldcat-edit = 'X'.
    modify lt_fldcat FROM ls_fldcat
        TRANSPORTING checkbox edit.
    endif.
    endloop.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
      EXPORTING
        it_fieldcatalog           = lt_fcat[]
      IMPORTING
        ep_table                  = ref_data.
    assign ref_data->* to <lt_table>.
    select * FROM (p_tab) into table <lt_table>.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       IT_FIELDCAT                       = lt_fldcat[]
      TABLES
        t_outtab                          = <lt_table>.
    Thanks & Regards,
    Raghunadh .K

  • Add CheckBox to JTable

    How to add a checkBox in a column of my table?
    I would like to add a checkbox in column 3. Where should I add the Listener to?

    Here's a simple example using a JCheckBox as a renderer:
    import java.awt.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import java.text.*;
    public class TableRenderer extends JFrame
        public TableRenderer()
            String[] columnNames = {"Date", "String", "Integer", "Decimal", "Boolean"};
            Object[][] data =
                {new Date(), "A", new Integer(1), new Double(5.1), new Boolean(true)},
                {new Date(), "B", new Integer(2), new Double(6.2), new Boolean(false)},
                {new Date(), "C", new Integer(3), new Double(7.3), new Boolean(true)},
                {new Date(), "D", new Integer(4), new Double(8.4), new Boolean(false)}
            DefaultTableModel model = new DefaultTableModel(data, columnNames);
            JTable table = new JTable( model )
                //  Returning the Class of each column will allow different
                //  renderers to be used based on Class
                public Class getColumnClass(int column)
                    return getValueAt(0, column).getClass();
            table.setPreferredScrollableViewportSize(table.getPreferredSize());
            JScrollPane scrollPane = new JScrollPane( table );
            getContentPane().add( scrollPane );
            //  Create cell renderer
            TableCellRenderer centerRenderer = new CenterRenderer();
            //  Use renderer on a specific column
            TableColumn column = table.getColumnModel().getColumn(3);
            column.setCellRenderer( centerRenderer );
            //  Use renderer on a specific Class
            table.setDefaultRenderer(String.class, centerRenderer);
              scrollPane.getViewport().setBackground(Color.red);
        public static void main(String[] args)
            TableRenderer frame = new TableRenderer();
            frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
            frame.pack();
            frame.setVisible(true);
        **  Center the text and highlight the focused cell
        class CenterRenderer extends DefaultTableCellRenderer
            public CenterRenderer()
                setHorizontalAlignment( CENTER );
            public Component getTableCellRendererComponent(
                JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
                super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
                if (hasFocus)
                    setBackground( Color.cyan );
                else if (isSelected)
                    setBackground( table.getSelectionBackground() );
                else
                    setBackground( table.getBackground() );
                return this;
    }For more information on "Using Tables" see the Swing tutorial:
    http://java.sun.com/docs/books/tutorial/uiswing/components/table.html

  • How to add/create additional page in Crystal Report Layout SAP B1

    Hi,
    I wanna ask about How to add/create additional page in Crystal Report Layout SAP B1 ?
    I want when user print Purchase Order then on last page also print some page like Penalty Clause etc.
    Pls help me to find the solution.
    Br,
    Thomas Marsetyo

    Hi,
    In your report footer, set it to create a new page before it is printed (In 'Section Expert', select the Report Footer -> 'Paging' tab -> Check 'New Page Before' checkbox). Throw your Terms & Conditions into the Report Footer section.
    If you already have a Report Footer that you want to keep, just split the footer into two sections (Right-click the Report Footer section -> 'Insert Section Below') and follow the same procedure for the newly created section.
         Check this Link
    http://stackoverflow.com/questions/9232239/adding-an-additional-page-to-end-of-a-crystal-report
    http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=18960
    Regards,
    Manish

  • How to add the entries and how to delete the entries from custom Z-table?

    Hi Experts,
    My requirement is I need to add the entries from program to three custom z-tables . Assume as zabc1,zabc2,zabc3.
    Here how to add the entries from program to Z-table.???
    And one more requirement is I want to provide a deletion checkbox in selection screen . Initial it was unchecked. If I am giving tick mark then the entries should be deleted from above custom Z-tables. this all will done in backgroung job?
    Could you please guide me the logic how to crack this???
    Let me know if you need more Info
    Thanks
    Sanju

    Hi Sanjana,
    What you can do is to use the ABAP keyword INSERT or MODIFY to add or modify records to a given database table. Here are the syntax taken from SAP documentation:
    *Insert Statement
    INSERT dbtab
    Syntax
    INSERT { {INTO target VALUES source }
           | {     target FROM   source } }.
    Effect
    The INSERT statement inserts one or more rows specified in source in the database table specified in target. The two variants with INTO and VALUES or without INTO with FROM behave identically, with the exception that you cannot specify any internal tables in source after VALUES.
    System Fields
    The INSERT statement sets the values of the system fields sy-subrc and sy-dbcnt.
    sy-subrc Meaning
    0 At least one row was inserted.
    4 At least one row could not be inserted, because the database table already contains a row with the same primary key or a unique secondary index.
    The INSERT statement sets sy-dbcnt to the number of rows inserted.
    Note
    The inserted rows are finally included in the table in the next database commit. Up until this point, they can still be removed by a database rollback.
    *Modify Statement
    MODIFY dbtab
    Syntax
    MODIFY target FROM source.
    Effect
    The MODIFY statement inserts one or several lines specified in source in the database table specified in target, or overwrites existing lines.
    System fields
    The MODIFY statement sets the values of the sy-subrc and sy-dbcnt system fields.
    sy-subrc Meaning
    0 At least one line is inserted or changed.
    4 At least one line could not be processed since there is already a line with the same unique name secondary index in the database table.
    The MODIFY statement sets sy-dbcnt to the number of processed lines.
    Note
    The changes are transferred finally to the database table with the next database commit. Up to that point, they can be reversed using a database rollback.
    Hope it helps...
    P.S. Please award points if it helps...

Maybe you are looking for