blob: bd5318d1eef96e2afa2d10d74feed55df2bfa2ca [file] [log] [blame]
package com.intellij.ui.components;
import com.intellij.ui.AnchorableComponent;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
/**
* @author evgeny.zakrevsky
*/
public class JBRadioButton extends JRadioButton implements AnchorableComponent {
private JComponent myAnchor;
public JBRadioButton() {
}
public JBRadioButton(Icon icon) {
super(icon);
}
public JBRadioButton(Action a) {
super(a);
}
public JBRadioButton(Icon icon, boolean selected) {
super(icon, selected);
}
public JBRadioButton(String text) {
super(text);
}
public JBRadioButton(String text, boolean selected) {
super(text, selected);
}
public JBRadioButton(String text, Icon icon) {
super(text, icon);
}
public JBRadioButton(String text, Icon icon, boolean selected) {
super(text, icon, selected);
}
@Override
public JComponent getAnchor() {
return myAnchor;
}
@Override
public void setAnchor(@Nullable JComponent anchor) {
this.myAnchor = anchor;
}
@Override
public Dimension getPreferredSize() {
return myAnchor == null || myAnchor == this ? super.getPreferredSize() : myAnchor.getPreferredSize();
}
@Override
public Dimension getMinimumSize() {
return myAnchor == null || myAnchor == this ? super.getMinimumSize() : myAnchor.getMinimumSize();
}
}