Focus rectangle

Can someone tell me how to make a focus rectangle visible
without tabbing. i.e. via code something like that below:
I know its possible because I've done it before and can't
remember how I did it.
Thanks in advance.

I read through my post and thought it wasn't very clear what
I was asking. Basically I've created code before that would show a
focus rectangle if a user clicked in that field with the mouse. Now
I'm trying to do that again and can't remember how I did it.

Similar Messages

  • JButton & Win XP Look and Feel focus rectangle bug??

    I searched the bug database but was unable to find any matches...
    I have received a bug report from our users relating to mistakenly thinking a button has focus. In the XP LAF, when a button is a 'default' button, it has a blue rectancle drawn around it (which is correct). When you tab to that button however, there is no additional 'focus' rectangle to indicate that the button has focus. I tested this in native XP components and an additional rectancle IS drawn when the button gets focus (in addition to the blue rectangle). Shouldn't there be some sort of focus indicator in addition to the blue rectangle? I'm using JRE version 1.4.2_02.
    Thanks,
    Andy

    Hello Andy!
    If the behavior of Win XP LAF is different from the native this is definitely a bug. It would be greate if you file a bug here
    http://java.sun.com/webapps/bugreport.
    Thank you.
    Anton

  • Custom focus rectangle in JTextField

    I'm trying to change my theme/look & feel to show a focus rectangle for JTextField, somewhat like this: [http://www.macvswindows.com/index.php?title=GUI_Customization|http://www.macvswindows.com/index.php?title=GUI_Customization] (second image down, or direct [http://www.macvswindows.com/images/thumb/f/f2/osx_aqua_colors.png/500px-osx_aqua_colors.png|http://www.macvswindows.com/images/thumb/f/f2/osx_aqua_colors.png/500px-osx_aqua_colors.png] ) I don't want to make it exactly like MacOS, but a similar idea.
    For now I'm just trying to do it on the inner part of the field. I can get it to paint with the code below, but then the caret painting messes things up as I tab through the fields or move the caret around inside the fields.
    So it seems I'm headed down the wrong path, what should I be doing? Extending DefaultHighlighter or DefaultCaret, or something else?
    Thanks,
    Jim
    package testui;
    import javax.swing.*;
    import javax.swing.plaf.metal.DefaultMetalTheme;
    import javax.swing.plaf.metal.MetalLookAndFeel;
    public class ThemeTest extends JFrame {
        public class TestMetalTheme extends DefaultMetalTheme {
            public void addCustomEntriesToTable(UIDefaults table) {
                UIManager.put("TextFieldUI", "customui.CustomTextFieldUI");
            public String getName() {
                return "TestMetalTheme";
        public static void main(String[] args) {
            ThemeTest testFrame = new ThemeTest();
            testFrame.setVisible(true);
        public ThemeTest() {
            try {
                MetalLookAndFeel.setCurrentTheme(new TestMetalTheme());
                UIManager.setLookAndFeel(new MetalLookAndFeel());
            } catch (Exception e) {
                e.printStackTrace();
            setSize(500, 500);
            setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
            JPanel panel = new JPanel();
            add(panel);
            panel.add(new JTextField("test"));
            panel.add(new JTextField("test"));
            panel.add(new JTextField("test"));
            panel.add(new JButton("button"));
    package testui;
    import javax.swing.*;
    import javax.swing.plaf.ComponentUI;
    import javax.swing.plaf.metal.MetalTextFieldUI;
    import java.awt.*;
    public class CustomTextFieldUI extends MetalTextFieldUI {
        private Color focusColor = Color.cyan;
        private JComponent component;
        public CustomTextFieldUI(JComponent c) {
            if (c == null) {
                throw new IllegalArgumentException("component must be specified");
            this.component = c;
        public static ComponentUI createUI(JComponent c) {
            return new CustomTextFieldUI(c);
        protected void paintSafely(Graphics g) {
            super.paintSafely(g);
            if (component.hasFocus()) {
                Dimension size = component.getSize();
                Graphics2D g2d = (Graphics2D) g;
                System.out.println(g2d.getClip());
                System.out.println(g2d.getClipBounds());
                g2d.setColor(focusColor);
                g2d.setStroke(new BasicStroke(2f));
                g2d.drawRect(1, 1, size.width - 3, size.height - 3);
    }

    Why not just combine the two approaches?
    import java.awt.*;
    import java.awt.event.FocusEvent;
    import java.awt.event.FocusListener;
    import javax.swing.*;
    import javax.swing.border.BevelBorder;
    import javax.swing.border.Border;
    import javax.swing.plaf.ComponentUI;
    import javax.swing.plaf.metal.MetalTextFieldUI;
    public class CustomTextFieldUI extends MetalTextFieldUI {
         private Color focusColor = Color.cyan;
         private JComponent component;
         private Border normalBorder;
         private Border focusedBorder;
         private FocusListener focusListener;
         public CustomTextFieldUI( JComponent c ) {
              if ( c == null ) {
                   throw new IllegalArgumentException( "component must be specified" );
              this.component = c;
              focusListener =  new FocusListener() {
                   public void focusGained( FocusEvent fe ) {
                        if ( normalBorder == null ) {
                             normalBorder = component.getBorder();
                             focusedBorder = new BevelBorder( BevelBorder.LOWERED ) {
                                  @Override
                                  public Color getHighlightInnerColor() { return focusColor; }
                                  @Override
                                  public Color getHighlightOuterColor() { return focusColor; }
                                  @Override
                                  public Color getShadowInnerColor() { return focusColor; }
                                  @Override
                                  public Color getShadowOuterColor() { return focusColor; }
                        component.setBorder( focusedBorder );
                   public void focusLost( FocusEvent fe ) {
                        component.setBorder( normalBorder );
         public static ComponentUI createUI( JComponent c ) {
              return new CustomTextFieldUI ( c );
         @Override
         protected void installListeners() {
              super.installListeners();
              component.addFocusListener( focusListener );
         @Override
         protected void uninstallListeners() {
              super.uninstallListeners();
              component.removeFocusListener( focusListener );
    }

  • ComboBox focus rectangle

    I m using Combobox and when I activated accesability by Tab,
    The focus rectangles apears in a grean color, how do I change the
    color of that rectangle.. (I want it to Yellow, like it comes for
    Buttons etc..)
    Regards
    Sidharth

    nobody replied

  • Focus rectangle around jCheckBox

    Hi all,
    I have a JCheckBox with no label text with it. Usually when the JCheckBox has focus, theres a dotted focus rectangle around the label text, so in this case there never is.
    Since theres a few checkboxes in the same panel, it gets very confusing as you can't see what component is in focus. Is there any way about this? I was trying to create my own checkbox with a dotted border when the component gets focus, but theres no dotted border in swing.
    So my question is this:
    1) Is there any way to change the focus rectangle to go about the whole component and not just the text label?
    or
    2) Is there any dotted border in swing that I've missed?
    thanks,
    Justin

    what about having blank spaces as the text (the # of spaces determines the rectangle width)
    something like this
    import java.awt.*;
    import javax.swing.*;
    class Testing extends JFrame
      JCheckBox cbx1 = new JCheckBox("      ");
      JCheckBox cbx2 = new JCheckBox("      ");
      public Testing()
        setLocation(400,300);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        JPanel p = new JPanel();
        p.add(cbx1);
        p.add(cbx2);
        getContentPane().add(p);
        pack();
      public static void main(String[] args){new Testing().setVisible(true);}
    }

  • HToggleButton increase width of focus rectangle

    Hi, can anyone tell me how to increase the width of focus rectangle when any component like HToggleButton is focused

    Hi, can anyone tell me how to increase the width of focus rectangle when any component like HToggleButton is focused

  • JTable Focus Rectangle

    When navigating around my table the focus recatangle is not shown - but the correct cell is selected.
    A single click selects a cell, but I need to double click to see the focus triangle.
    I would like the focus rectangle to appear when the cell is selected.
    Any ideas?

    Actually I was't thinking clearly when you asked about a "focus rectangle (which is why I always recommend a simple demo program that shows your problem). I thought you where asking about the "dotted line focus rectangle" that appears on components like JButton.
    Anyway here is a simple table and not that the "focus rectangle" appears on all cells except the column with boolean values.
    import java.awt.*;
    import java.util.*;
    import javax.swing.*;
    public class TableBasic extends JFrame
         public TableBasic()
              String[] columnNames = {"Date", "String", "Integer", "Boolean"};
              Object[][] data =
                   {new Date(), "A", new Integer(1), Boolean.TRUE },
                   {new Date(), "B", new Integer(2), Boolean.FALSE},
                   {new Date(), "C", new Integer(9), Boolean.TRUE },
                   {new Date(), "D", new Integer(4), Boolean.FALSE}
              JTable table = new JTable(data, columnNames)
                   //  Returning the Class of each column will allow different
                   //  renderers to be used based on Class
                   public Class getColumnClass(int column)
                        return getValueAt(0, column).getClass();
              table.setPreferredScrollableViewportSize(table.getPreferredSize());
              JScrollPane scrollPane = new JScrollPane( table );
              getContentPane().add( scrollPane );
         public static void main(String[] args)
              TableBasic frame = new TableBasic();
              frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
              frame.pack();
              frame.setLocationRelativeTo( null );
              frame.setVisible(true);
    }The default renderer for boolean values uses a JCheckBox to render the value. the check box uses setBorderPainted(false), which is why "focus rectangle" is not painted. Personally, I think this is a bug.
    Anyway, if you want the "focus rectangle" then you would need to create your own Boolean renderer, setBorderPainted(true) and provide a default EmptyBorder for the check box:
    Border noFocusBorder = new EmptyBorder(1, 1, 1, 1);

  • Cropped focus rectangle on Spark VideoPlayer's Play/Pause button

    Can anyone help with an issue I am having with a cropped focus rectangle?
    The video player is cropping the focus rectangle on the bottom and left of the component.  One of my components is audio-only, and that is being cropped at the top too.  Images attached.
    Maybe I could rectify this by setting the focus rectangle direction inwards, instead of outwards?  How would I do that just for this particular component (I definitely wouldn't wan't to change the focus rectangle globally)
    Or is there some other fix perhaps?
    Should I register this as a bug?  If so, where should I do that?

    This looks like a bug. You can file bug reports here: http://bugs.adobe.com/flex/
    -Darrell

  • Focus rectangle of JButton

    Hi,
    I am working on a GUI. putting some icon buttons (JButton). The problem is I am having buttons quite bigger than my icon picture size (having border arround it) with a rectangle on the button. How can I get ride of that rectangle? How can I make the size of the button exactly equal to the size of icon? And how can I make the look and feel of JButton as the old pressable Button (AWT) style? Appreciate you help and time.

    Okay, there are a few ways of doing each thing that you are talking about here. For example, to make the button look like the old AWT buttons, you can simple make the border a raisedBevel border.
    To make the button be the same size as the image, set the insets of the button to
    new Insets(0,0,0,0);The final part of stopping it drawing the focus, is to use the method
    setFocusPainted(false);This is the easy solution. A more powerful solution, but more difficult, is to override the ButtonUI and draw the button exactly as you want. It may be worth looking how the MetalButtonUI works if you do want to take this route.
    Hope this helps
    wwe8

  • Problem with focus border and ListCellRenderer in custom listbox

    I have a bug in some code that I adapted from another posting on this board -- basically what I've done is I have a class that implements a custom "key/value" mapping listbox in which each list item/cell is actually a JPanel consisting of 3 JLabels: the first label is the "key", the second is a fixed "==>" mapping string, and the 3rd is the value to which "key" is mapped.
    The code works fine as long as the list cell doesn't have the focus. When it does, it draws a border rectangle to indicate focus, but if the listbox needs to scroll horizontally to display all the text, part of the text gets cut off (i.e. "sometex..." where "sometext" should be displayed).
    The ListCellRenderer creates a Gridlayout to lay out the 3 labels in the cell's JPanel.
    What can I do to remedy this situation? I'm not sure what I'd need to do in terms of setting the size of the panel so that all the text gets displayed OK within the listbox. Or if there's something else I can do to fix this. The code and a main() to run the code are provided below. To reproduce the problem, click the Add Left and Add Right buttons to add a "mapping" -- when it doesn't have focus, everything displays fine, but when you give it focus, note the text on the right label gets cut off.
    //======================================================================
    // Begin Source Listing
    //======================================================================
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.Collection;
    import java.util.Iterator;
    import java.util.Vector;
    import java.util.Enumeration;
    public class TwoColumnListbox extends JPanel
    private JList m_list;
    private JScrollPane m_Pane;
    public TwoColumnListbox(Collection c)
         DataMapListModel model = new DataMapListModel();
         if (c != null)
         Iterator it = c.iterator();
         while (it.hasNext())
         model.addElement(it.next());
         m_list = new JList(model);
         ListBoxRenderer renderer= new ListBoxRenderer();
              m_list.setCellRenderer(renderer);
              setLayout(new BorderLayout());
              m_list.setVisibleRowCount(4);
              m_Pane = new JScrollPane(m_list);
              add(m_Pane, BorderLayout.NORTH);
    public JList getList()
    return m_list;
    public JScrollPane getScrollPane()
    return m_Pane;
    public static void main(String s[])
              JFrame frame = new JFrame("TwoColumnListbox");
              frame.addWindowListener(new WindowAdapter() {
              public void windowClosing(WindowEvent e) {System.exit(0);}
    final DataMappings dm = new DataMappings();
    final TwoColumnListbox lb = new TwoColumnListbox(dm.getMappings());
              final DataMap map = new DataMap();
              JButton leftAddBtn = new JButton("Add Left");
              leftAddBtn.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent e)
              map.setSource("JButton1");
              DefaultListModel model = new DefaultListModel();
              model.addElement(map);
              lb.getList().setModel(model);
              JButton leftRemoveBtn = new JButton("Remove Left");
              leftRemoveBtn.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent e)
              map.setSource("");
              DefaultListModel model = new DefaultListModel();
              model.addElement(map);
              lb.getList().setModel(model);
              JButton rightAddBtn = new JButton("Add Right");
    rightAddBtn.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent e)
              map.setDestination("/getQuote/symbol[]");
              DefaultListModel model = new DefaultListModel();
              model.addElement(map);
              lb.getList().setModel(model);
              JButton rightRemoveBtn = new JButton("Remove Right");
    rightRemoveBtn.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent e)
              map.setDestination("");
              DefaultListModel model = new DefaultListModel();
              model.addElement(map);
              lb.getList().setModel(model);
              JPanel leftPanel = new JPanel(new BorderLayout());
              leftPanel.add(leftAddBtn, BorderLayout.NORTH);
              leftPanel.add(leftRemoveBtn, BorderLayout.SOUTH);
    JPanel rightPanel = new JPanel(new BorderLayout());
              rightPanel.add(rightAddBtn, BorderLayout.NORTH);
              rightPanel.add(rightRemoveBtn, BorderLayout.SOUTH);
    frame.getContentPane().add(leftPanel, BorderLayout.WEST);
              frame.getContentPane().add(lb,BorderLayout.CENTER);
    frame.getContentPane().add(rightPanel, BorderLayout.EAST);
              frame.pack();
              frame.setVisible(true);
         class ListBoxRenderer extends JPanel implements ListCellRenderer
              private JLabel left;
              private JLabel arrow;
              private JLabel right;
              private Color clrForeground = UIManager.getColor("List.foreground");
    private Color clrBackground = UIManager.getColor("List.background");
    private Color clrSelectionForeground = UIManager.getColor("List.selectionForeground");
    private Color clrSelectionBackground = UIManager.getColor("List.selection.Background");
              public ListBoxRenderer()
                   setLayout(new GridLayout(1, 2, 10, 0));
                   //setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
                   left = new JLabel("");
                   left.setForeground(clrForeground);               
                   arrow = new JLabel("");
                   arrow.setHorizontalAlignment(SwingConstants.CENTER);
                   arrow.setForeground(clrForeground);
                   right = new JLabel("");
                   right.setHorizontalAlignment(SwingConstants.RIGHT);
                   right.setForeground(clrForeground);
                   add(left);
                   add(arrow);
                   add(right);
              public Component getListCellRendererComponent(JList list, Object value,
                        int index, boolean isSelected, boolean cellHasFocus)
                   if (isSelected)
                        setBackground(list.getSelectionBackground());
                        setForeground(list.getSelectionForeground());
                        left.setForeground(clrSelectionForeground);
                        arrow.setForeground(clrSelectionForeground);
                        right.setForeground(clrSelectionForeground);
                   else
                        setBackground(list.getBackground());
                        setForeground(list.getForeground());
                   left.setForeground(clrForeground);
                        arrow.setForeground(clrForeground);
                        right.setForeground(clrForeground);               
                   // draw focus rectangle if control has focus. Problem with focus
    // and cut off text!!
                   if (cellHasFocus)
                   // FIXME: for Windows LAF I'm not getting the correct thing here for some reason.
                   // Looks OK on Metal though.
                   setBorder(BorderFactory.createLineBorder(UIManager.getColor("focusCellHighlightBorder")));
                   else
                   setBorder(BorderFactory.createEmptyBorder());               
    DataMap map = (DataMap) value;
                   String displaySource = map.getSource();
                   String displayDest = map.getDestination();
                   left.setText(displaySource);
                   arrow.setText("=>to<=");
                   right.setText(displayDest);
                   return this;
    /** Interface for macro editor UI
    * @version 1.0
    class DataMappings
    private Collection mappings;
    public DataMappings()
    setMappings(new Vector(0));
    public DataMappings(Collection maps)
    setMappings(maps);
    /** gets mapping value of a specified source object
    * @param src -- the "key" or source object, what is mapped.
    * @return what the source object is mapped to
    * @version 1.0
    public Object getValue(String src)
    if (src != null)
    Iterator it = mappings.iterator();
    while (it.hasNext());
    DataMap thisMap = (DataMap) it.next();
    if (thisMap.getSource().equals(src))
    return thisMap.getDestination();
    return null;
    /** sets mapping value of a specified source object
    * @param src -- the "key" or source object, what is mapped.
    * @param what the source object is to be mapped to
    * @version 1.0
    public void setValue(String src, String dest)
    if (src != null)
    // see if the value is in there first.
    Iterator it = mappings.iterator();
    while (it.hasNext())
    DataMap thisMap = (DataMap) it.next();
    if (thisMap.getSource().equals(src))
    thisMap.setDestination(dest);
    return;
    // not in the collection, add it
    mappings.add(new DataMap(src, dest));
    /** gets collection of mappings
    * @return a collection of all mappings in this object.
    * @version 1.0
    public Collection getMappings()
    return mappings;
    /** sets collection of mappings
    * @param maps a collection of src to destination mappings.
    * @version 1.0
    public void setMappings(Collection maps)
    mappings = maps;
    /** adds a DataMap
    * @param map a DataMap to add to the mappings
    * @version 1.0
    public void add(DataMap map)
    if (map != null)
    mappings.add(map);
    class DataMap
    public DataMap() {}
    public DataMap(String source, String destination)
    m_source = source;
    m_destination = destination;
    public String getSource()
    return m_source;
    public void setSource(String s)
    m_source = s;
    public String getDestination()
    return m_destination;
    public void setDestination(String s)
    m_destination = s;
    protected String m_source = null;
    protected String m_destination = null;
    /** list model for datamaps that provides ways
    * to determine whether a source is already mapped or
    * a destination is already mapped.
    class DataMapListModel extends DefaultListModel
    public DataMapListModel()
    super();          
    /** determines whether a source is already mapped
    * @param src -- the source property of a datamapping
    * @return true if the source is in the list, false if not
    public boolean containsSource(Object src)
    Enumeration enum = elements();
    while (enum.hasMoreElements())
    DataMap dm = (DataMap) enum.nextElement();
    if (dm.getSource().equals(src))
    return true;
    return false;
    /** determines whether a destination is already mapped
    * @param dest -- the destination property of a datamapping
    * @return true if the destination is in the list, false if not
    public boolean containsDest(Object dest)
    Enumeration enum = elements();
    while (enum.hasMoreElements())
    DataMap dm = (DataMap) enum.nextElement();
    if (dm.getDestination().equals(dest))
    return true;
    return false;
    public DataMappings getDataMaps()
    DataMappings maps = new DataMappings();
    // add all the datamaps in the model
    Enumeration enum = elements();
    while (enum.hasMoreElements())
    DataMap dm = (DataMap) enum.nextElement();
    maps.add(dm);
    return maps;
    //======================================================================
    // End of Source Listing
    //======================================================================

    I did not read the program, but the chopping looks like a layout problem.
    I think it's heavy to use a panel + 3 components in a gridlayout for each cell. look at this sample where i draw the Cell myself,
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.util.*;
    public class Jlist3 extends JFrame 
         Vector      v  = new Vector();
         JList       jc = new JList(v);
         JScrollPane js = new JScrollPane(jc);
    public Jlist3()
         addWindowListener(new WindowAdapter()
        {     public void windowClosing(WindowEvent ev)
              {     dispose();
                   System.exit(0);}});
         for (int j=0; j < 70; j++)     v.add(""+j*1000+"a  d"+j);
           setBounds(1,1,400,310);
         getContentPane().add(js);
         js.setPreferredSize(new Dimension(230,259));
         jc.setSelectedIndex(1);
         jc.setCellRenderer(new MyCellRenderer());
         getContentPane().setLayout(new FlowLayout());
         setVisible(true);
    public class MyCellRenderer extends JLabel implements ListCellRenderer
         String  txt;
         int     idx;
         boolean sel;
    public Component getListCellRendererComponent(JList list,
                             Object  value,           // value to display
                             int     index,           // cell index
                             boolean isSelected,      // is the cell selected
                             boolean cellHasFocus)    // the list and the cell have the focus
         idx = index;
         txt = value.toString();
         sel = isSelected;
         setText(txt);
         return(this);
    public void paintComponent(Graphics g)
         if (idx%2 == 1) g.setColor(Color.white);
              else        g.setColor(Color.lightGray);
         if (sel)        g.setColor(Color.blue);
         g.fillRect(0,0,getWidth(),getHeight());
         StringTokenizer st = new StringTokenizer(txt.trim()," ");
         g.setColor(Color.black);
         if (st.hasMoreTokens())     g.drawString(st.nextToken(),1,14);
         g.setColor(Color.red);
         g.drawString("===>",70,14);
         g.setColor(Color.black);
         if (st.hasMoreTokens())     g.drawString(st.nextToken(),110,14);
    public static void main (String[] args) 
         new Jlist3();
    Noah
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.util.*;
    public class Jlist3 extends JFrame
         Vector v = new Vector();
         JList jc = new JList(v);
         JScrollPane js = new JScrollPane(jc);
    public Jlist3()
         addWindowListener(new WindowAdapter()
    {     public void windowClosing(WindowEvent ev)
              {     dispose();
                   System.exit(0);}});
         for (int j=0; j < 70; j++)     v.add(""+j*1000+"a d"+j);
         setBounds(1,1,400,310);
         getContentPane().add(js);
         js.setPreferredSize(new Dimension(230,259));
         jc.setSelectedIndex(1);
         jc.setCellRenderer(new MyCellRenderer());
         getContentPane().setLayout(new FlowLayout());
         setVisible(true);
    public class MyCellRenderer extends JLabel implements ListCellRenderer
         String txt;
         int idx;
         boolean sel;
    public Component getListCellRendererComponent(JList list,
                             Object value, // value to display
                             int index, // cell index
                             boolean isSelected, // is the cell selected
                             boolean cellHasFocus) // the list and the cell have the focus
         idx = index;
         txt = value.toString();
         sel = isSelected;
         setText(txt);
         return(this);
    public void paintComponent(Graphics g)
         if (idx%2 == 1) g.setColor(Color.white);
              else g.setColor(Color.lightGray);
         if (sel) g.setColor(Color.blue);
         g.fillRect(0,0,getWidth(),getHeight());
         StringTokenizer st = new StringTokenizer(txt.trim()," ");
         g.setColor(Color.black);
         if (st.hasMoreTokens())     g.drawString(st.nextToken(),1,14);
         g.setColor(Color.red);
         g.drawString("===>",70,14);
         g.setColor(Color.black);
         if (st.hasMoreTokens())     g.drawString(st.nextToken(),110,14);
    public static void main (String[] args)
         new Jlist3();
    }

  • JRadioButton not getting the Focus Back

    Hi,
    I am having a problem with the RadioButtons. I have a panel and have three radio buttons belonging to a group. I have selected the third button and saved it to the database. When I came back to the panel, I have the third button selected.But the focus( Rectangle around the text) is on the first button. If I click on the third button then the focus came to the third button. I tried using requestFocus() but its not at all working. Some one please help me asap.
    Example of Code...
    if(selButton =1)
    rb1.setSelected(true);
    else if(selButton = 2)
    rb2.setSelected(true);
    else
    rb3.setSelected(true);
    TIA,
    CK

    Did you try:
    if(selButton =1) {
      rb1.setSelected(true);
      rb1.requestFocuse();
    } else if(selButton = 2) {
      rb2.setSelected(true);
      rb2.requestFocuse();
    } else {
      rb3.setSelected(true);
      rb3.requestFocuse();
    }Doesn't work ?

  • Focus Question

    Is it possible to change the color of the focus rectangle in
    an application? I'm a bit of a newbie. I tried extending the
    mx.skins.halo.HaloFocusRect class, but couldn't get that to work.
    Any help would be greatly appreciated!
    - Jason

    Jason,
    You can use the Application.themeColor style to alter the
    overall color schemes for Flex. I don't know whether you not that
    helps you specifically, but it will change a majority of colors
    within your Application.
    Just throw the themeColor attribute into your Application tag
    and it will tint certain things, like focus rectangles, red
    (#FF0000). Or if you're using a CSS file, the Application style has
    a themeColor property there too.
    <mx:Application
    themeColor="#FF0000">
    Hope that helps.

  • Focus on to a checkbox which has no label

    I have a screen which has few checkboxes with out labels.. and when I tab through them I dont know which has the focus(visually). This problem is because the focus is painted to the label of the checkbox not the checkbox!!
    Can anyone give me a wayout ASAP!!
    Thanks in advance...

    Sounds like you might need to create a custom UI for JCheckBox that has different focus behavior. The UI delegate for JCheckBox extends BasicRadioButtonUI, which has a method:
      protected void paintFocus(Graphics g,
                  Rectangle textRect, Dimension size){
        }This method is overridden in the various PLAFs to paint focus as the LAF defines. Since caption-less check boxes are not the norm, the
    rectangle that is being painted will be empty. When you override the
    paintFocus() method you may want to recalculate what the
    focus rectangle is so it is more appropriate.
    Replace the UI delegate for a checkbox using the setUI() method and that ought to do it.
    Mitch

  • N86 Camera Auto Focus

    Hi all, I am having this problem when my camera is on Auto Mode but doesn't focus on anything. The focus rectangle turn red everytime! I looked in the sensor, the optics used to move for focussing, but now it stays still! Help please.

    no apps  last app was magic 8 ball

  • Help - text boxes/highlighting hidden unless selected in Acrobat Pro 9.2

    I am working Acrobat Pro 9.2. When I insert a text box, it disappears when I click somewhere else.  I can only tell it's there If I hover over it - I get a black mouse arrow.  If I click on it and select it, then I can see the text and border, but if I click anywhere else, it disappears.  I've tried all the options and settings I can find.  It is set to show, not hide, all comments and text boxes.  Also, when I try to highlight regular text, it puts a little yellow, symbol above my text but does not highlight the text.  When I roll the mouse over it, a yellow note pops up with the text I highlighted, but when I move the mouse away, nothing is highlighted.  Again, I've tried changing all of the settings I can find related to highlighting but nothing works.  I use Acrobat on other computers and have used both text boxes and highlighting without any problem.  Is this due to a setting somewhere, or is there something wrong with my installation of Adobe?   Thanks.

    Something to check.
    To have text selected by the Highlight tool placed into the annotation's pop-up:
    Preferences > select Category "Commenting"
    There are three panes of configuration options.
    --| View Comments
    --| Pop-Up Open Behavior
    --| Making Comments
    Tick the last option (Copy selected text into Highlight, Cross-Out, and Underline comment pop-ups) in the third pane.
    Play with the other options as you may find others that are very useful.
    For form fields:
    Preferences > select Category "Forms"
    In the first pane (General), select "Show focus rectangle".
    In the second pane (Highlight Color) select "Show border hover color for fields".
    Be well...

Maybe you are looking for

  • While installing HANA studio , i am getting Error

    Hi Experts, While installing HANA studio, i am getting Error " Java installation not found" . I have already installed latest JDK, JRE from  www.java.com and also set path PATH. I am on Windows 7 , 64 bit. Any one have idea how to over come this Erro

  • IE version on Windows 8.1 64 bit

    Hi - I was trying to identify which bit version of IE (32 or 64) gets opened as default in windows 8.1 64 bit. What I am seeing here in my system is that it is always opening 64 bit IE browser even if I turn off protected mode. (by the properties iex

  • Is the ipad camera kit compatible with android 4g

    have sansung 4g phone can i use the camera kit for ipad to download pictures and video

  • Flash not playing nicely with IE favorites bar

    I administer a website ( http://womenscenter.uconn.edu/new_site/ ) which on its main page has a Flash movie looping. It also has a left menu bar for navigation, and everything is blissful until one turns on the favorites bar in Internet Explorer. The

  • Alias of a table is not recognized in the nested select statement

    Hi, I have to migrate a query in DB2 to Oracle. The query in DB2 uses Fetch First Row, this is being replaced by Rownum as follow. DB2 Query SELECT S.ID AS ID, (SELECT VALUE_N FROM ARCHIVE.PACKAGE_PARAMETERS WHERE PACKAGE_ID = S.ID AND ROWNUM < 2) AS