Border

Is it possible to add a border around a radio button? if so, how can i do so?

Comments

  • [b][red]This message was edited by creonnoir at 2002-9-20 0:34:58[/red][/b][hr]
    : Is it possible to add a border around a radio button? if so, how can i do so?
    :

    Anything that is derived from JComponent (which is all swing components, except for top-level containers) can have custom borders set, the syntax is below:

    [code] JRadioButton mybut = new JRadioButton;
    //using a custom border
    mybut.setBorder(MyCoolBorder);
    // or, using static BorderFactory methods
    mybut.setBorder(BorderFactory.createEtchedBorder());
    [/code]




  • : : Is it possible to add a border around a radio button? if so, how can i do so?
    : :

    Scratch the last post, I hadn't tried it with JRadioButton and I thought I should test it, it doesn't work! A simple workaround would be to use a JPanel, which does support .setBorder(), and add the JRadioButtons to the JPanel.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion