本文整理汇总了Java中javax.swing.AbstractButton.isSelected方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractButton.isSelected方法的具体用法?Java AbstractButton.isSelected怎么用?Java AbstractButton.isSelected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.AbstractButton
的用法示例。
在下文中一共展示了AbstractButton.isSelected方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeButtonContentAreaAndBorder
import javax.swing.AbstractButton; //导入方法依赖的package包/类
private static void removeButtonContentAreaAndBorder(AbstractButton button) {
boolean canRemove = true;
if (button instanceof JToggleButton) {
canRemove = !button.isSelected();
}
if (canRemove) {
button.setContentAreaFilled(false);
button.setBorderPainted(false);
}
}
示例2: getDefaultComponent
import javax.swing.AbstractButton; //导入方法依赖的package包/类
public Component getDefaultComponent(Container aContainer) {
Component c = getFirstComponent(aContainer);
if (c instanceof AbstractButton) {
ButtonModel bm = ((AbstractButton)c).getModel();
if (bm instanceof DefaultButtonModel) {
ButtonGroup bg = ((DefaultButtonModel)bm).getGroup();
Enumeration<AbstractButton> en = bg == null ? null : bg.getElements();
while (en != null && en.hasMoreElements()) {
AbstractButton ab = en.nextElement();
if (ab.isSelected()) return ab;
}
}
}
return c;
}
示例3: getSelectedButtonText
import javax.swing.AbstractButton; //导入方法依赖的package包/类
String getSelectedButtonText(ButtonGroup buttonGroup) {
for (Enumeration buttons = buttonGroup.getElements(); buttons.hasMoreElements();) {
AbstractButton button = (AbstractButton) buttons.nextElement();
if (button.isSelected()) {
return button.getText();
}
}
return null;
}
开发者ID:srilekhadasari,项目名称:online-quiz-application-in-java-with-jdbc-using-swing-login-registration-timer,代码行数:11,代码来源:Questions.java
示例4: refresh
import javax.swing.AbstractButton; //导入方法依赖的package包/类
private void refresh(final AbstractButton b) {
b.setBackground(UIUtils.getProfilerResultsBackground());
boolean hovered = Boolean.TRUE.equals(b.getClientProperty(PROP_HOVERED));
boolean filled = b.isEnabled() && (hovered || b.isSelected() || b.isFocusOwner());
b.setOpaque(filled);
b.setContentAreaFilled(filled);
b.repaint();
}
示例5: getSelected
import javax.swing.AbstractButton; //导入方法依赖的package包/类
public JRadioButton getSelected() {
Enumeration<AbstractButton> en = radioGroup.getElements();
while (en.hasMoreElements()) {
AbstractButton b = en.nextElement();
if (b.isSelected()) {
return (JRadioButton)b;
}
}
throw new IllegalStateException();
}
示例6: isSelectionEmpty
import javax.swing.AbstractButton; //导入方法依赖的package包/类
@Override
public boolean isSelectionEmpty()
{
for( AbstractButton button : choices.keySet() )
{
if( button.isSelected() )
{
return false;
}
}
return true;
}
示例7: itemStateChanged
import javax.swing.AbstractButton; //导入方法依赖的package包/类
@Override
public void itemStateChanged(ItemEvent e)
{
AbstractButton button = (AbstractButton) e.getSource();
if( button.isSelected() )
{
choiceSelected(button);
}
else
{
choiceDeselected(button);
}
}
示例8: getSelectedButtonText
import javax.swing.AbstractButton; //导入方法依赖的package包/类
/**
* Determines the label of the current selected button.
* @param buttonGroup
* @return The text label of the selected button.
*/
public static String getSelectedButtonText(ButtonGroup buttonGroup) {
for (Enumeration<AbstractButton> buttons = buttonGroup.getElements(); buttons.hasMoreElements();) {
AbstractButton button = buttons.nextElement();
if (button.isSelected()) {
return button.getText();
}
}
return null;
}
示例9: getSelectedButton
import javax.swing.AbstractButton; //导入方法依赖的package包/类
private String getSelectedButton(ButtonGroup bGroup) {
for (Enumeration<AbstractButton> buttons = bGroup.getElements(); buttons.hasMoreElements();) {
AbstractButton button = buttons.nextElement();
if (button.isSelected()) {
return button.getText();
}
}
return "None";
}
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:10,代码来源:CognizantITSSettings.java
示例10: isEnabledAndSelected
import javax.swing.AbstractButton; //导入方法依赖的package包/类
@Override
protected boolean isEnabledAndSelected(AbstractButton button)
{
return button.isEnabled() && button.isSelected();
}
示例11: mousePressed
import javax.swing.AbstractButton; //导入方法依赖的package包/类
public void mousePressed( MouseEvent evt ) {
dragWindow = false;
dragMap = false;
if( evt.isControlDown() ) {
return;
}
Rectangle r = map.getVisibleRect();
if (rect == null) return;
r.x += x;
r.y += y;
r.width = this.w;
r.height = this.h;
if( r.contains( evt.getPoint() ) ) {
evt.consume();
AbstractButton b = map.getMapTools().profileB;
profileEnabled = b.isSelected();
if (profileEnabled) b.doClick();
dragWindow = true;
lastPoint = evt.getPoint();
r.x+=rect.x;
r.y+=rect.y;
r.width=(int)rect.width;
r.height=(int)rect.height;
if (r.contains(evt.getPoint())){
dragMap=true;
dragWindow = false;
drawRect();
} else if (rect.x+rect.width>this.w){
r.x-=this.w;
if (r.contains(evt.getPoint())) {
rect.x-=this.w;
dragMap=true;
dragWindow = false;
drawRect();
}
}
else
drawBox();
}
}