List of usage examples for javax.swing DefaultButtonModel getGroup
public ButtonGroup getGroup()
From source file:Main.java
/** * Determines if radio button is selected. * //from w ww .j a v a2 s .com * @param radioButton * @return */ public static boolean isRadioButtonSelected(JRadioButton radioButton) { DefaultButtonModel model = (DefaultButtonModel) radioButton.getModel(); return model.getGroup().isSelected(model); }
From source file:org.mbs3.juniuploader.gui.pnlSettings.java
private void logLevelBtnAction(ActionEvent evt) { JRadioButton jbr = (JRadioButton) evt.getSource(); DefaultButtonModel bm = (DefaultButtonModel) jbr.getModel(); ButtonGroup bg = bm.getGroup(); String pkg = "org.mbs.juniuploader"; String logClass = pkg + ".util.GUILog"; java.util.Vector toMark = new java.util.Vector(); String level = jbr.getActionCommand(); log.info("Changing logging level to " + level + " for selected components"); if (bg == grpMain) { log.debug("grpMain setting up level " + level); String prefix = pkg + ""; toMark.add(new String(prefix + ".ClassRunner")); toMark.add(new String(prefix + ".ShutdownThread")); toMark.add(new String(prefix + ".StatusThread")); toMark.add(new String(prefix + ".Uploader")); toMark.add(new String(prefix + ".util.Prefs")); toMark.add(new String(prefix + ".util.Util")); } else if (bg == grpGUI) { log.debug("grpGUI setting up level " + level); String prefix = pkg + ".gui"; toMark.add(new String(prefix + ".frmMain")); toMark.add(new String(prefix + ".pnlDebug")); toMark.add(new String(prefix + ".pnlFormVariables")); toMark.add(new String(prefix + ".pnlMainMenu")); toMark.add(new String(prefix + ".pnlRemoteInterface")); toMark.add(new String(prefix + ".pnlSettings")); toMark.add(new String(prefix + ".pnlUploadRules")); toMark.add(new String(prefix + ".pnlUploadSites")); toMark.add(new String(prefix + ".pnlWoWDirectories")); } else if (bg == grpObjects) { log.debug("grpObjects setting up level " + level); String prefix = pkg + ".objects"; toMark.add(new String(prefix + ".Addon")); toMark.add(new String(prefix + ".AddonFile")); toMark.add(new String(prefix + ".LocalSystem")); toMark.add(new String(prefix + ".RemoteSystem")); prefix = pkg + ".objects.localobjects"; toMark.add(new String(prefix + ".LUAFile")); toMark.add(new String(prefix + ".WAccount")); toMark.add(new String(prefix + ".WDirectory")); prefix = pkg + ".objects.remoteobjects"; toMark.add(new String(prefix + ".FormPair")); toMark.add(new String(prefix + ".FormPairGroup")); toMark.add(new String(prefix + ".UploadRule")); toMark.add(new String(prefix + ".UploadSite")); prefix = pkg + ".objects.util"; toMark.add(new String(prefix + ".CheckSummer")); toMark.add(new String(prefix + ".MyVector")); toMark.add(new String(prefix + ".UUIDGen")); } else if (bg == grpHTTP) { log.debug("grpHTTP setting up level " + level); toMark.add(new String("httpclient.wire.header")); toMark.add(new String("org.apache.commons.httpclient")); } else {//from w ww . j a va2 s . c om log.info("Unknown button group!!"); } // now that we know what properties to set, let's set them Iterator i = toMark.iterator(); while (i.hasNext()) { String name = (String) i.next(); System.setProperty(logClass + "." + name, level); log.trace("Configuring " + logClass + "." + name + " to " + level); } }