Displaying different Panels

Hi,
I have a small application that will act as a quiz module for a tutorial I am writing. I am using GridBagLayout to display the first question. When the user gets the right answer or clicks a next button I want another GridBagLayout to display.
Questions:
From a design point of view I could probably use setVisable(true) or false. But is that the most efficient way to do it? If I have ten questions, I would have to create ten different objects. I've posted my code below, I just need a nudge in the right direction or a code snippet that gives me a better understanding.
Thanks,
Steve
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class TestButtonApplicationv1 {
    public static void main(String[] arguments) {
        JFrame frame = new Interface();
        frame.show();
class Interface extends JFrame {
     private dataPanel screenvar;
     private NamePass abcdef;
     private JTextArea msgout;
     Interface () {
          super("This is a JFrame");
        setSize(800, 400);  // width, height
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          JPanel pane = new JPanel();
          // create empty space
          pane.setBorder(BorderFactory.createEmptyBorder(30, 20, 10, 30)); //top, left, bottom, right
          // declare components
          msgout = new JTextArea( 8, 40 );
          NamePass testGrid = new NamePass(screenvar, msgout, abcdef);
          // end declare components
          pane.setLayout(new GridLayout(1, 4, 5, 15));   // one less object to keep track of.
          pane.add(testGrid);
             pane.add( new JScrollPane(msgout));
          msgout.append("Successful");
          setContentPane(pane);
          setVisible(true);
class updateDataFields implements ActionListener {     // 400
     private dataPanel abc;
     private NamePass  def;
     private JTextArea msg;
     int count = 0;
     public updateDataFields(dataPanel xyz, JTextArea msgout, NamePass qrs) {     // 100
          abc = xyz;
          def = qrs;
          msg = msgout;
     }     // 100
     public void actionPerformed(ActionEvent evt) {     // 200
          count++;
          String command = evt.getActionCommand();
               if (command.equals("TestMe")){     // 300
                    msg.append("\nSuccessful");
                    abc.right01.setText("1000");
                    abc.left02.setText("Hi!");
                    abc.right03.setText("123456");
               }     // 300
               if (command.equals("OK")){     // 300
                    msg.append("\nThis is the Okay Button!");
                    abc.left01.setText("1000");
                    abc.left02.setText("1100");
                    abc.left03.setText("1200");
                    abc.right01.setText("2000");
                    abc.right02.setText("2100");
                    abc.right03.setText("2200");
               }     // 300
               if (command.equals("Exit")){     // 400
                         def.answerTextA.setText("" + count);
                         msg.append("\nThis is working" + " " + count);
               }     // 400
     }     // 200
}     // 400
// This is the object that represents one complete question
class NamePass extends JPanel {
    JLabel answerTextA;
    void buildConstraints(GridBagConstraints gbc, int gx, int gy,
        int gw, int gh, int wx, int wy) {
        gbc.gridx = gx;
        gbc.gridy = gy;
        gbc.gridwidth = gw;
        gbc.gridheight = gh;
        gbc.weightx = wx;
        gbc.weighty = wy;
    public NamePass(dataPanel xyz, JTextArea msgout, NamePass qrs) {
      // set up layout
      GridBagLayout gridBag = new GridBagLayout();
      GridBagConstraints constraints = new GridBagConstraints();
      setLayout(gridBag);
      setBorder(BorderFactory.createCompoundBorder(
                                          BorderFactory.createMatteBorder(
                                                          1,1,2,2,Color.blue),
                                BorderFactory.createEmptyBorder(5,5,5,5)));
      // radio button A
      buildConstraints(constraints, 0, 0, 1, 1, 5, 5); // gx, gy, gw, gh, weightx, weighty
      JRadioButton answerA = new JRadioButton( "Answer A", true );
      constraints.fill  = GridBagConstraints.NONE;
      constraints.anchor = GridBagConstraints.WEST;
      gridBag.setConstraints(answerA, constraints);
      add(answerA);
      // radio button B
      buildConstraints(constraints, 0, 1, 1, 1, 5, 5); // gx, gy, gw, gh, weightx, weighty
      JRadioButton answerB = new JRadioButton( "Answer B", false );
       constraints.fill = GridBagConstraints.NONE;
       constraints.anchor = GridBagConstraints.WEST;
      gridBag.setConstraints(answerB, constraints);
      add(answerB);
      // radio button C
      buildConstraints(constraints, 0, 2, 1, 1, 5, 5); // gx, gy, gw, gh, weightx, weighty
      JRadioButton answerC = new JRadioButton( "Answer C", false );
       constraints.fill = GridBagConstraints.NONE;
       constraints.anchor = GridBagConstraints.WEST;
      gridBag.setConstraints(answerC, constraints);
      add(answerC);
      // radio button D
      buildConstraints(constraints, 0, 3, 1, 1, 5, 5); // gx, gy, gw, gh, weightx, weighty
      JRadioButton answerD = new JRadioButton( "Answer D", false );
       constraints.fill = GridBagConstraints.NONE;
       constraints.anchor = GridBagConstraints.WEST;
      gridBag.setConstraints(answerD, constraints);
      add(answerD);
       // answer A
      buildConstraints(constraints, 1, 0, 1, 1, 30, 5); // gx, gy, gw, gh, weightx, weighty
      answerTextA = new JLabel("Answer A");
       constraints.fill = GridBagConstraints.NONE;
       constraints.anchor = GridBagConstraints.WEST;
       gridBag.setConstraints(answerTextA, constraints);
      add(answerTextA);
      // answer B
      buildConstraints(constraints, 1, 1, 1, 1, 30, 5); // gx, gy, gw, gh, weightx, weighty
      JButton answerTextB = new JButton("Answer B");
       constraints.fill = GridBagConstraints.NONE;
       constraints.anchor = GridBagConstraints.WEST;
      gridBag.setConstraints(answerTextB, constraints);
      add(answerTextB);
      // answer C
      buildConstraints(constraints, 1, 2, 1, 1, 30, 5); // gx, gy, gw, gh, weightx, weighty
      JButton answerTextC = new JButton("Answer C");
       constraints.fill = GridBagConstraints.NONE;
       constraints.anchor = GridBagConstraints.WEST;
      gridBag.setConstraints(answerTextC, constraints);
      add(answerTextC);
      // answer D
      buildConstraints(constraints, 1, 3, 1, 1, 30, 5); // gx, gy, gw, gh, weightx, weighty
      JButton answerTextD = new JButton("Answer D");
       constraints.gridx = 1;
       constraints.gridy = 3;
       constraints.gridwidth = 1;
       constraints.gridheight = 1;
       constraints.weightx = 30;
       constraints.weighty = 5;
       constraints.fill = GridBagConstraints.NONE;
       constraints.anchor = GridBagConstraints.WEST;
      gridBag.setConstraints(answerTextD, constraints);
      add(answerTextD);
      // exit button
      buildConstraints(constraints, 0, 4, 2, 1, 0, 5); // gx, gy, gw, gh, weightx, weighty
      JButton exit = new JButton("Exit");
       constraints.fill = GridBagConstraints.NONE;
       constraints.anchor = GridBagConstraints.CENTER;
       exit.addActionListener( new updateDataFields( xyz, msgout, this ));
      gridBag.setConstraints(exit, constraints);
      add(exit);
      setVisible(true);
[\code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

I don't think there is anything wrong with having ten different objects, it's more a matter of how many you want instantiated at a time.
Since it's a quiz, where every page is about the same (except for the number of questions, the text, etc.) you can probably make the quiz panel a class which takes parameters of what the options are, similarly to JOptionPane.
To switch between pages you can use a CardLayout.
Then you just have to decide how many pages you want instantiated at any point in time. You can create each one as needed, or you can create all of them at the start and use the CardLayout to move each one to the front. An in-between solution is create the next one in the background while the user is making their choice.
You might be able to find something like a Wizard component, which does similar things so you can avoid duplicating code.

Similar Messages

  • Display different panel

    Hello,
    I've got a website with a menu bar (left part) and a panel
    (right part).
    I want this :
    The panel display informations about the selected link of the
    menubar.
    e.g :
    When I click on Enterprise, the panel must display
    information about the enterprise.
    The menubar is already created with xml data. The event
    onclick is created too.
    But i don't know how to do a link to a MXML file containing a
    panel!
    The event function :
    private function menuHandler(event:MenuEvent):void {
    CanvasSecondaire.removeAllChildren();
    if (event.item.@data == "linkselected")
    // LINK TO A MXML FILE CONTAINING A PANEL <---- I NEED TO
    KNOW HOW DO THAT
    CanvasSecondaire.addChild(NAMEOFTHEPANEL);
    Can you help me ?
    Thank you !

    Just before adding the panel, you could create an instance of
    the panel to be added, and use the object instance to access the
    public properties of the mxml component you want to add. Once
    you've got the data passed into that mxml component you can bind it
    to whatever control you want to display the data.
    For example:
    if (event.item.@data == "linkselected")
    var objectInstace:mxml_component_name = new
    mxml_component_name();
    objectInstance._publicData = enterpriseData;
    CanvasSecondaire.addChild(NAMEOFTHEPANEL);
    The _publicData is the public bindable variable in the panel
    mxml component, and enterpriseData is the data you want shown in
    the mxml component.
    Hope this helps,
    - Tony

  • Problem updating a control on one panel based on a value change in another control on a different panel

    Hi,
    I am trying to update the value of a control on one panel when the value of another control on a different panel is changed.  The two panels are saved in two different .uir files, so there are two associated .h files generated by CVI.  The problem is that, inside the callback function for the control that is being modified (Ctrl_Id_A on Panel_A), when I call SetCtrlVal(Panel_B, Ctrl_Id_B, Value); 'Panel_B' and 'Ctrl_Id_B' (which have the same numeric values as Panel_A = 1 and Ctrl_Id_A = 2 in their respective .h files) are being interpreted as Panel_A and Ctrl_Id_A.  I never understood how CVI makes this distinction, eg. knowing which of PANEL_A = 1 and PANEL_B = 1 is being referred to, but didn't worry about it since I never needed cross-communication between panels until now.  Any help on how to implement this would be greatly appreciated.  Thanks!
    Solved!
    Go to Solution.

    This is a basic issue on which you can find tons of forum posts
    The online help for the function recitates:
    int SetCtrlVal (int panelHandle, int controlID, ...);
    Parameters
    Input
    Name
    Type
    Description
    panelHandle
    int
    Specifier for a particular panel that is currently in memory. You obtain this
    handle from LoadPanel, NewPanel, or DuplicatePanel.
    controlID
    int
    The defined constant, located in the .uir header file, that you assigned to the control in the User Interface Editor, or the ID returned by NewCtrl or DuplicateCtrl.
    value
    New value of the control. The data type of value must match the data type of the control.
    That is, you must not use the panel constant name in the first parameter of SetCtrlVal, use the panel handle instead. The system guarantees that all panel handles are unique throughout the whole application whichever is the number of panels used in every moment.
    int SetCtrlVal (int panelHandle, int controlID, ...);
    Purpose
    Sets the value of a control to a value you specify.
    When you call SetCtrlVal on a list box or a ring control, SetCtrlVal
    sets the current list item to the first item that has the value you
    specify. To set the current list item through a zero-based index, use SetCtrlIndex.
    When you call SetCtrlVal on a text box, SetCtrlVal appends value to the contents of the text box and scrolls the text box to display value. Use ResetTextBox to replace the contents of the text box with value.
    Note   This function updates the displayed value immediately. Use SetCtrlAttribute with ATTR_CTRL_VAL to set the control value without immediately updating the displayed value. For this reason, SetCtrlAttribute with ATTR_CTRL_VAL is generally faster than SetCtrlVal. However, if the control in which you are setting the value is the active control in the panel, SetCtrlAttribute with ATTR_CTRL_VAL displays the value immediately.
    Note   This function is not valid for graph and strip chart controls.
    Parameters
    Input
    Name
    Type
    Description
    panelHandle
    int
    Specifier for a particular panel that is currently in memory. You obtain this
    handle from LoadPanel, NewPanel, or DuplicatePanel.
    controlID
    int
    The defined constant, located in the .uir header file, that you assigned to the control in the User Interface Editor, or the ID returned by NewCtrl or DuplicateCtrl.
    value
    New value of the control. The data type of value must match the data type of the control.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • One Components into 2 different panel problems

    Hi,
    I have one component, just call it A, and 2 different
    panels just call it PA and PB.
    I put A into PA and then I put A into PB,
    and display PA & PB into screen together.
    The problem is A is missing in PA but displayed
    into PB. I know this is behavior of AWT/Swing,
    but maybe some of you know how to solve
    this problem without creating two instances of A.
    Thank you in advance...

    You could make something like this:
    public class multicomponent
         Vector activecomponents=new Vector
         //all methods you intend to use on this component this way
         public method(somearg arg)
               for //all c in vector
                   c.method(arg);
          public void addto(Container co)
               comp=new yourcomponent();
               co.add(comp);
               activecomponents.add(comp);
    }You can enhance that by using weak references for the elements in the vector and you will have to think what to do for get methods.

  • Display 3 Panels in one frame.....

    Hi
    I need to display 3 different panels in one frame.
    The first panel will contain a JXTreeTable [North]
    The second Panel will contain a Tree [Center]
    The third Panel will contain a JXTreeTable [South]
    I am unable to get this working as the components to be displayed
    are not being placed properly.
    The JXTreeTable is being displayed only at the NORTH.
    Is it better to create 3 different panels or create just one panel with GridLayout(as I have done)
    Have I overlooked something in the code below?
    Thnx
    This is my code:
    public class PositionCostingView {
         public PositionCostingView(){
              initComponents();
         private void initComponents(){
              final JFrame frame = new JFrame("Position Costing");
              frame.setPreferredSize(new Dimension(450, 300));
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              // First,testing my model
              TreeTableModel model = new OpTreeTableModel();
              JXTreeTable treeTable = new JXTreeTable(model);
              // Add the TreeTable to a Scroll Pane.
              JScrollPane scrollPane = new JScrollPane(treeTable);
              JPanel players = new JPanel(new GridLayout(3, 0));
              players.add(scrollPane);
              players.add(MyTree);
              players.add(scrollPane);
              JPanel content = new JPanel();
              content.setLayout(new BoxLayout(content, BoxLayout.PAGE_AXIS));
              content.add(players);
              frame.getContentPane().add(content);
              frame.pack();
              frame.setVisible(true);
         public static void main(String[] args) {
              new PositionCostingView();

    Please ignore my code on top.I am trying something else.....
    No offence meant please.

  • Plz lookin "different panels which can place where ever we need"

    in one jsp how can we create different panels to display where each panel can collapse and can invisible by checking or unchecking it dynamically and each panel can be placed by the user where ever he need it that too the request should not go to the server when user changes the each panels state......
    (any doubts regarding this query are welcome)
    can any one help me out.

    The problem is that this forum does OR logic for its searches.  The most specific you can be is to use only the most unique word you have to use in a normal search.  Otherwise, use a regular web search and specify which site you want to see results
    for.   E.g. in BING or Google you would use the  site:technet.microsoft.com/forums  query term.
    This looks like a very simple case of 'bad engineering'.
    If I am going to have to go out to Google in order to perform a search to get s decent result for a Microsoft database, that really doesn't speak well of Microsoft.
    Sadly however, it really is the case that I get substantially better, more accurate results when using Google then when using Microsoft's TechNet directly - even when the answer is a TechNet forum or knowledgebase article.
    This said, it really doesn't address the question at hand in any way whatsoever.  If you direct your attention to the source question (should be recognizable as it is the big bold letters at the top listed under "Title") the answer being sought
    is regarding finding a way or a person who can "update the product list checkboxes on the left of the Technet search results" - as these, in fact, DO play a role in narrowing out unwanted search results, they are merely being terribly neglected.

  • How to display different parts of an image

    hi,
    I need to display different parts of an image at specific situations.
    for example, a dice. there is only one image which includes different sides of the dice. and I wanna add
    to my panel one side if one comes, two side if two comes... I mean if one comes then we will display
    from 10 px to 80 px width and from 10 px to 80 px height of the dice image.
    is there any way to obtain this in java?
    thanks...

    import java.awt.*;
    import java.awt.font.*;
    import java.awt.geom.*;
    import java.awt.image.BufferedImage;
    import java.util.Random;
    import javax.swing.*;
    public class ImageClipping extends JPanel {
        BufferedImage image;
        Rectangle clip;
        final int ROWS = 3;
        final int COLS = 3;
        public ImageClipping() {
            // Make an image we can clip.
            Dimension d = getPreferredSize();
            int type = BufferedImage.TYPE_INT_RGB;
            image = new BufferedImage(d.width, d.height, type);
            Graphics2D g2 = image.createGraphics();
            g2.setBackground(getBackground());
            g2.clearRect(0, 0, d.width, d.height);
            Font font = g2.getFont().deriveFont(36f);
            g2.setFont(font);
            FontRenderContext frc = g2.getFontRenderContext();
            LineMetrics lm = font.getLineMetrics("0", frc);
            float sh = lm.getAscent() + lm.getDescent();
            int xInc = d.width/COLS;
            int yInc = d.height/ROWS;
            for(int j = 0; j < ROWS; j++) {
                for(int k = 0; k < COLS; k++) {
                    String s = String.valueOf(j*COLS + k+1);
                    float sw = (float)font.getStringBounds(s, frc).getWidth();
                    float sx = k*xInc + (xInc - sw)/2;
                    float sy = j*yInc + (yInc + sh)/2 - lm.getDescent();
                    g2.setPaint(Color.red);
                    g2.drawString(s, sx, sy);
                    g2.setPaint(Color.blue);
                    g2.drawRect(k*xInc, j*yInc, xInc-1, yInc-1);
            g2.dispose();
            clip = new Rectangle(xInc, yInc);
            // Inspect image.
            ImageIcon icon = new ImageIcon(image);
            JOptionPane.showMessageDialog(null, icon, "", -1);
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            Shape origClip = g2.getClip();
            //g2.setPaint(Color.red);
            //g2.draw(clip);
            // Draw clipped image at:
            int x = 100;
            int y = 100;
            // Mark location.
            g2.setPaint(Color.red);
            g2.fill(new Ellipse2D.Double(x-2,y-2,4,4));
            // Position the image.
            g2.translate(x-clip.x, y-clip.y);
            // Clip it and draw.
            g2.setClip(clip);
            g2.drawImage(image,0,0,this);
            // Reverse the changes to the graphics context.
            g2.setClip(origClip);
            g2.translate(clip.x-x, clip.y-y);
        public Dimension getPreferredSize() {
            return new Dimension(400,400);
        public static void main(String[] args) {
            ImageClipping test = new ImageClipping();
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.add(test);
            f.pack();
            f.setLocation(50,50);
            f.setVisible(true);
            test.start();
        private void start() {
            Thread thread = new Thread(runner);
            thread.setPriority(Thread.NORM_PRIORITY);
            thread.start();
        private Runnable runner = new Runnable() {
            Random seed = new Random();
            Dimension d = getPreferredSize();
            int xInc = d.width/COLS;
            int yInc = d.height/ROWS;
            public void run() {
                do {
                    try {
                        Thread.sleep(3000);
                    } catch(InterruptedException e) {
                        break;
                    int row = seed.nextInt(ROWS);
                    int col = seed.nextInt(COLS);
                    int x = col*xInc;
                    int y = row*yInc;
                    int n = row*COLS + col+1;
                    System.out.printf("row = %d  col = %d  n = %d%n",
                                       row, col, n);
                    clip.setLocation(x,y);
                    repaint();
                } while(isVisible());
    }

  • Data communication b/w different panels!!!

    I have two different panels CFtree and CMyTab and I am trying to call a function of CFtree from CMyTab
    //+++++++++++++++++++++++++++++
    //CFtree code...
    // Generating only one object of this class like
    public class CFTree extends JTree implements ActionListener {
    private static CFTree objFeatureTree = null;
    public static CFTree createObject() {
    if (objFeatureTree == null) {
    objFeatureTree = new CFTree();
    return objFeatureTree;
    return objFeatureTree;
    * Get object of CFTree
    * @return CFTree
    public static CFTree getObject() {
    return objFeatureTree;
    public void dummy(){
    System.out.println("Feature tree function called");
    // CMyTab pseudo-code..
    public class CMyTab
    extends JPanel {
    CFTree mFtrTree = CFTree.getObject(); // calling to get current object of CFTree
    // and function acess like
    mFtrTree.dummy();
    As soon as mFtrTree.dummy() is called, following exception is thrown:
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    What can be the reason for this? How can I specify in CMyTab that it is going to call a function placed in a different panel CFTree. What are the way to tackle this problem?
    Please comment!
    Thanks,
    rdh

    In the following statement, please replace "getObject" with "createObject":
    CFTree mFtrTree = CFTree.getObject(); // calling to get current object of CFTree

  • Illustrator CS4 and my drop down menu displaying different typefaces is no longer displaying font preview.

    I am using Illustrator CS4 and my drop down menu displaying different typefaces is no longer showing all of them, just blank spaces where they would be...that is unless I put my cursor over it and I can then see the typeface. This is more of a nuisance than anything and didn't happen until I updates OS X to Yosemite. I currently am operating OS X  Yosemetie 10.10.2
    I have attached a screen shot. You can see that the font highlighted as the cursor is over it I can see the preview...but one I move the cursor it appears like all the others in the list and is blank.
    HELP!

    Solved using this previous users had the same issue; Font previews not appearing correctly in the character window after upgrading to Yosemite

  • Fost Displaying Differently in Different Browsers on Same Computer

    Why would a font display differently on the web page depending on the browser? If the font is installed on the computer (a Mac), isn't it available to all browsers?
    The specific problem I am having is with Palatino shadow. (The shadow is important, as it increases the contrast of the text against the image background.) The shadow shows up in Safari but not in Firefox.
    Why would this be?

    Firefox doesn't do shadows in the current version.

  • How to display different icon within WDA alv table base on row data ?

    Hi,
    is that possible to display different icon for every row within ALV table depending on the row data ?
    for instance if the status 'S' display ~Icon/SuccessMessage and 'E' display ~Icon/ErrorMessage ?
    because base on this code below i only can set 1 icon for the whole row data.
    LOOP AT lt_columns ASSIGNING <fs_column>.
        CASE <fs_column>-id.
          WHEN 'ICO'.
            CREATE OBJECT lr_caption.
               lr_caption->set_image_source( value = '~Icon/SuccessMessage').
               <fs_column>-r_column->set_cell_editor( lr_caption ).
        ENDCASE.
      ENDLOOP.
    Thank you in advance.
    Fernand

    Hello,
    Yes it is possible to display different images based on data.
    For that what you can do is create one attribute 'STATUS' of type string in context node which you are mapping to ALV.
    And fill that attribute with the path to image based on your requirement like for status 'S' set the attribute to ~Icon/SuccessMessage and if status is 'E', set it to ~Icon/ErrorMessage at runtime.
    Now in the settings for ALV use the following code:
    * Display icon in column seatsocc
      DATA: lr_column TYPE REF TO cl_salv_wd_column,
            lr_image TYPE REF TO cl_salv_wd_uie_image,
            lv_icon TYPE string.
      lr_column = lv_model->if_salv_wd_column_settings~get_column( 'SEATSOCC' ).
      CREATE OBJECT lr_image.
      lr_image->SET_SOURCE_FIELDNAME( 'STATUS' ).
      lr_column->set_cell_editor( lr_image ).
    in the above code, column 'SEATSOCC' will be displayed as an icon.
    Sample code to fill the attribute 'STATUS'
    LOOP AT lt_flights INTO ls_flight.
        lv_seatsfree = ls_flight-seatsmax - ls_flight-seatsocc.
        IF lv_seatsfree = 0.
          ls_flight-status = 'ICON_RED_LIGHT'.
        ELSEIF lv_seatsfree <= 50.
          ls_flight-status = 'ICON_YELLOW_LIGHT'.
        ELSE.
          ls_flight-status = 'ICON_GREEN_LIGHT'.
        ENDIF.
        MODIFY lt_flights FROM ls_flight.
      ENDLOOP.
    Hope this helps!
    Regards,
    Srilatha
    Edited by: Srilatha M on Jun 25, 2010 12:02 PM

  • Set Cursor.vi fails after it has been called for 30 different panel refs in LV 7.1.1

    Make sure both attached files (Run LabVIEW_Cursor_TestCase.vi, SimpleVI.vi) are in the same folder. Run LabVIEW_Cursor_TestCase.vi notice that the -3 error code is returned from "Set Cursor.vi" after it has been called with 30 different panel refs. If "Set Cursor.vi" is replaced with "Set Busy.vi" the same error occurs.Is there a workaround for this problem other that setting the cursor image manually in user32.dll? I must be able to open more than 30 panels and set them all to busy. In the test case I used a single VI, simply to demonstrate the error.
    Message Edited by Jerred on 05-04-2007 10:06 AM
    Attachments:
    LabVIEW_Cursor_TestCase.vi ‏68 KB
    SimpleVI.vi ‏13 KB

    This bug is fixed in LabVIEW 8.0 and later.  Unfortunately, I know of no workaround in LabVIEW 7.x.  When I encountered this bug in one of my UIs in LabVIEW 7.x, my "fix" was simply to ignore the error outputs from the cursor VIs, and to live with the fact that I had no custom cursors after 30 windows had been opened.
    -D
    Darren Nattinger, CLA
    LabVIEW Artisan and Nugget Penman

  • How to display different Time Statement forms in ITS service PZ04

    Hi all,
    I am working on a underlyinge R/3 4.7 system and are working with standalone ITS and ESS 50.4. I am posting this question to find out if any of you has experience with my problem.
    The business wishes to use the ITS transation PZ04 standard and wish to be able to display different Time Statement forms in the transaction through customized variants for the report(RPTEDT00) that the PZ04 transaction executes. In the IMG it is posted that one variant has to be created called HRESS_TEDT00 and this works, but restricts the PZ04 transaction to always be called with this variant and therebye the same Time Statement form every time.
    I then by debugging found that the underlying ABAP code processed from SAP standard has a variable VARIANT that is hardcode to = HRESS_TEDT00.
    The question is: Is there anyway to setup the PZ04 transaction so that it can be dynamic decided which variant should be used, f.ex. from persons subarea from infotype 0001?
    Looking forward to here if anybody can help.
    Regards,
    Allan Brauer

    hi allan,
    cud u plz help me how to sort out this problem actually in mu company the same scenario is here need to be display pe51 form instead of standard hrforms.....
    plz help me how will i replace this "hrforms with pe51"..

  • PDFs display differently in Internet Explorer 9 versus FireFox

    We use Adobe Reader X in all cases (10.4.1)
    On old computer, we have a website we go to using Internet Explorer (version 8.x on XP) where we ope/save & print to a PDF file. The information on the PDF prints vaules in a certain order - for example:   A,B, C    --works great--this is what we want it to do.
    We buy a new computer, Windows 7 with IE9, and the PDF displays with the same values in this order:  C,B, A  -   not good, do not want that.
    We try FireFox on the new computer  -- works great --just like it did on the old computer.
    What setting in IE9 is causing this PDF to display differently than in FireFox (or IE8)?
    UPDATE:  We did load IE8 on Windows 7 (by uninstalling IE9) and the PDF works fine --so it's not just something unique to FireFox. IE9 is displaying information in this PDF differently--why?

    Add/update these params in your web.xml and redeploy so the style class names are not optimized and client debugging is easier.
    <context-param>
        <param-name>org.apache.myfaces.trinidad.DEBUG_JAVASCRIPT</param-name>
        <param-value>true</param-value>
      </context-param>
      <context-param>
        <param-name>org.apache.myfaces.trinidad.DISABLE_CONTENT_COMPRESSION</param-name>
        <param-value>true</param-value>
      </context-param>

  • How to make a form dynamic so that it displays different logos at runtime

    I am working on some assignment wherein I would like to make a form dynamic so that in it's designated image holder it displays different logos/pictures at run time? First of all is there such a possibility?? I am still very new to this forum and also trying to understand the logic/bindings/heirarchy etc. in LCD. Any input would be highly appreciated.
    Thanks in advance

    LC 7 or 8 does not help load logs at runtime. However you can associate all your logs at design time and control their visibility property based on the events. This may help fulfill the requirements you have to an extent however adding number of images at design time will increase the size of the template.

Maybe you are looking for

  • How do you Blackout texts in Pages?

    How would you blackout text in Pages ? almost like white out but obviously in black. OS X Yosemite 10.10 Pages-5.5

  • 27" iMac (NON RETINA) video card configuration options!?

    Hello, Regarding the 27" iMac (NON RETINA) model, you have the option to upgrade to either the 2GB NVidia card or the 4GB NVidia card.  I was wondering if the 4GB card is really necessary or if the 2GB card would be more than enough for my needs?  I

  • Why DBA_OBJECTS.TIMESTAMP is defined as VARCHAR2(19)

    Oracle recomends to use TIME STAMP datatypes for timestamp information but itself it is using VARCHAR2(19) for DBA_OBJECTS.TIMESTAMP can any body explain Why it is so? Oracle version is 10.2.0 thanks in advance.

  • Create XML element without closing tag using Visual C++

    I know how to create xml element with closing tag (using WriteStartElement and WriteEndElement methods) <tag id="1234"> </tag> but is there a way in Visual C++ to produce xml element like this <tag id="1234"/> i.e. without closing tag?

  • Person Assignment to Operation & Graphical Monitor of Persons.

    Hi 1.I am checking Graphical Monitoring of Maintenance Person after assigning  in Work Order Operations & saving it. For Ex In Maint Order , I have assigned 10 hrs for Main Person 1 , it's Visible in Graph showing Person 1 color marked for 10 hrs . b