Positioning a programatically added button

Hi All,
We have programatically added a button to a region it is positioned at the bottom of that region but we want to set it at the top.
So is there any property with which we can change the position of the button programatically?
Pls let me know.
Akshata

I figured out what was wrong... there were two problems and
one caused the other. The first problem is that I'm retarded. Which
is why I didn't notice that the view states are case sensitive and
my XML and hard coded values were in a different case than the
actual states.

Similar Messages

  • Adding Buttons to a ScrollPane??

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

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

  • Programatically adding command links in ADF Tree?

    Hi,
    I am using Build JDEVADF_11.1.1.3.PS2_GENERIC_100408.2356.5660. Can anyone please provide me some sample code for programatically adding dynamically generated ADF command links in the nodes of ADF Tree(Tree nodes in it are created using View Object - Drag & drop of data control). Now how can i add links in the nodes generated.
    Thanks,
    Vik

    Hi,
    try setting partialSubmit=true on the command link. Just in case it fires the action method before the context menu displays
    Frank

  • Captiave 2 - Adding Buttons to Question Slides

    I need to use the Captivate Question Slide "maker" to create
    interactive questions with navigation back to the "Jeopardy-esque"
    main page. When doing so, the question slide maker prevents adding
    buttons/navigation, etc.
    Any work arounds, hints, suggestions?
    Thanks...

    Hi Beta Bob and welcome to our community
    As you have seen, you cannot insert interactive objects
    (Buttons, Click Boxes or Text Entry Boxes) on Question slides.
    The only workaround I can think of is to sort of simulate the
    question slide using these objects on a standard slide.
    Cheers... Rick

  • Standard buttons not displaying ALV when added button by creating PF status

    Hi  All,
    I have added a button(using SE41) in application toolbar for ALV grid using Factory method.But the problem is I am unable to see the standard tool bar buttons(Layout,Download,Mail etc).
    Even I tried adding buttons(using standard FCODES) to the PFstatus.Now the buttons are visible but the functionality is not working for all buttons.Its working only for Graphic and Change layout buttons.
    Can any one suggest...??
    -Phaniram

    Disregard DKS's response...that's the older stuff and you're using NetWeaver ALV.
    In SALV you can cause those buttons to appear, but you may need to copy the SALV_STANDARD GUI from one of the SALV* named program using SE80...sounds like you have that part, but you may need to turn functions ON...
    Perhaps something like this would help:
    data:  gr_f_list  type ref to cl_salv_functions_list,
             gr_alv     type ref to cl_salv_table,
    SALV toolbar & GUI functions
      gr_f_list = gr_alv->get_functions( ).     "Get Toolbar functions
      gr_f_list->set_all( abap_true ).          "All On
      gr_f_list->set_view_lotus( abap_false ).  "Lotus 123 off
      gr_f_list->set_view_excel( abap_false ).  "Excel in Place Off
      gr_f_list->set_graphics( abap_false ).    "Graph tool off
    For undesired buttons, set each tool OFF after turning all ON.

  • How to make separation between added buttons into a jToolBar?

    Hi friends,
    I have made a jToolBar (using NetBeans IDE 5.5) with several buttons, but i dont know how to make custom separation between those added buttons. I will appreciate it if anyboy give me some tips.
    Thanks in advance,
    Reza_mp

    I don't know about NetBeans but yeah U can add horizontal atruts and verticals struts between two components, i.e.
    1.) add first component
    2.) add horizontal or vertical struts(according to ur toolbar)
    3.) add second component
    4.) add add horizontal or vertical struts(according to ur toolbar)
    this will definitely solve ur problem.
    If it does, don't forget to pay ur points.

  • Recently added     button accidently deleted How do I get this button back?

    'Recently added' button accidently deleted How do I get this button back?
    I can not find where my tracks off a cd are
    on my imac with out this button or
    icon on the left hand side of itunes.
    HELP I am technically challenged but
    relatively intelligent musician!

    catcowkitty wrote:
    'Recently added' button
    that button is actually a *smart playlist* which you can create yourself quite easily.
    in iTunes, choose +new smart playlist+ from the file menu and recreate the following rules:
    the screenshot is from my original recently added playlist.
    JGG

  • Can i restore the 'recently added' button in the sidebar of iTunes?

    It happend that I accidencially erased the 'Recently Added' button from the sidebar in iTunes which is a bit of a dissaster for me as I often add mp3's from musicproductions elsewere. It makes it quite difficult to find the songs without that button.

    Hi Jimzgoldfinch
    It worked, i have a new smart playlist up and running. That's great, thanks a lot!
    Sam Foh

  • Programatically add button/tool to the "Quick Tools" Toolbar (plug-in)

    Hi,
    I've been porting an old version of a plug-in we had built for Adobe Acrobat Standard/Pro and I'm having trouble finding a way to add an already created toolbar and button to the "Quick Tools" toolbar.
    I'm able to create a new toolbar and a button/label that appears under the "Tools --> *name of my toolbar*".
    It is possible, after the button exists to manually add it to the Quick Tools toolbar, through the Menu option "Edit the current toolset", selecting the tool item and adding it to the Quick Tools toolbar.
    I would like to automate this by doing it programatically, after adding the toolbar/button.
    Thanks,
    Bernardo

    Hi Ironsenth. Thank you for your reply.
    Is there any other way to place a plug-in button on a visible toolbar? Now the button appears in the (newly created) toolbar hidden under the Tools sidebar, on the right.
    I would like to ensure that by installing the plug-in the users would have a noticeable way to recognize that it is installed and working properly.
    Thank you,
    Bernardo

  • SRM 7.0 adding Button for DESCRIBE_ITEM usage definition

    Hello all together,
    We wish to implement  a button on the second step for using the DESCIRBE_ITEM standard eventhandler (for the popup of free text position) .
    here we are getting the error that the describe_item has no component name and the application has not created the component.
    I found out,  that when the shop card is in other status then saved the button does function (application here is FPM_OIF_Component).
    but in a new status or saved status (appl. here is pfm_gaf_component) I am getting allwas the error.
    Do I have to change something in the configuration and if yes, what do I  have to do?
    Adding initializing of the component for the popup does not work /help, the error then is: ...is a component interface and not a component.. and cannot be created..
    .- and the thing is : the component is already there and should be used...right?
    Please help.
    Thanks in advance for any input / help!

    Hi,
    I ' ve found the solution on my own.
    it is just a configuration issue in the FPM.

  • Need to lock position of a transparent button in a Mac Projector

    Hi
    I am running a Projector file on a touch screen kiosk.  The basic index screen on the kiosk has 18 transparent buttons overlaying text on an underlying graphic.  The buttons are have a background transparency set at 20% in order to identify the boundries of the button.
    My problem is that anyone touching the buttons on the touch screen can drag the button away from its intended fixed position.  I have locked the button sprite in the authoring mode but that does not seem to lock its position in the projector.  Any thoughts or help would be greatly appreciated.
    Projector is running on a MAC mini with OS 10.5.7.
    Thanks
    Rockodyne

    My problem is that anyone touching the buttons on the touch screen can drag the button away from its intended fixed position.
    Then you have either added code somewhere to allow the user to do this, or the sprite(number).moveableSprite property is TRUE for them all (which is something you can set using the Property Inspector -> Sprite tab - it's the Moveable button above the sprite Name entry field)

  • Adding button to a custom table cell (and handling them)

    Hi
    I'm wondering if it's possible to add a button on each row of a table view using a custom table cell view. If it's possible, I'm really wondering how I can handle the click events on these buttons.
    Thanks

    No.
    Try creating a view and adding it to a cell. Let us know what problems you have, and we can try to help.

  • How to fix the position of JInternalFrames added in JFrame.

    Hay Frnds, I am having a problem. I have a JFrame ,in which i have added five JInternalFrames. My problem is that i want to fix the position of thaose Internal frames so that user cant move them from one place to other. Is there any way to fix there position. Plz reply as soon as possible. Its very urgent.
    Thanks.

    import javax.swing.plaf.basic.*;
            BasicInternalFrameUI internalframeUI = (BasicInternalFrameUI)frame1.getUI();
            internalframeUI.getNorthPane().addMouseListener(new MouseAdapter() {
                public void mouseReleased(MouseEvent evt) {
                    frame1.setBounds(0, 0, frame1.getWidth(), frame1.getHeight());
            });

  • Adding Button to Active Form

    Hi,
    I created button in PO  on Form load event. its working fine.but
    how to add a button on the active(PO)  form once My add-on is started?
    Regards,
    Ganesh k

    Hi,
    i checked for the existance of my button in my active form, if not exist i added my button in et_FORM_ACTIVATE  Event. its working now.
    If pVal.EventType = et_FORM_ACTIVATE And pVal.FormTypeEx = "142" And FLAG = False Then
                oOrderForm = sbo_application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount)
                Dim ii As Integer
                For ii = 0 To oOrderForm.Items.Count - 1
                    If oOrderForm.Items.Item(ii).UniqueID = "MyBtnId" Then
                        FLAG = True
                    End If
                Next ii
                If FLAG = False Then
                    ADDBUTTON()
                End If
            End If
    Thanks For the Suggestions..
    regards,
    Ganesh K

  • Problem wiht added button on invoice form

    I have added a custom button on invoice form.
    Scenario 1:
    I open the invoice form then the custom button is added and the et_ITEM_PRESSED event on custom button in catched. All is ok!
    Scenario 2
    I open a custom form and after close it.
    After I open the invoice form then custom button is added but et_ITEM_PRESSED event on custom button in not catched!!
    Could somebody please help me?
    Thanks

    Hi Domenico,
    It could be that the custom form gets an exception and then no other events might be caught. Try and put try...catch clauses around all your code and show messages when an error is received. This might be the cause of the problem - an unhandled exception.
    Hope it helps,
    Adele

Maybe you are looking for