Checkbox in front of formitem label

Hi,
    I use flex 3 to design a form, i want a check box before every label, i tried without setting label property in formitem but the component alignment is not good as below
is there a way to add check box before the label or is there anyother layout  that will suit for this requirement. Please provide me a sample code if possible
thanks
prasad

Prasad,
Add label property to the checkbox.
checkout this below example:
<?xml version="1.0"?>
<!-- containers\layouts\FormReqFieldRuntime.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Form>
        <mx:FormItem label="Subscribe">
            <mx:CheckBox label="Subscribe?"
                click="emAddr.required=!emAddr.required;"/>
        </mx:FormItem>
        <mx:FormItem id="emAddr" label="E-mail Address">
            <mx:TextInput id="emailAddr"/>
        </mx:FormItem>
    </mx:Form>
</mx:Application>
For More info: http://livedocs.adobe.com/flex/3/html/help.html?content=layouts_08.html
-Shravan P.

Similar Messages

  • Make FormItem label text word wrap?

    I am building a form, but my labels are fairly long
    sentences. Is there a way to make the FormItem labels wrap? I tried
    defining the labelWidth, but it just truncates the text with "..."
    If there is no way to add a break in the label or make it
    wrap, what is the best way to do this? With a bunch of
    HBox's?

    That's not entirely true. If you use the mx_internal
    namespace you can modify the Label's internal UITextField and
    enable wrapping. Something like:
    formItem.itemLabel.mx_internal::getTextField().wordWrap =
    true;

  • FormItem label - moving with paddingTop

    i have been trying to line up a formItem label with my custom
    fields and have discovered that with comboBoxes or textInput
    fields, you can move the y location of the formItem label to line
    up horizontally with the comboBox/textInput textfield with the
    'paddingTop' property (of the comboBox/textInput component).
    This is great, however moving the formItem label with the
    field paddingTop property doesn't work with:
    dateFields, as they don't have a paddingTop property,
    a custom field that i created based on a HBox,
    or TextArea fields
    My question - is there an alternative way to move a formItem
    label in the y direction?
    (the reason i ask is that the label isn't sitting nicely
    aligned with my custom fields)

    Probably not the response you want, but...
    Don't use Form. I never have because it is too inflexible,
    and provides too little benefit.
    Tracy

  • Button to enable all checkboxes on front panel

    I have checkbox controls on the front panel to select various functions of my VI.  I would like to have buttons to check ("enable all") and un-check ("disable all") all the checkboxes at once, if desired.  Preferably, I'd like to see the boxes activate (show the checkmark) prior to starting the VI -- like they do when you select them one by one.  I am fairly new to LabView & am using 7.0 Pro.  Any help would be appreciated.
    JH

    Here's a picture of the code. Pretty simple.
    Message Edited by altenbach on 04-05-2006 09:23 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    AllOnOff.png ‏7 KB

  • FormItem label left align issue

    hi experts,
    I am very new to Flex. I am using Flex API and i have some issue with FormItem. I cannot make the labels left align. I found a style in web which is as follows.
    <mx:Style>
    .rightAlignedLabels {
    text-align: center;
    FormItem {
    labelStyleName:rightAlignedLabels;
    </mx:Style>
    I want this to be used in my action script.But i do not understand to set this style via the API methods. I tried different ways as follows.
    new FormItem().setStyle(..,..);
    But still i coudn't figure it out. Please can sombody help.
    Thanks,
    Harshi

    FormItem
        labelStyleName    :     myFormItemLabelStyleName;
    .myFormItemLabelStyleName
         text-align        :    left;

  • Edit Disable Panel Grid Alignment does not affect the Positionin​g of Front Panel Labels

    In LabVIEW 2010, when I choose Edit>> Disable Panel Grid Alignment the positioning of Front Panel objects gets much finer so that I can make small adjustments. Put it does not seem to affect the positioning of front panel object labels. These object labels still move in very coarse increments and do not allow me to position them carefully.
    How do I turn off the Grid Panel alignment for Front Panel Labels?

    The positioning of labels you encounter has not so much to do with any grid, but with the fact that for labels, LabVIEW attempts to snap them to one of the control corners if you get close enough to the owning control. Outside of a certain range of the owning control you should be able to place them easily on any pixel. The snap behaviour of owned objects is not configured through the panel grid option. I'm not aware of an option to disable this behaviour, but usually find it rather handy instead of annoying. If it happens to not be exactly as desired, I adjust with the label selected and using the cursor keys.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • How do I get the Label for a Front Panel Control to appear in the Block Diagram but not on the Front Panel?

    How do I get the Label for a Front Panel Control to appear in the Block Diagram but not on the Front Panel? On the Front Panel I am making a complex control that consists of a Slider and a Numerical Input box. Both Controls display the same information and either can be used for Input. When one changs, the other is made to display the same value.
     But I only want the Slider to display the Label on the Front Panel, to avoid confusion. On the Block Diagram however, I want both controls to display their Labels so that I know what they are. How do I display the Label for a Control on the Block diagram, but not display its Label on the Front Panel?

    No.  The Label Visible property is separate for the front panel control label and the block diagram terminal label.
    How did you start out with the block diagram's label not being visible?  Whenever I drop a control or indicator, the label is always visible on both the FP and BD by default.  Maybe there is a LabVIEW option that causes new controls/indicators not to have their labels visible by default, but I have yet to find it.  I don't think an item should ever be dropped without the label visible, good LabVIEW coding practice demands that the labels for control terminals on the block diagram be visible so that you know what control or indicator a wire is going to.
    That being said, I have seen a lot of VI's posted where the label for the terminal on the BD is not shown (against good programming practice.)  I've gone to the BD and right clicked to show the label.  Sometimes, the people have an empty label (which will turn off the visibility for both the FP and BD) and I'm forced to add some text of my own into the label so I can figure out what their code is doing.  When I add some text to the label, at that time, I find both the BD and FP labels become visible.
    Are you dealing with controls that have empty labels to start?
    Good programming practices:
    1.  Always have a name for all of your controls, never use and empty label by deleting the text in the label.
    2.  Make the labels unique.  For example, don't have two controls both called Stop.  How do you know quickly know which terminal relates to which control?
    3.  Always show the labels on the block diagram, so you know the function of a control's terminal.  If you want to hide the label on the FP, that's okay.
    4.  If you want a different label to appear on the FP than whatever you actually called the control, then use the caption.  You can hide the label and show the caption.  This is useful if you need to programmatically change what the "label" is on the front panel such if you are making an application that needs to change its user interface such as for a foreign language.

  • How can I get label of Checkbox?

    Hi,
    I have created the following checkboxes
    private Checkbox playingCB, recordingCB, playbackCB;
    private CheckboxGroup cbg;
    playbackCB = new Checkbox("Playback mode", cbg, false);
    I'm trying to get the "Playback mode" label in my actionPerformed(ActionEvent event) method
    I have tried the getActionCommand() but it didn't work on Checkbox
    It works on getting label of Button
    How can I solve this problem when I really need to do it with actionPerformed method?
    Thx
    jojo

    I don't know for sure, but having looked at the API documentation (http://java.sun.com/j2se/1.4.2/docs/api/) I'd guess.......
    Checkbox selectedCheckBox = cbg.getSelectedCheckbox();
    selectedCheckBox.getLabel();So maybe you need to pass your event handling class constructor a CheckboxGroup object, so you can then call the above code?

  • Checkbox Group Labels

    Hi
    I am Created checkbox group called "Gender".Automatically there are 3 checkboxes created with this with labels as "Lebel1","Label2","Label3".Now i want to change "Label1","Label2","Label3" as "Male","Femele","NotSpecified".At design time how to change these labels.I tried to change the "texts" property.can anybody help me?
    Thanks
    Prasad

    Hi Armin,
    I am trying to create a Checkbox group. I created a value attribute and binded it to simple datatype containg list of items in enumeration. Then I binded the Checkbox group "texts" property with the value attribute.
    In the layout wizard all items are visible but at runtime none of them is visible.
    Cardinality of node containing the value arrtibute is 0..n. I have checked it for 1..n also.
    Please tell me what could be the possible reason behind it.
    thanks in advance!

  • Custom DefaultTreeCellRender not rending node labels correctly.

    In our JTree we need to display the state of our custom nodes, the state can be cycled by the user clicking on the node. Our problem is that since upgrading from Java 1.4 if a node is clicked before it is expanded the child nodes will not be rendered correclty, some nodes may not have the label showing, some may not have the label or icon showing.
    Under Java 1.4 the following code works correctly.
    Under Java 1.5 and 1.6 If you click on a node before expanding it (which changes the node's icon) then expand the node the child nodes are not completely rendered, some may be missing a icon or label or both.
    package com.test;
    import java.awt.BorderLayout;
    import java.awt.Component;
    import java.awt.FlowLayout;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import javax.swing.Box;
    import javax.swing.Icon;
    import javax.swing.JButton;
    import javax.swing.JCheckBox;
    import javax.swing.JPanel;
    import javax.swing.JTree;
    import javax.swing.UIManager;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.tree.DefaultTreeCellRenderer;
    import javax.swing.tree.DefaultTreeModel;
    import javax.swing.tree.TreePath;
    * Example to demonstate differences between Java 1.4 and Java 1.5/1.6
    * node rendering.
    * <p>
    * Under Java 1.4 nodes are always rendered correctly.
    * <p>
    * Under Java 1.5 and 1.6 If you click on a node before expanding it (which
    * results in the icon changing) then expand the node not all child nodes
    * will be fully rendered.
    public class TreeNodeRenderExample extends javax.swing.JFrame {
        private static final long serialVersionUID = 7963956320358601702L;
        private JTree tree1;
         * Entry point.
         * @param args Arguments are ignored.
        public static void main(String[] args) {
            TreeNodeRenderExample inst = new TreeNodeRenderExample();
            inst.setVisible(true);
         * Constructor.
         * <br>
         * Create a instance of TreeNodeRenderExample.
        public TreeNodeRenderExample() {
            super();
            initGUI();
            populateTree();
            postInitGUI();
         * Create the Frame and JTree.
        private void initGUI() {
            try {
                    this.setTitle("Checkbox node Render Example");
                    tree1 = new JTree();
                    getContentPane().add(tree1, BorderLayout.CENTER);
                setSize(400, 300);
            } catch (Exception e) {
                e.printStackTrace();
         * Add the custom cell renderer and a mouse listener.
        private void postInitGUI() {
            tree1.setCellRenderer(new NodeRenderer());
            tree1.addMouseListener(new TreeMouseClickSelectionListener(tree1));
         * Populate the tree.
        private void populateTree() {
            TreeNode root = new TreeNode("Render Example");
            TreeNode colourNode = new TreeNode("Colours");
            TreeNode modelNode = new TreeNode("Models");
            colourNode.add(new TreeNode("Black"));
            colourNode.add(new TreeNode("White"));
            colourNode.add(new TreeNode("Blue"));
            modelNode.add(new TreeNode("Ford"));
            modelNode.add(new TreeNode("Fiat"));
            modelNode.add(new TreeNode("Nissan"));
            root.add(modelNode);
            root.add(colourNode);
            tree1.setModel(new DefaultTreeModel(root));
         * Custom tree node to allow the icon to be changed when the node
         * is clicked.
         * <p>
         * This is a simple example, our custom nodes hold much more state
         * information and get node children on the fly.
        class TreeNode extends DefaultMutableTreeNode {
            private static final long serialVersionUID = 7527381850185157388L;
             * Constructor.
             * <br>
             * Create a instance of TreeNode.
             * @param name Tree node display name.
            public TreeNode(String name) {
                this.name = name;
                this.state = "u";
             * Just cycle through some states so that the icon can
             * can be changed depending on how may 'clicks' on the node.
            public void updateSelectionStatus() {
                if (state.equals("u")) {
                    state = "s";
                } else if (state.equals("s")) {
                    state = "d";
                } else if (state.equals("d")) {
                    state = "u";
             * Get the icon to be used for the check box, shows the current
             * state of a node to the user.
             * @return A icon.
            public Icon getIcon() {
                Icon icon = null;
                if (state.equals("u")) {
                    icon = UIManager.getIcon("FileView.directoryIcon");
                } else if (state.equals("s")) {
                    icon = UIManager.getIcon("FileView.fileIcon");
                } else if (state.equals("d")) {
                    icon = UIManager.getIcon("FileView.computerIcon");
                return icon;
             * String representation of a node.
             * @see javax.swing.tree.DefaultMutableTreeNode#toString()
            public String toString() {
                return name;
            private String name;
            private String state;
         * Custom node render, adds a checkbox in front of the node, could be
         * any object that we can change the icon for, this will show the
         * user the current state of the selected node.
        class NodeRenderer extends DefaultTreeCellRenderer {
            private static final long serialVersionUID = -7358496302112018405L;
            protected JCheckBox checkBox = new JCheckBox();
            //protected JButton checkBox = new JButton();
            private Component strut = Box.createHorizontalStrut(5);
            private JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER,0,0));
             * Constructor.
            public NodeRenderer() {
                setOpaque(false);
                this.checkBox.setOpaque(false);
                this.panel.setBackground(UIManager.getColor("Tree.textBackground"));
                this.panel.setOpaque(false);
                this.panel.add(this.checkBox);
                this.panel.add(this.strut);
                this.panel.add(this);
             * Render the label, then change the icon if necessary.
             * @see javax.swing.tree.DefaultTreeCellRenderer#getTreeCellRendererComponent(javax.swing.JTree, java.lang.Object, boolean, boolean, boolean, int, boolean)
            public Component getTreeCellRendererComponent(JTree tree, Object value,
                boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus)
                super.getTreeCellRendererComponent(tree, value,
                    sel, expanded, leaf, row, hasFocus);
                updateDisplayedStatus((TreeNode)value);
                return this.panel;
             * Set the node's icon.
             * @param node Rendered node.
            private void updateDisplayedStatus(TreeNode node) {
                this.checkBox.setIcon(node.getIcon());
         * Listener to allow cycling of node states by clicking on the node.
        class TreeMouseClickSelectionListener extends MouseAdapter {
            private JTree tree;
            private int hotspot = new JCheckBox().getPreferredSize().width;
             * Constructor.
             * <br>
             * Create a instance of TreeMouseClickSelectionListener.
             * @param tree Tree listener is attached to.
            public TreeMouseClickSelectionListener(JTree tree) {
                this.tree = tree;
             * Cycle the state of a clicked node.
             * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent)
            public void mouseClicked(MouseEvent me) {
                int x = me.getX();
                int y = me.getY();
                int row = tree.getRowForLocation(x, y);
                TreePath path = tree.getPathForRow(row);
                if (path != null)
                    if(x <= tree.getPathBounds(path).x + hotspot)
                        TreeNode node = (TreeNode) path
                            .getLastPathComponent();
                        if (node != null)
                            node.updateSelectionStatus();
                            tree.repaint();
    }

    I can't recreate your problem. I'm running 1.5.0_09. When I open the program and JUST expand the nodes I see all "file" icons and all the labels work correctly. If i Select a node before expanding it, I get the same result.
    What Am I supposed to witness happening?
    -Js

  • Update Jcombobox 's label in render

    hi ,everybody, i have a problem about combobox, any body can help me!
    thank you!
    I want to have a combobox with checkbox as item, I rewrite a render writen by ice, because the combobox has three state, when I click diferent checkbox in this combobox , the label of combobox will update rightly, but if I click one checkbox to change the checkbox state ,the label will no update , it seem that when I click one checkbox many times .the menthod
    getListCellRendererComponent(JList list, Object value, int index,
                        boolean isSelected, boolean cellHasFocus)
    will no update label
    my code :
    mainclass:
    import java.awt.BorderLayout;
    import java.awt.Component;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.util.Iterator;
    import java.util.Vector;
    import javax.swing.DefaultListCellRenderer;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JList;
    import javax.swing.JPanel;
    import javax.swing.plaf.basic.BasicComboBoxEditor;
    public class mainclass {
          public static void main(String[] args) {
                 final testbox myComboBox = new testbox();
                 myComboBox.addItem("SelectAll");
                 myComboBox.addItem("ClearAll");
                 myComboBox.addItem("GrayedAll");
                 for(int i = 0; i < 5; i++) {
                     myComboBox.addItem("Item " + i);
                 JFrame frame = new JFrame("My ComboBox");
                 frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
                 frame.setSize(150, 60);
                 frame.setLocation(300, 300);
                 //frame.setJMenuBar( menubar );
                 JPanel panel=new JPanel();
                 panel.setLayout(new BorderLayout());
                 panel.add(myComboBox,BorderLayout.NORTH);        
                 frame.getContentPane().add(panel);
                 frame.setVisible(true);
                 final IconedCellRendererField renderer = IconedCellRendererField.getCheckBoxRendererInstance();
                 myComboBox.setRenderer(renderer);
                 myComboBox.addActionListener(new ActionListener()
                     public void actionPerformed(ActionEvent e)
                          if(myComboBox.getSelectedItem().toString().equals("SelectAll")){
                               renderer.selectAll(true);                         
                          if(myComboBox.getSelectedItem().toString().equals("ClearAll")){
                               renderer.clearAll(true);
                          if(myComboBox.getSelectedItem().toString().equals("GrayedAll")){
                               renderer.grayedAll(true);
    }renderer:
    import java.awt.*;
    import java.awt.event.*;
    //import java.io.*;
    //import java.net.*;
    import java.util.*;
    import javax.swing.*;
    //import javax.swing.event.*;
    import javax.swing.border.*;
    //import javax.swing.table.*;
    public class IconedCellRendererField extends DefaultListCellRenderer implements MouseListener {
         public Icon icon, selIcon;
         Icon[] icons = null;
         public boolean useIconBackground = true, useIndexSensitiveIcons = false,
                   useCheckBoxAsIcon = false, useLinkState = false;
         Dimension labelDim = null;
         public JLabel iconLabel;
         public JCheckBox box = null;
         public JPanel noback;
         public SelectionStateHandler selStateHandler = null;     
         private JList theList = null;
         public boolean[] selState = null, enableState = null;
         int offset = 5;
         Rectangle rect = null;
         int currentLinkRow = -1;
         boolean isOnRow = false, paintDivider = false;
         private Icon dividerImage = null;     
         private Color linkColor = Color.blue, hoverColor = Color.red, selectedLinkColor = Color.green;
         /* Initialises the renderer with one icon that is displayed without the
          * cell background.
         public IconedCellRendererField(Icon icon) {
              this(icon,false);
         /* Initialises the renderer with two icons that provide a switch capability
          * when a row is selected/deselected
         public IconedCellRendererField(Icon icon, Icon selIcon) {
              this.icon = icon;
              this.selIcon = selIcon;
              //addMouseListener(this);
         /* Initialises the renderer with two icons that provide a switch capability
          * when a row is selected/deselected. The boolean argument enables the icon
          * to either use the renderer background or appear transparent.
         public IconedCellRendererField(Icon icon, Icon selIcon, boolean useIconBackground) {
              this(icon, selIcon);
              setIconHasBackground(useIconBackground);
              createNoBackgroundPanel();
         /* Initialises the renderer with a single no siwthing icon. The boolean
          * argument enables the icon to either use the renderer background
          * or appear transparent.
         public IconedCellRendererField(Icon icon, boolean useIconBackground) {
              this(icon, icon, useIconBackground);
         /* Initialises the renderer to load two icons from the provided image locations.
          * This enables icon switching on selection.
         public IconedCellRendererField(String iconLoc, String selIconLoc) {
              icon = new ImageIcon(iconLoc);
              selIcon = new ImageIcon(selIconLoc);
              //addMouseListener(this);
         /* Initialises the renderer to load a single icon from the provided image location.
          * The icon can either have the renderer background or not based on the
          * boolean property.
         public IconedCellRendererField(String iconLoc, boolean iconBackground) {
              this(iconLoc, iconLoc, iconBackground);
         /* Initialises the renderer to load two icons from the provided image locations.
          * This enables icon switching on selection. The icon can either have the renderer
          * background or not based on the boolean property.
         public IconedCellRendererField(String iconLoc, String selIconLoc, boolean iconBackground) {
              this(iconLoc, selIconLoc);
              setIconHasBackground(iconBackground);
              createNoBackgroundPanel();
         /* Initialises the renderer to load a single icon from the provided image location.
         public IconedCellRendererField(String iconLoc) {
              this(iconLoc, true);
         /* Initialises the renderer with an array of image icons that are repeated for
          * each row in the list.
         public IconedCellRendererField(Icon[] icons, boolean useIconBackground) {
              this(icons[0], icons[0], useIconBackground);
         public void createNoBackgroundPanel() {
              iconLabel = new JLabel((Icon)null, JLabel.CENTER);
              if(labelDim != null) {      iconLabel.setPreferredSize(labelDim); }
              iconLabel.setBorder( new EmptyBorder(1,5,1,5) );
              noback = new JPanel( new BorderLayout() ) {
                  * Overridden for performance reasons.
                  * See the <a href="#override">Implementation Note</a>
                  * for more information.
                  //public void validate() {}
                 // public void invalidate() {}          
                  public void repaint() {}
                  //public void revalidate() {}
                  public void repaint(long tm, int x, int y, int width, int height) {}
                  public void repaint(Rectangle r) {}
                  protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
                        // Strings get interned...
                        if (propertyName == "text"
                                   || ((propertyName == "font" || propertyName == "foreground")
                                       && oldValue != newValue)) {
                            super.firePropertyChange(propertyName, oldValue, newValue);
                  public void firePropertyChange(String propertyName, byte oldValue, byte newValue) {}
                  public void firePropertyChange(String propertyName, char oldValue, char newValue) {}
                  public void firePropertyChange(String propertyName, short oldValue, short newValue) {}
                  public void firePropertyChange(String propertyName, int oldValue, int newValue) {}
                  public void firePropertyChange(String propertyName, long oldValue, long newValue) {}
                  public void firePropertyChange(String propertyName, float oldValue, float newValue) {}
                  public void firePropertyChange(String propertyName, double oldValue, double newValue) {}
                  public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) {}
              if(useCheckBoxAsIcon()) {
                   box = new JCheckBox();
                   //box.addMouseListener(this);
                   box.setOpaque(false);
                   noback.add( box, BorderLayout.WEST );
                   //noback.addMouseListener(this);
                   rect = box.getBounds();
                   //list.addMouseListener(this);
              } else {
                   noback.add( iconLabel, BorderLayout.WEST );
              noback.add( this, BorderLayout.CENTER );
              noback.setBorder( new EmptyBorder(1,1,1,1) );
              noback.setOpaque(false);
         public Component getListCellRendererComponent(JList list, Object value, int index,
                        boolean isSelected, boolean cellHasFocus) {
              System.out.println(value+"+"+index+"+"+isSelected+"+"+cellHasFocus);
              if(theList == null || theList != list) {
                   theList = list;
                   if(useLinkState) {
                        attachLinkSimulationListener();
              setOpaque(true);
              setText( value == null ? "" : value.toString());
              if(useIndexSensitiveIcons) {
                   icon = getIcon(index);
              if(useIconBackground)
                   setIcon(icon);          
              setFont( list.getFont() );
              setToolTipText(value.toString() );
              if(list.isEnabled())
                   setEnabled( isEnabled(index) );
              else
                   setEnabled( list.isEnabled() );
              if(isSelected && isEnabled(index) ) {
                   setForeground( Color.black );
                   setBackground( new Color(223, 235, 245) );
                   if(useIndexSensitiveIcons) {
                        selIcon = getIcon(index);
                   if(useIconBackground)
                        setIcon(selIcon);
              } else {
                   setForeground(Color.black);
                   setBackground(Color.white);
                   setBorder(null);
              if(cellHasFocus) {
                   setBorder( new CompoundBorder( new LineBorder( new Color(150, 150, 220) ),
                                                      new EmptyBorder(2,2,2,2)  ) );
              } else {
                   setBorder( new EmptyBorder(2,2,2,2));
              if(useLinkState) {
                   if(currentLinkRow == index) {
                        setText("<html><u>" + value.toString()+"</u></html>" );     
                        setForeground( getHoverLinkColor() );               
                   } else {
                        setForeground( getLinkColor() );
                   if(isSelected) {
                        setForeground( getSelectedLinkColor() );
                   setBackground(Color.white);
                   setBorder( new EmptyBorder(1,1,1,1) );
              if( shdPaintDivider() ) {
                   Border border = null;
                   if(dividerImage != null) {
                        border = new MatteBorder(0,0,1,0, dividerImage);
                   } else {
                        border = new MatteBorder(0,0,1,0, getLinkColor() );
                   if(index < theList.getModel().getSize() - 1 ) {
                        setBorder( new CompoundBorder(getBorder(),border) );
                   } else {
                        setBorder( new EmptyBorder(1,1,1,1) );
              if(useIconBackground == false) {
                  if(isSelected)
                      iconLabel.setIcon(selIcon);
                  else
                      iconLabel.setIcon(icon);
                  if(useCheckBoxAsIcon()) {
                      if(selState == null) {
                          updateSelectionStateTrackers(list);
                      if(selStateHandler == null) {
                          list.addMouseListener( selStateHandler = new SelectionStateHandler(list) );
                      try {
                          box.setSelected( selState[index] );
                      } catch(Exception e) {}
                  if( shdPaintDivider() ) {              
                      //if(index < theList.getModel().getSize() - 1 ) {
                          noback.setBorder( getBorder() );
                          setBorder( new EmptyBorder(1,1,1,1) );
                      //} else {
                      //  noback.get
                  // this should cause a JComboBox to paint the Label instead of the
                  // check box + label combination
                  if(index == -1) {
                       Vector<Object> v=new Vector<Object>();
                       v=getSelectedObjects();
                        String val=generateString();
                       JLabel label=new JLabel(val);                    
                      if(iconLabel.getIcon() != null) {
                           label.setIcon( iconLabel.getIcon() );
                      System.out.println("label");
                      return label;
                  return noback;
              return this;
         public String generateString()
              String val = "";
              if(selState[0]==true&&selState[1]==false&&selState[2]==false){
                    for(int i = 3; i < theList.getModel().getSize(); i++) {
                           String curString=theList.getModel().getElementAt(i).toString();
                           if(val.length()==0){
                                  val=val+curString+"-1";
                           } else {                              
                                  val=val+"&"+curString+"-1";
               //clear all     
               if(selState[1]==true&&selState[0]==false&&selState[2]==false ){                                   
                      for(int i = 3; i < theList.getModel().getSize(); i++) {
                           String curString=theList.getModel().getElementAt(i).toString();
                           if(val.length()==0){
                                  val=val+curString+"-0";
                           } else {                              
                                  val=val+"&"+curString+"-0";
              //grayedall
               if(selState[2]==true&&selState[0]==false&&selState[1]==false ){                                   
                      val="";                      
               if(selState[0]==false&&selState[1]==false&&selState[2]==false ){
                    for(int i = 3; i < theList.getModel().getSize(); i++) {
                           String curString=theList.getModel().getElementAt(i).toString();
                           if(selState==true&&enableState[i]==false){
                             continue;
                        if(selState[i]==true&&enableState[i]==true){
                             if(val.length()==0){
                                       val=val+curString+"-1";
                             } else {                              
                                       val=val+"&"+curString+"-1";
                        if(selState[i]==false&&enableState[i]==true){
                             if(val.length()==0){
                                       val=val+curString+"-0";
                             } else {                              
                                       val=val+"&"+curString+"-0";
              return val;
         public void updateSelectionStateTrackers(JList list) {
              selState = new boolean[ list.getModel().getSize() ];
              enableState = new boolean[ list.getModel().getSize() ];
              for(int i = 0; i < selState.length; i++) {
                   selState[i] = false;
                   enableState[i] = true;
         public int[] getSelectedIndices() {
              if(!useCheckBoxAsIcon()) {
                   return new int[0];
              int length = 0;
              if(selState==null){
                   return null;
              for(int i = 0; i < selState.length; i++) {
                   if(selState[i]) {
                        length++;
              int[] indices = new int[length];
              for(int i = 0, n = 0; i < selState.length; i++) {
                   if(selState[i]) {
                        indices[n++] = i;
              //System.out.println("Selected Indices.length = " + indices.length);
              return indices;
         public Vector<Object> getSelectedObjects() {
              int[] indices = getSelectedIndices();
              Vector<Object> objects = new Vector<Object>();
              if(indices==null){
                   return null;
              for(int i = 0; i < indices.length; i++) {
                   objects.addElement( theList.getModel().getElementAt(indices[i]) );
              return objects;
         public void setIconHasBackground(boolean b) {
              useIconBackground = b;
         public Icon[] getIcons() {
              return icons;
         public Icon getIcon(int index) {
              if(icons != null && icons.length == 0) {
                   return icon;
              if(icons != null && index > icons.length) {
                   index = index - (icons.length - 1);
              return icons[index];
         public void setIcons(Icon[] icons) {
              if(icons != null) {
                   useIndexSensitiveIcons = true;
              this.icons = icons;
         public void setIcon(Icon icon, int index) {
              if(icons != null && icons.length > 0) {
                   icons[index] = icon;
         public void setIconLabelDimension(Dimension dim) {
              labelDim = dim;
         public static IconedCellRendererField getCheckBoxRendererInstance() {
              IconedCellRendererField cr = new IconedCellRendererField(new EmptyIcon());
                   cr.setUseCheckBoxAsIcon(true);
              return cr;
         public void setUseCheckBoxAsIcon(boolean use) {
              useCheckBoxAsIcon = use;
              createNoBackgroundPanel();
         public boolean useCheckBoxAsIcon() {
              return useCheckBoxAsIcon;
         public void paintComponent(Graphics g) {
              super.paintComponent(g);
         public void setDisplayItemsAsLinks(boolean use) {
              useLinkState = use;
         public void setLinkColor(Color color) {
              linkColor = color;
              if(theList != null) {
                   theList.repaint();
         public Color getLinkColor() {
              return linkColor;
         public void setHoverLinkColor(Color color) {
              hoverColor = color;
              if(theList != null) {
                   theList.repaint();
         public Color getHoverLinkColor() {
              return hoverColor;
         public void setSelectedLinkColor(Color color) {
              selectedLinkColor = color;
              if(theList != null) {
                   theList.repaint();
         public Color getSelectedLinkColor() {
              return selectedLinkColor;
         public void attachLinkSimulationListener() {
              theList.setCursor( Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) );
              theList.addMouseListener( new MouseAdapter() {
                   public void mouseEntered(MouseEvent e) {
                        isOnRow = true;                    
                   public void mouseExited(MouseEvent e) {
                        isOnRow = false;
    currentLinkRow = -1;
    theList.repaint();
              theList.addMouseMotionListener( new MouseMotionAdapter() {
                   public void mouseMoved(MouseEvent e) {
    isOnRow = true;
    currentLinkRow = theList.locationToIndex( e.getPoint() );
    theList.repaint();
              /*table.addMouseListener(new MouseAdapter() {
    public void mouseEntered(MouseEvent e) {
    public void mouseExited(MouseEvent e) {
    isOnRow = false;
    currentHighlightRow = -1;
    table.repaint();
    table.addMouseMotionListener( new MouseMotionAdapter() {
    public void mouseMoved(MouseEvent e) {
    isOnRow = true;
    currentHighlightRow = table.rowAtPoint( e.getPoint() );
    table.repaint();
         public boolean shdPaintDivider() {
              return paintDivider;
         public void setPaintDivider(boolean paintDivider) {
              this.paintDivider = paintDivider;
         public void setDividerImage(Icon icon) {
              this.dividerImage = icon;
              setPaintDivider(true);
         private void dispatchEvent(MouseEvent me) {
    if(rect != null && box != null && rect.contains(me.getX(), me.getY())){
    Point pt = me.getPoint();
    pt.translate(0,0);
    box.setBounds(rect);
    box.dispatchEvent(new MouseEvent(box, me.getID()
    , me.getWhen(), me.getModifiers()
    , pt.x, pt.y, me.getClickCount()
    , me.isPopupTrigger(), me.getButton()));
    if(!box.isValid()) {
         repaint();
         System.out.println("Dispatch Event: Box.invalid called");
    System.out.println("Dispatch Event called");
    } else {
         System.out.println("Dispatch Event Called, rect null");
    public void mouseClicked(MouseEvent me){
    dispatchEvent(me);
    public void mouseEntered(MouseEvent me){
    dispatchEvent(me);
    public void mouseExited(MouseEvent me){
    dispatchEvent(me);
    public void mousePressed(MouseEvent me){
    dispatchEvent(me);
    public void mouseReleased(MouseEvent me){
    dispatchEvent(me);
    public class SelectionStateHandler extends MouseAdapter {
         JList list = null;
         public SelectionStateHandler(JList list) {
              this.list = list;
         public void mouseClicked(MouseEvent e)
              * Handles the checkbox selection process. Uses the bounds property of the
              * check box within the selected cell to determine whether the checkbox should
              * be selected or not
              public void mouseReleased(MouseEvent e) {
                   /*if(list == null || list.getSelectedIndex() == -1
         || !isEnabled( list.locationToIndex(e.getPoint()) ) ) {
         return;
              if(list == null || list.getSelectedIndex() == -1){
                   return;
         int[] indices = list.getSelectedIndices();
         // get the current relative position of the check box
         //rect = box.getBounds(rect);
         for(int i = 0; i < indices.length; i++) {
         // get the current relative position of the check box
         int loc = list.locationToIndex( e.getPoint() );
         rect = list.getCellBounds(loc,loc);
         // ensure the point clicked in within the checkBox
         if(e.getX() < (rect.getX() + 20) ) {
              Object obj=list.getModel().getElementAt(i);
              //if(!obj.equals("SelectAll")&&!obj.equals("ClearAll")&&!obj.equals("GrayedAll")){
                   if(indices[i]>2){
                        selState[0]=false;
                        selState[1]=false;
                        selState[2]=false;
                        //����
                        if(!this.isEnabled(indices[i])&&selState[indices[i]]==true){
                             this.setEnabled(indices[i],true);
                             selState[indices[i]]=false;
                        } else if(this.isEnabled(indices[i])&&selState[indices[i]]==true){
                             //����
                             selState[indices[i]]=true;
                             this.setEnabled(indices[i],false);                              
                        }else if(this.isEnabled(indices[i])&&selState[indices[i]]==false){
                             //����
                             selState[indices[i]]=true;
                             this.setEnabled(indices[i],true);
                   } else {
                        selState[indices[i]] = !selState[indices[i]];
         list.revalidate();
         list.repaint();
         public void selectAll(boolean b) {
              for(int i = 0; i < list.getModel().getSize(); i++) {
                   try {
                        this.enableAll(true);
                        Object obj=list.getModel().getElementAt(i);
                        if(!obj.equals("ClearAll")&&!obj.equals("GrayedAll")){
                             selState[i] = b;
                        } else{
                             selState[i]=!b;
                        selState[0]=false;
                   } catch(ArrayIndexOutOfBoundsException aie) {
                        updateSelectionStateTrackers(list);
                        selectAll(b);
                        return;
              if(list != null) {
                   list.revalidate();
                   list.repaint();
         public void clearAll(boolean b){
              for(int i = 0; i < list.getModel().getSize(); i++) {
                   try {
                        Object obj=list.getModel().getElementAt(i);
                        this.enableAll(true);
                        if(!obj.equals("ClearAll")){
                             selState[i] = !b;
                        } else{
                             selState[i]=b;
                        selState[1]=false;
                   } catch(ArrayIndexOutOfBoundsException aie) {
                        updateSelectionStateTrackers(list);
                        selectAll(b);
                        return;
              if(list != null) {
                   list.revalidate();
                   list.repaint();
         public void grayedAll(boolean b){
              for(int i = 0; i < list.getModel().getSize(); i++) {
                   try {
                        Object obj=list.getModel().getElementAt(i);
                        if(!obj.equals("SelectAll")&&!obj.equals("ClearAll")){
                             if(i==2){
                                  selState[i] = !b;
                             }else{                             
                                  selState[i] = b;
                             this.setEnabled(i,false);
                        } else{
                             selState[i]=!b;                          
                   } catch(ArrayIndexOutOfBoundsException aie) {
                        updateSelectionStateTrackers(list);
                        selectAll(b);
                        return;
              if(list != null) {
                   list.revalidate();
                   list.repaint();
         public void setSelectedIndex(int index) {
              for(int i = 0; i < list.getModel().getSize(); i++) {
                   selState[i] = false;
              selectIndex(index);
         public void selectIndex(int index) {
              try {
                   selState[index] = true;
              } catch(ArrayIndexOutOfBoundsException aie) {
                   updateSelectionStateTrackers(list);
                   selectIndex(index);
                   return;
              if(list != null) {
                   list.revalidate();
                   list.repaint();
         public void setEnabled(int index, boolean b) {
              try {
                   enableState[index] = b;
              } catch(ArrayIndexOutOfBoundsException aie) {
                   updateSelectionStateTrackers(list);
                   setEnabled(index, b);
         public boolean isEnabled(int index) {
              if(index == -1) {
                   return true;
              boolean isEnabled = true;
              try {
                   isEnabled = enableState[index];
              } catch(ArrayIndexOutOfBoundsException aie) {
                   updateSelectionStateTrackers(list);
                   return isEnabled(index);
              return isEnabled;
         public void enableAll(boolean b) {
              for(int i = 0; i < enableState.length; i++) {
                   enableState[i] = b;
    public void selectAll(boolean b) {
         if(selStateHandler == null) {
              return;
         selStateHandler.selectAll(b);
    public void clearAll(boolean b){
         if(selStateHandler == null) {
              return;
         selStateHandler.clearAll(b);
    public void grayedAll(boolean b){
         if(selStateHandler == null) {
              return;
         selStateHandler.grayedAll(b);
    public void setSelectedIndex(int index) {
         if(selStateHandler == null) {
              return;
         selStateHandler.setSelectedIndex(index);
    public void selectIndex(int index) {
         if(selStateHandler == null) {
              return;
         selStateHandler.selectIndex(index);
    public void enableAll(boolean b) {
         if(selStateHandler == null) {
              return;
         selStateHandler.enableAll(b);
    public void setEnabled(int index, boolean enable) {
         if(selStateHandler == null) {
              return;
         selStateHandler.setEnabled(index, enable);
    public boolean isEnabled(int index) {
         if(selStateHandler == null) {
              return true;
         return selStateHandler.isEnabled(index);
    public boolean isEnabledAll() {
         if(enableState == null) return true;
         for(int i = 0; i < enableState.length; i++) {
              if(!isEnabled(i)) {
                   return false;
         return true;
    // EmptyIcon implementation
    public static class EmptyIcon implements Icon {
         int width = 16, height = 16;
         public EmptyIcon() {
         setSize(16,16);
         public EmptyIcon(int width, int height) {
         setSize(width, height);
         public void setSize(int width, int height) {
         this.width = width;
         this.height = height;
         public int getIconWidth() {  return width; }
         public int getIconHeight() { return height; }
         public void paintIcon(Component c, Graphics g, int x, int y) {}
    public int getItemCount(){
         if(theList!=null){
              return theList.getModel().getSize();
         } else {
              return 0;
         public boolean[] getEnableState() {
              return enableState;
         public boolean[] getSelState() {
              return selState;
         public JList getTheList() {
              return theList;
    testbox :import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JFrame;
    import javax.swing.JComboBox;
    import javax.swing.JMenu;
    import javax.swing.JMenuBar;
    public class testbox extends JComboBox
    * @param args
    JComboBox myComboBox;
    public testbox()
    myComboBox = new JComboBox();
    public void setPopupVisible(boolean b)
         if(b)
              myComboBox.showPopup();
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             

    You are updating the label value when (index == -1), let change into (index<=0).
    like below
    // this should cause a JComboBox to paint the Label instead of the
                // check box + label combination
                if (index <= 0) {
                    Vector v = new Vector();
                    v = getSelectedObjects();
                    String val = generateString();
                    JLabel label = new JLabel(val);
                    if (iconLabel.getIcon() != null) {
                        label.setIcon(iconLabel.getIcon());
                    System.out.println("label");
                    return label;
                }

  • Using currentTarget.label as variable in path?

    I have the following code:
    <s:FormItem label="First" click="onItemFocus(event)">
          <s:TextInput id="First" enabled="false" text="some text here..."/>
    </s:FormItem>
    Which when you click the FormItem it fires this function:
    protected function onItemFocus(e:MouseEvent):void
        var targetname:String = e.currentTarget.label;
         First.enabled = true;
         First.setFocus();
         First.selectAll();
    Now as you can see the targetname variable value is 'First' and the ID of the textfield is 'First' so the next part of the question is, how do I use the targetname variable as the name of the component I wish to enable?
    I was advised that I could do it with square brackets like:
    [targetname]enabled = true; but I can't make that work, and as I have about 50 fields that need this setting an efficient way would be great.
    The other possibility I have is if I can set a style for the the normal state, and then a different style for the normal w/focus??? Now that would be awsome as this would alow tabbing between fields too, which would be better under certain circumstances.
    Thanks for any help you can provide.
    Shaine

    In main request, add navigation on department column or values. Then, you must have target request with filter "Is prompted" on department column.

  • Accessing S:List Checkbox Item Renderer Outside the Renderer

    Hi All,
    I have an S:List, with a checkbox item renderer.  I was to be able to access the selected portion of the renderer to create a new function that at the press of a button this will delect all the current selected items in the list.
    Doco states that i should be able to do this just by setting the selectedIndex to -1.  But not sure if this is specific to 4.5??  But it is not working for me.
    Below is my current list.  Outside of this list flashbuilder does not know about chkList, or even selected.  How can i get access to this to deslect all?
    <s:List
    id="ltattributes">
    <s:itemRenderer>
    <fx:Component>
    <s:ItemRenderer>
    <fx:Script>
    <![CDATA[
    import mx.events.ItemClickEvent;
    protected function chkList_changeHandler(event:Event):void
    var e:ItemClickEvent = new ItemClickEvent(ItemClickEvent.ITEM_CLICK, true);
    data.selected = event.currentTarget.selected;
    e.item = data;
    e.index = itemIndex;
    dispatchEvent(e);
    ]]>
    </fx:Script>
    <s:CheckBox id="chkList" selected="false" label="{data.displayname}" change="chkList_changeHandler(event)"/>
    </s:ItemRenderer>
    </fx:Component>
    </s:itemRenderer>
    Thanks

    Try: dataGroup.getElementAt(). 
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • How to remove labels from text fields?

    Hey Everyone!
    I am having troubles with forms in Dreamweaver CC.
    I insert a text field in a form but the text field automatically comes with a label.
    How do i stop this?

    And I get that!
    But say I insert a text field.
    It is preceded by a label saying "Text Field 1:"
    But I already have written what the text field is supposed to do!
    And when I go in front of the label and press backspace, it doesn't wanna get deleted; not until I have to select the text and delete it!
    So you see a large part of my time is getting wasted in formatting the page and i can't give my full attention to the php code I want to write as I get frustrated because of this!
    So if you could help me get rid of the labels for good ; it'll be amazing!
    Thanks
    Regards
    Anuj

  • Html next to cfinput checkbox text

    I have a form which requires two a href links and surrounding
    text to appear to the right of a checkbox. When I put the html next
    to the closing tag, it does not display at all. When I place it in
    the label property, it shows the links as plain text. When I put
    the text in cfset tag outside the form, then call it from the label
    tag, again, it shows up as plain text. Is there any way to combine
    this the certification HTML with the checkbox so it will display
    properly?
    Line of code:
    <cfinput checked="yes" type="checkbox" name="ICertify"
    id="ICertify" label=#icertify# />
    Output:
    I certify that all information furnished is accurate and
    truthful. I also certify that I have read <a href="
    http://www.usps.com/ibip/html/privacy_act1974.html"
    target="_blank">The USPS Privacy Act Statement</a> and
    <a href="
    http://www.usps.com/ibip/html/privacy.html"
    target="_blank">PC Postage Privacy Principles</a>.
    I'm brand new at ColdFusion, so be gentle in your answer.
    Thank you,
    Ernie

    Thank you for your help.
    I copied the code directly from your message, then tried
    several variations, including typing the text directly in between
    the label tags, excluding the <a> tags, etc.
    This is still not working - the text is not displaying where
    it should and in the way it should. I can't understand what's
    blocking the label from displaying.
    When I place the #icertify# cfset reference anywhere outside
    the form tags (enclosed in <cfoutput> tags), it returns
    exactly what I want - the text with clickable links. It seems that
    within the form, though, it won't function at all.
    I haven't made any changes to the original code posted last
    week. If there is anything in there that might be suppressing it
    from working, let me know.
    Thank you,
    Ernie

Maybe you are looking for

  • Best Buy Warranty???

    I purchased a Microsoft Surface Pro March 9 2012. (Today is March 9 2014). The total cost was approx 900.00. I also purchased a 1 year warranty protection plan from Best Buy. At some point during the last year the Surface Pro would no longer accept a

  • HOW CAN I CHANGE THE CODE IN MY DECODE?

    Is it possible to do a DECODE where a number or phrase could be returned depending upon the condition? Currently I have this DECODE in my SELECT STATEMENT select DECODE( GREATEST( MONTHS_BETWEEN(n.lcl_er_recv_dt, ADD_MONTHS(n.ind_er_per_end_dt,3)) ,

  • URGENT help needed in creating external xml video plalist. Please help!

    I was given an assignment to  create and external video playlist using an xml file.  I have never used  flash before, know nothing about encoding and all that was given to the  class in terms of instuctions was a short tutorial that has no  resources

  • Error code 4280 when I attempt to burn cd

    Why do I get error code 4280 when I try to burn c cd from my burn list and how can I accomplish my task?!

  • Rh X5 VS Rh 8: Styles Mapping

    Hello, Is there any way we can map styles when importing from Word in Rh X5? I've searched everywhere but it does not seem feasible...! I know that we can in Rh 8 as I've tried the trial version. Thanks in advance Best Regards