質問

I am migrating 'Java Swing' code from 'Java Visual Cafe' JDK1.2 to 'Eclipse SDK6'. In Visual Cafe it has code is like this:

public  Sample extends JPanel(){
    .....
    package com.symantec.itools.javax.swing.JButtonGroupPanel  bgAcc = new com.symantec.itools.javax.swing.JButtonGroupPanel();
    ....
    bgAcc.setBorder(tbAcc);  //tbAcc  is titledBorder component  type
    ..
    bgAcc.setBounds(0,108,400,76);
    ...
    bgAcc.add(bgLb);     // bgLb  is  JLabel  component type
    ..
    bgAcc.add(button1, new GridBagConstraints(...));
    ..
}

Can anyone suggest how I can replace this code in Eclipse SDK6? I am unable find these methods for 'ButtonGroup' in 'Swing'.

役に立ちましたか?

解決

I am not familiar wit the JButtonGroupPanel class, but those methods you use are all available on a regular JPanel as well.

ButtonGroup is a completely different concept in Swing then a JPanel. A ButtonGroup is for example used to group a set of JRadioButtons, and makes sure that only one radio button in that group can be selected at the time. But a ButtonGroup is not a JComponent nor a Container, so of course you will not find methods like setBorder on it.

Side-note: do not port those setBounds calls. Use a decent LayoutManager instead

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top