Help trying to create multiple rectangles

Hi, I'm trying to create a five-in-a-row game, and I need lots of rectangles, forming a kind of a net. I've figured out a bit, but the thing is that every new rectangle seems to erase all the former ones, so in the end there's just the last one. I use this code:
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import javax.swing.*;
public class luffare extends JApplet {
ruta rutor[] = new ruta[400];
public void init() {
for(int a=0;a<20;a++){
for(int b=0;b<20;b++){
     rutor[a*20+b] = new ruta(a*10, b*10);
     //rutor[a*20+b].setBackground(Color.white);
getContentPane().add(rutor[a*20+b]);
class ruta extends JPanel implements MouseListener, MouseMotionListener{
Rectangle rect;
public ruta(int xPos, int yPos){
rect = new Rectangle(xPos, yPos, 10, 10);
addMouseMotionListener(this);
addMouseListener(this);
public void paintComponent(Graphics g){
Graphics2D g2 = (Graphics2D)g;
g2.draw(rect);
public void mouseReleased(MouseEvent e){}
public void mousePressed(MouseEvent e){}
public void mouseDragged(MouseEvent e){}
public void mouseMoved(MouseEvent e){}
public void mouseClicked(MouseEvent e){}
public void mouseExited(MouseEvent e){}
public void mouseEntered(MouseEvent e){}
I'm really stuck here, can anybody help?
regards,
M?ns Wide

Hey, I'm no Swing expert, actually I'm very much a beginner in Swing! I suggest you go through the Swing tutorials
{color:#0000ff}http://java.sun.com/docs/books/tutorial/uiswing/index.html{color}
and learn about the multitude of features that can be useful to you.
After that, if you have any problems related to Swing, please post in the Swing forum where you will get advice from real experts.
This works, using setBounds(...) with null Layout --I've added the position number to each Ruta (size increased to 20 X 20 for that) so you can see where they go.
file Luffare.javapackage manswide;
import java.awt.*;
import javax.swing.*;
public class Luffare extends JApplet
    Ruta rutor[] = new Ruta[400];
    public void init ()
        setLayout (null);
        for(int a = 0; a < 20; a++)
            for(int b = 0; b < 20; b++)
                rutor[a * 20 + b] = new Ruta (a * 20 + b);
                getContentPane ().add (rutor[a * 20 + b]);
                rutor[a * 20 + b].setBounds (a * 20, b * 20, 20, 20);
}file Ruta.javapackage manswide;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
class Ruta extends JPanel implements MouseListener, MouseMotionListener
    Rectangle rect;
    int id;
    public Ruta (int newId)
        id = newId;
        setBorder (LineBorder.createBlackLineBorder ());
        addMouseMotionListener (this);
        addMouseListener (this);
    public void paintComponent (Graphics g)
        Graphics2D g2 = (Graphics2D)g;
        g2.setFont (new Font("Arial", 1, 9));
        g2.drawString (Integer.toString (id), 2, 10);
    public void mouseReleased (MouseEvent e) {}
    public void mousePressed (MouseEvent e) {}
    public void mouseDragged (MouseEvent e) {}
    public void mouseMoved (MouseEvent e) {}
    public void mouseClicked (MouseEvent e) {}
    public void mouseExited (MouseEvent e) {}
    public void mouseEntered (MouseEvent e) {}
}It's good practise to place each java class in its own file.
db
-- To post code, use the code button or type the code tags -- [code]CODE[/code] is displayed as CODE

Similar Messages

  • Help trying to create a button in safari please.

    trying to create a button that runs an applescript. I have been discussing it in 101 but cross posting it here because it's not getting much interest over there.
    Any help would be nice. I have read Become an xCoder and it doesn't seem to answer my questions.
    http://discussions.apple.com/thread.jspa?threadID=1514799&tstart=0

    Is there no way to create an appcontroller that works like an applescript? Or get an applescript to be recognized so a new NSButton added to the Bookmark bar be activated?
    i.e.
    *tell application "System Events"*
    * tell application "Safari" to activate*
    * keystroke "n" using {command down}*
    * delay 0.1*
    * keystroke "l" using {command down, shift down}*
    *end tell*
    Or,
    _Something Like:_
    / AppController /
    *#import <Cocoa/Cocoa.h>*
    *@interface AppController : NSObject*
    *IBOutlet id NSButton;*
    *-(IBAction) autoFill:,delay 0.1,checkSpelling:(id)sender*
    @end
    I really don't know if that AppController looks anything like it should or if it's even close.

  • Trying to create multiple state machines out of same VI to monitor each cFP channel results in what seems to be shared memory between machines

    Hi,
    I'm trying to create a state machine which monitors a single channel on a field point. I want to monitor up to 64 channels at a time, each one with different instances of the same VI. The VI itself needs to maintain information mainly through feedback nodes both in its own block diagram and subVIs within. 
    All instances of this VI will be executing inside a main loop as they do not execute loops of their own as this would create 64 threads on the cFP-2200 we're using which I believe would be too much.
    My attempted solution to all of this was to make the Channel Monitoring VI along with all SubVIs reentrant and "pre-allocate" for each instance. This does not seem to help as each VI seems to maintain the state of the one which ran before. Maybe I'm missing a step?
    Is there a better way to approach this problem without writing a separate VI for each channel and the maintenance headache that would cause?

    Hi Ben,
    I actually read your document for another puzzle and it worked well, I think largely because it involved subVIs which were meant as separate threads. In that case, I used methods to alter inputs while the VI was "running."
    In this case, as you know, my SubVIs are not looping inside, they are instead single calls but they do need to maintain the state at the end of their previous call, adding to the data they're tracking after they are called subsequent times. I tried the "call by reference" to call them each time. Below is a screenshot of the VI used to create the occurances and a SubVI used to execute each occurance, this subVI is embedded inside a while loop which I did not show here:
    In running my tests, there still seems to be some data sharing of internal variables and feedback nodes between the SubVIs I'm calling, which I do not want. Am I approaching this in the correct way? Is what I'm trying to do even possible?

  • Trying to create multiple lines of radio buttons on the same page. how do i do that??

    Greetings. I'm brand new to this, and am trying to create a form with multiple lines of radio buttons on a single page to send to my students.  How can I do this??  I currently have a table that I want the students to fill out and return, but every time I put radio buttons in, the form only allows selection of one of the 12 - I want students to be able to select one on each row.........

    Each group of three radio buttons for a row should have the same field name and different "Radio Button Choice" (see Options tab). So if you copy & paste the first row, be sure to rename the new ly added radio buttons.

  • Trying to create multiple sequence window

    I'm new to swing, and I have a project in which I need to create multiple sequence frame swing program.
    To give you a better idea, I'm trying to create something that's similar to a self checkout shopping cart expect there is a frame where I need users to login. I already have a MySQL database setup for that.
    Once the user passes the login frame, I need another frame that will show up to displace information, and multiple other frames to come and go.
    I learn really well by examples, so are there any place I can find example of this. Thank you

    What I need is a transition between different layout. I need a layout say a login layout to finish (run successfully) and it transition to a different layout.
    I looked through the totorials and didn't see anything about transitions.
    I don't need need something like a desktop with multiple frames being displated at the same time. I need a sequence of frames
    Ah never mind.. cardmanager is what I need
    Message was edited by:
    d1sturbanc3

  • Need help trying to create a ActiveX registered event

    I am trying to create a register event for an ActiveX component. The problem I am having is creating the callback vi. When I right click on the VI ref and create the callback vi it is created with the user parameter as a variant. I would like this to be a control refnum. If I open the callback vi and replace the user parameter variant with a control refnum the wire from the callback vi to the VI ref is broken. How do I change the user parameter?

    Joe is correct on this one. The callback where designed to take variants as their inputs, so that they are more flexible. In addition Variants are used through out ActiveX programming.
    If you have a control reference that you want to pass into the VI, all you need to use is the "To Variant" function in the main VI to turn the reference into a variant. You can then inside the Callback VI you can use the Variant to Data VI to change the variant back to a reference; you simply where a constant of the reference type to the "Type" terminal.
    Evan
    National Instruments

  • Help trying to create a 2 page indesign doc with 1 landscape & 1 portrait page?

    I'm creating a double sided A5 flyer, how do I create a 2 page indesign document with one page portrait & the other landscape?
    Thank you in advance for anyone who can help with this ;-)

    You can use the Page tool to change one, but if it's going to print I think it would be better to make them both either ladscape or portrait, then use Rotate Spread View in the Pages panel to make one appear inthe other orientation on screen while work.

  • Help -- Trying to create JAR file but not working

    Hi everyone
    I have created a rather noddy Java program that consists of 4 JComboBox's and 1 JButton on a JFrame.
    When the button is clicked a text file is generate with the options that have been selected.
    There are severial files that the program uses for this:
    gcc.java
    OutToFile.java
    gccConfirm.java
    MyNewWindow.java
    main.java
    I am using Jcreator and so must use the command line to create the Jar file.
    I have never done a jar file before so I did an example with a hello world program and got it working now problem. I did the same for this program and the JAR file is generated without error. I double click on the JAR file to run the application, but nothing happens. I can see the application running in memory but nothing loads on the screen. However if I run it from the command line using Java -jar gcc.jar then everything is ok.
    can anyone help me here?
    thanks in advance

    If you run you .jar from the command line (a shell in unix speak) there
    already is a console where your java program can send it's System.out
    stuff. Right click on your .jar and select 'properties' (or similar). Note
    that your .jar is run by 'javaw'. This executable is similar to the 'java'
    executable except that it doesn't open a console for you. Change the
    'javaw' command to 'java' and voila, there's your console again.
    kind regards,
    Jos

  • HELP - Trying to make multiple lines one single object

    I have tried everything and to no avail. I know it's due to my lack of experience w/ PS CS3. Any help you can offer and quickly, would be greatly appreciated!
    I've traced/drawn an ice machine with the line tool. There are about 20 individual lines that make the shape. All are in one layer. I want to group the lines so that I can make it one object so that I can move it all together. When I select all of the individual lines and then click Combine, some of my lines disappear.
    Please help.
    Thank you.

    Which option?

  • Creating multiple rectangle objects

    Hi all
    Just having a bit of trouble with a drawing applet i'm creating. At the moment i want the user to be able to click on the screen and the mouse presses and releases define the size of the rectangle. This isn't a problem its just that now i want them to be albe to add more shapes by clicking a new Shape button. at the min my code seems to get stuck in the while loop in the paint method i think, and then it says that the applet is disposed?
    Any ideas where i could be going wrong?
    Cheeers for any pointers
    Heres the code
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    import java.util.*;
    public class drawingApplet extends Applet
                           implements ActionListener, MouseListener
         private Button newShape = new Button("New");
         private Button button2D = new Button("2D");
         //arraylist for objects
         ArrayList shapesArray = new ArrayList();
              boolean drawObject = true; //Drawing Mode
         boolean moveObject = false;
              private Color color = Color.black;
         int x1,y1,x2,y2,x3,y3,x4,y4 = 0;
         int startX,startY,width,height = 0;
         Rectangle myRectangle = new Rectangle(startX,startY,width,height);
              public void init()
              Panel pEast = new Panel();
              pEast.setLayout(new GridLayout(7,1));
              pEast.add(newShape);
              pEast.add(button2D);
              setBackground(Color.gray);
              newShape.addActionListener(this);
              button2D.addActionListener(this);
              addMouseListener(this);
        public void paint(Graphics g)
              Graphics2D g2 = (Graphics2D)g;
              g2.setColor(color);
              //create Rectangle Object
              myRectangle = new Rectangle(50,50,50,50);
              shapesArray.add(myRectangle);
              Iterator it = shapesArray.iterator();
              while(it.hasNext())
                   //DRAW Object
                   if(drawObject == true){
                        g2.draw(myRectangle);
              }//--> End of While loop
         }     //--> End of Paint()
         //--> Start of actionPeformed()
        public void actionPerformed(ActionEvent a)
            if (a.getSource()== button2D){
                   drawObject = true;
                   moveObject = false;
              }else if(a.getSource()== newShape){
                   //add rectangle to arraylist
                   shapesArray.add(myRectangle);
            repaint();}
        }//--> End of actionPerformed()
        //--> Start of section dealing with Mouse Events
        public void mouseClicked(MouseEvent e)
        public void mouseEntered(MouseEvent e)
        public void mouseExited(MouseEvent e)
        public void mousePressed(MouseEvent e)
              x1 = e.getX();
              y1 = e.getY();
              if(myRectangle.contains(x1,y1)){
                   drawObject = false;
                   moveObject = true;
              }else{ //draw the object
                   drawObject = true;}
         }//--> End of mousePressed()
         public void mouseReleased(MouseEvent e)
              //get the positions of where the mouse was released
              x2 = e.getX();
              y2 = e.getY();
              if(drawObject == true){
                   if (x1 != x2 && y1 != y2){
                   //maths to work out where to draw the object
                   if(x1 < x2 && y1 < y2){//1
                        startX = x1;
                        startY = y1;
                        height = y2 - y1;
                        width = x2 - x1;}
                   else if (x1 > x2 && y1 > y2){//2
                        startX = x2;
                        startY = y2;
                        height = y1 - y2;
                        width = x1 - x2;}
                   else if (x1 > x2 && y1 < y2){//3
                        startX = x2;
                        startY = y1;
                        height = y2 - y1;
                        width = x1 - x2;
                   else if (x1 < x2 && y1 > y2){//4
                        startX = x1;
                        startY = y2;
                        height = y1 - y2;
                        width = x2 - x1;}
              }else if(moveObject == true){
                   if (x1 != x2 && y1 != y2){
                        startX = x2;
                        startY = y2;
                        width = myRectangle.width;
                        height = myRectangle.height;
              repaint();
         }//--> End of mouseReleased()
    }Also if anybody has some examples i could look at i would be very grateful. Cheers!!

    /*  <applet code="AddingRectangles" width="400" height="300"></applet>
    *  use: >appletviewer AddingRectangles.java
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    public class AddingRectangles extends Applet implements ActionListener, MouseListener
        private Button newShape = new Button("New");
        private Button button2D = new Button("2D");
        //arraylist for objects
        ArrayList shapesArray = new ArrayList();
        boolean drawObject = true; //Drawing Mode
        boolean moveObject = false;
        private Color color = Color.black;
        int x1,y1,x2,y2,x3,y3,x4,y4 = 0;
        int startX,startY,width,height = 0;
        Rectangle selectedRectangle;
        public void init()
            Panel pEast = new Panel();
            pEast.setLayout(new GridLayout(7,1));
            pEast.add(newShape);
            pEast.add(button2D);
    //        setBackground(Color.gray);
            newShape.addActionListener(this);
            button2D.addActionListener(this);
            addMouseListener(this);
        public void paint(Graphics g)
            Graphics2D g2 = (Graphics2D)g;
            g2.setColor(color);
            //create Rectangle Object
    //        myRectangle = new Rectangle(50,50,50,50);
    //        shapesArray.add(myRectangle);
            Iterator it = shapesArray.iterator();
            while(it.hasNext())
                g2.draw((Rectangle)it.next());
        } //--> End of Paint()
        //--> Start of actionPeformed()
        public void actionPerformed(ActionEvent a)
            if (a.getSource()== button2D){
                drawObject = true;
                moveObject = false;
            }else if(a.getSource()== newShape){
                //add rectangle to arraylist
    //            shapesArray.add(myRectangle);
            repaint();
        }//--> End of actionPerformed()
        //--> Start of section dealing with Mouse Events
        public void mouseClicked(MouseEvent e){}
        public void mouseEntered(MouseEvent e){}
        public void mouseExited(MouseEvent e){}
        public void mousePressed(MouseEvent e)
            x1 = e.getX();
            y1 = e.getY();
            selectedRectangle = null;
            Iterator it = shapesArray.iterator();
            Rectangle r;
            while(it.hasNext())
                r = (Rectangle)it.next();
                if(r.contains(x1,y1)){
                    drawObject = false;
                    moveObject = true;
                    selectedRectangle = r;
                    break;
            // no rectangle selected
            if(selectedRectangle == null)
                selectedRectangle = new Rectangle(x1, y1, 0, 0);
                drawObject = true;
        }//--> End of mousePressed()
        public void mouseReleased(MouseEvent e)
            //get the positions of where the mouse was released
            x2 = e.getX();
            y2 = e.getY();
            if(drawObject == true){
                if (x1 != x2 && y1 != y2){
                    //maths to work out where to draw the object
                    if(x1 < x2 && y1 < y2){//1
                        startX = x1;
                        startY = y1;
                        height = y2 - y1;
                        width = x2 - x1;
                    else if (x1 > x2 && y1 > y2){//2
                        startX = x2;
                        startY = y2;
                        height = y1 - y2;
                        width = x1 - x2;
                    else if (x1 > x2 && y1 < y2){//3
                        startX = x2;
                        startY = y1;
                        height = y2 - y1;
                        width = x1 - x2;
                else if (x1 < x2 && y1 > y2){//4
                    startX = x1;
                    startY = y2;
                    height = y1 - y2;
                    width = x2 - x1;
                if(Math.abs(x2 - x1) > 0 && Math.abs(y2 - y1) > 0)
                    shapesArray.add(new Rectangle(x1, y1, width, height));
            }else if(moveObject == true){
                if (x1 != x2 && y1 != y2){
                    startX = x2;
                    startY = y2;
                    width = selectedRectangle.width;
                    height = selectedRectangle.height;
            repaint();
        }//--> End of mouseReleased()
        public static void main(String[] args)
            Applet applet = new AddingRectangles();
            Frame f = new Frame("Adding Rectangle");
            f.addWindowListener(new WindowAdapter()
                public void windowClosing(WindowEvent e)
                    System.exit(0);
            f.add(applet);
            f.setSize(400,300);
            f.setLocation(200,200);
            applet.init();
            applet.start();
            f.setVisible(true);
    }

  • Please help - Trying to create a realistic liquid morphing

    Hello
    I’m fairly new to Flash and vector art but have a
    project to create a Flash based flowchart that is made up of liquid
    blobs that morph to show the various paths to the chart.
    I’ve had a go making the blobs in flash but when l go
    to animate them, it all looks a bit rubbish - see:
    http://www.mintmedia.co.uk/example2.html
    Could anyone suggest a better way of attempting to do this
    animation....
    Thanks in advance
    Rich

    Is there no way to create an appcontroller that works like an applescript? Or get an applescript to be recognized so a new NSButton added to the Bookmark bar be activated?
    i.e.
    *tell application "System Events"*
    * tell application "Safari" to activate*
    * keystroke "n" using {command down}*
    * delay 0.1*
    * keystroke "l" using {command down, shift down}*
    *end tell*
    Or,
    _Something Like:_
    / AppController /
    *#import <Cocoa/Cocoa.h>*
    *@interface AppController : NSObject*
    *IBOutlet id NSButton;*
    *-(IBAction) autoFill:,delay 0.1,checkSpelling:(id)sender*
    @end
    I really don't know if that AppController looks anything like it should or if it's even close.

  • How to create multiple output files using TrAX?

    I am new in this field. I'm trying to create multiple xml output files using TrAX. I have to parse a xml source file and output it to multiple xml files. My problem is that it only creates one output file and puts all the parsed data there. When i use saxon and run xsl and xml files, it works fine and creates multiple files...it has something to do with my java code...Any help is greatly appreciated.
    Here's my XSL file
    <?xml version="1.0"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1"
    <xsl:template match="data_order">
    <data_order>
         <xsl:copy-of select="contact_address"/>
         <xsl:copy-of select="shipping_address"/>
         <xsl:apply-templates select="ds"/>
    </data_order>
    </xsl:template>
    <xsl:template match="ds">
    <xsl:variable name="file" select="concat('order', position(),'.xml')"/>
    <order number="{position()}" href="{$file}"/>
    <xsl:document href="{$file}">
    <xsl:copy-of select="."/>     
    </xsl:document>
    </xsl:template>
    </xsl:stylesheet>
    xml source file
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE operation SYSTEM 'data_order.dtd'>
    <data_order job_id='00-00-000' origin='PM-ESIP'>
         <contact_address>
              <first_name>ssssss</first_name>
              <last_name>sssss></last_name>
              <phone>2323232</phone>
              <email>dfdfdsaf</email>
         </contact_address>
         <ds ds_short_name ='mif13tbs'>
              <output>
                   <media_format>neither</media_format>
                   <media_type>FTP</media_type>
                   <output_format>GIF</output_format>
              </output>
         </ds>
              <ds ds_short_name ='mif15tbs'>
              <output>
                   <media_format>neither</media_format>
                   <media_type>FTP</media_type>
                   <output_format>GIF</output_format>
              </output>
         </ds>
    </data_order>
    My java file
    import javax.xml.transform.*;
    import javax.xml.transform.stream.*;
    import java.io.*;
    public class FileTransform {
    public static void main(String[] args)
    throws Exception {
    File source = new File(args[0]);
    File style = new File(args[1]);
    File out = new File(args[2]);
    TransformerFactory factory = TransformerFactory.newInstance();
    Transformer t = factory.newTransformer(new StreamSource(style));
    t.transform(new StreamSource(source), new StreamResult(out));

    Saxon has specific extensions. In this case it is <xsl:document>. That looks like a standard XSLT element, but it actually isn't. The history behind it is this: There was a proposal to create a new version of XSLT, called XSLT 1.1. One of the new features of this version was to be this xsl:document element. The author of the Saxon product, Michael Kay, is one of the people on the W3C committee directing the evolution of XSLT, so he upgraded his product to implement XSLT 1.1. But then the committee decided to drop XSLT 1.1 as a recommendation. So that left Saxon in the strange position of implementing a non-existent extension to XSLT.
    The other outcome of this process was that XSLT (1.0) does not have a way of producing more than one output file from an input file. And so the short answer to your question is "Trax can't do that." However, XSLT 2.0 will be able to do that, although it is not yet a formal W3C recommendation, and when it does become one it will take a while before there are good implementations of it. (I predict that Saxon will be the first good implementation.)
    One of the problems with XML and XSLT is that what you knew a year ago is probably obsolete now, because of all the evolution going on. So being new in the field is not a disadvantage, unless you get stung by reading obsolete tutorials or magazine articles.

  • Creating Multiple Bank Branches for a Bank in 11i

    Hello All,
    I am currently trying to create multiple Branches for a Bank in Oracle apps 11.5.10. But I am not able to create.
    I am performing the following procedure:
    Payables, Vision Operations (USA) --> Setup --> Payment --> Banks
    I am able to create one branch but not able to create multiple branches.
    Any suggestion on creating multiple branches for a Bank will be helpful.
    Thanks & Regards
    Aboothahir

    Hello
    The first question you need to answer is are your branches defined as Operating Units in 11i. If they are, Each Payable Manager responsibility can be attached to only one Operating Unit. (Effectively meaning to One Branch only). In which case, you need to define Separate Payable Manager responsibilities for the different Operating Units/Branches.
    But looking at your question again, what i seem to understand is that this may not be your requirement. Your organisation is not a bank, but a company that needs to create separate bank accounts under one bank. Is my understanding correct?
    In which case, follow the below mentioned navigation path
    Payables > Setup > Payment > Banks > [select your bank] > Bank Accounts > And the click on the Bank Account Name and use the down button.
    This will eventually lead to a blank field which will enable you to define a new bank 'ACCOUNT' (Not a branch. But i presume the purpose is still the same?')
    Hope this helps. Do update me if i'm not clear,
    Miranga

  • Creating multiple similar pages in DW

    Hi there,
    I'm trying to create multiple similar pages in DW. It's no funky stuff, just I've got a lot of videos (clean stuff) that I wish to display, one video per page and I've got like a 1000 videos or so.
    Example:
    http://goo.gl/KqdXp
    Now, creating a copy of the page, changing the name and changing the fields in the code for every single page would be an option but would take forever. I wonder if there's a function in DW to automate the process, like creating page after page with only a certain part of the code differing.
    I really need to automate this or my fingers will start bleeding.
    Kind regards
    Pongy
    Contact Details: http://goo.gl/wRVT6

    Yes, I was thinking about creating some sort of database first but as a matter of fact it might just be a better solution to create 1000 pages in this case because I would like to be able to customize each page individually when the need occurs.
    I mean creating a thousand pages is relatively easy per se, it's just that I would like this tiny piece of code to differ between them... I guess DW perhaps does not have a built in function to do this... I was looking to other solutions like Drupal or Joomla but I'm sort of accustomed to using DW for web editing needs and if possible I would like to stick to the same platform that I'm used to rather than engulfing lots of new info about CMS systems... And databases, which I haven't been working a lot with.
    Obviously, creating a 1000 pages might seem brutish at first but I've been thinking about it for a while and I think it could actually suit my needs.

  • How to create multiple buttons in ALV Toolbar in Webdynpro ABAP

    Hi all,
    I am trying to create multiple buttons in Webdynpro  ALV toolbar, please go through the code.
    What happening is, second button is replacing the first one.
    DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
       lo_cmp_usage =   wd_this->wd_cpuse_alv_table( ).
       IF lo_cmp_usage->has_active_component( ) IS INITIAL.
         lo_cmp_usage->create_component( ).
       ENDIF.
       DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
       lo_interfacecontroller =   wd_this->wd_cpifc_alv_table( ).
        DATA lv_value TYPE REF TO cl_salv_wd_config_table.
       lv_value = lo_interfacecontroller->get_model(
       DATA lr_buttonui1 TYPE REF TO cl_salv_wd_fe_button.
       DATA lr_buttonui2 TYPE REF TO cl_salv_wd_fe_button.
       DATA button1 TYPE REF TO cl_salv_wd_function.
       DATA button2 TYPE REF TO cl_salv_wd_function.
    **First button
       CREATE OBJECT lr_buttonui1.
       lr_buttonui1->set_text('Button')."setting the text of the button on alv toolbar
       button1 = lv_value->if_salv_wd_function_settings~create_function( id = 'BUTTON')."creating the function for alv button
       button1->set_editor( lr_buttonui1 ).
    **Second button
       CREATE OBJECT lr_buttonui2.
         lr_buttonui2->set_text('Button1')."setting the text of the button on alv toolbar
       button2 = lv_value->if_salv_wd_function_settings~create_function( id = 'BUTTON' )."creating the function for alv button
       button2->set_editor( lr_buttonui2 ).
    How can I overcome this??
    Thanks
    Eshwar

    Hi Eshwar,
    The button Ids are same for both the buttons in your code. You need to change it as BUTTON1, BUTTON2.
    **First button
       CREATE OBJECT lr_buttonui1.
       lr_buttonui1->set_text('Button')."setting the text of the button on alv toolbar
       button1 = lv_value->if_salv_wd_function_settings~create_function( id = 'BUTTON1')."creating the function for alv button
       button1->set_editor( lr_buttonui1 ).
    **Second button
       CREATE OBJECT lr_buttonui2.
         lr_buttonui2->set_text('Button1')."setting the text of the button on alv toolbar
       button2 = lv_value->if_salv_wd_function_settings~create_function( id = 'BUTTON2' )."creating the function for alv button
       button2->set_editor( lr_buttonui2 ).

Maybe you are looking for

  • How do you disable the sound when sending tweets from "Click to Tweet" in the Notification Center?

    So, ever since the "Click to Tweet" button appeared, anytime you post to Twitter with it, your heard a bird whistling sound. This was cute at first, but has become increasingly annoying (and probably not just to me, but also to my co-workers). Sure,

  • How text data is formated in post script language level 2

    Hi all,    In post script language level 3 files text data is converted to hexadesimal format and kept in between xshow commands. But in postscript language level 2 files, text data is converted to some other format.   Can you please inform me, to wh

  • How to set proxy service monitoring level to Action using script

    We have to enable monitoring at Action level for Proxy service. I have written the code to enable the monitoring at Action level but I am getting Null pointer error. Below is the portion of code I am using for this purpose : String sessionName = crea

  • About the function PDDocSetNewCryptHandler

          can I ask a question?       Now I worked in the Aobe SDK environment, when I used the API function PDDocSetNewCryptHandler,it is always has a compilation error, the error       information is: the PDDocSetNewCryptHandlerSelPROTO has not been de

  • Goods issue person to person

    Dear friends, one basic question. 1) i am having laptop as inventory in my stock. 2) i am issuing this to stores department Mr.XYZ 3) Now Mr.XYZ has left the job and Mr.ABC is taking that laptop , then how can i give it to mr. ABC in sap. In sence th