List of usage examples for javax.swing JRadioButton setOpaque
@BeanProperty(expert = true, description = "The component's opacity") public void setOpaque(boolean isOpaque)
From source file:src.gui.ItSIMPLE.java
/** * This method creates the panel containing the pddl version selection component * @return //from w w w. j a v a2 s . c o m */ private JPanel getPddlVersionSettingsPanel() { JPanel settingsPanel = new JPanel(); JRadioButton pddl21 = new JRadioButton("PDDL 2.1"); JRadioButton pddl22 = new JRadioButton("PDDL 2.2"); JRadioButton pddl30 = new JRadioButton("PDDL 3.0", true); JRadioButton pddl31 = new JRadioButton("PDDL 3.1"); pddl21.setOpaque(false); pddl21.setActionCommand(ToXPDDL.PDDL_2_1); pddl22.setOpaque(false); pddl22.setActionCommand(ToXPDDL.PDDL_2_2); pddl30.setOpaque(false); pddl30.setActionCommand(ToXPDDL.PDDL_3_0); pddl31.setOpaque(false); pddl31.setActionCommand(ToXPDDL.PDDL_3_1); pddlButtonsGroup = new ButtonGroup(); pddlButtonsGroup.add(pddl21); pddlButtonsGroup.add(pddl22); pddlButtonsGroup.add(pddl30); pddlButtonsGroup.add(pddl31); pddlButtonsGroup.setSelected(pddl21.getModel(), true); settingsPanel.setLayout(new BoxLayout(settingsPanel, BoxLayout.Y_AXIS)); settingsPanel.setOpaque(false); settingsPanel.add(pddl21); settingsPanel.add(pddl22); settingsPanel.add(pddl30); settingsPanel.add(pddl31); return settingsPanel; }
From source file:ome.formats.importer.gui.GuiCommonElements.java
/** * Add a radio button (with label) to parent container * //from w w w . j a va2 s.c om * @param container - parent container * @param label - radio button label * @param mnemonic - mnemonic for button * @param tooltip - button tool tip * @param placement - TableLayout placement of button in parent container * @param debug - turn on/off red debug borders * @return JRadioButton */ public static JRadioButton addRadioButton(Container container, String label, int mnemonic, String tooltip, String placement, boolean debug) { JRadioButton button = new JRadioButton(label); button.setToolTipText(tooltip); container.add(button, placement); button.setOpaque(false); return button; }
From source file:org.multibit.viewsystem.swing.view.panels.ShowPreferencesPanel.java
private JPanel createLanguagePanel(int stentWidth) { // Language radios. MultiBitTitledPanel languagePanel = new MultiBitTitledPanel( controller.getLocaliser().getString("showPreferencesPanel.languageTitle"), ComponentOrientation.getOrientation(controller.getLocaliser().getLocale())); GridBagConstraints constraints = new GridBagConstraints(); constraints.fill = GridBagConstraints.BOTH; constraints.gridx = 0;/* ww w.ja v a 2 s .co m*/ constraints.gridy = 3; constraints.weightx = 0.1; constraints.weighty = 0.05; constraints.gridwidth = 1; constraints.gridheight = 1; constraints.anchor = GridBagConstraints.LINE_START; JPanel indent = MultiBitTitledPanel.getIndentPanel(1); languagePanel.add(indent, constraints); constraints.fill = GridBagConstraints.BOTH; constraints.gridx = 1; constraints.gridy = 3; constraints.weightx = 0.3; constraints.weighty = 0.3; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.LINE_START; JPanel stent = MultiBitTitledPanel.createStent(stentWidth); languagePanel.add(stent, constraints); constraints.fill = GridBagConstraints.BOTH; constraints.gridx = 2; constraints.gridy = 3; constraints.weightx = 0.05; constraints.weighty = 0.3; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.CENTER; languagePanel.add(MultiBitTitledPanel.createStent(MultiBitTitledPanel.SEPARATION_BETWEEN_NAME_VALUE_PAIRS), constraints); ButtonGroup languageUsageGroup = new ButtonGroup(); useDefaultLocale = new JRadioButton(controller.getLocaliser().getString("showPreferencesPanel.useDefault")); useDefaultLocale.setOpaque(false); useDefaultLocale.setFont(FontSizer.INSTANCE.getAdjustedDefaultFont()); JRadioButton useSpecific = new JRadioButton( controller.getLocaliser().getString("showPreferencesPanel.useSpecific")); useSpecific.setOpaque(false); useSpecific.setFont(FontSizer.INSTANCE.getAdjustedDefaultFont()); ItemListener itemListener = new ChangeLanguageUsageListener(); useDefaultLocale.addItemListener(itemListener); useSpecific.addItemListener(itemListener); languageUsageGroup.add(useDefaultLocale); languageUsageGroup.add(useSpecific); constraints.fill = GridBagConstraints.NONE; constraints.gridx = 1; constraints.gridy = 4; constraints.weightx = 0.2; constraints.weighty = 0.3; constraints.gridwidth = 3; constraints.anchor = GridBagConstraints.LINE_START; languagePanel.add(useDefaultLocale, constraints); constraints.fill = GridBagConstraints.NONE; constraints.gridx = 1; constraints.gridy = 5; constraints.weightx = 0.2; constraints.weighty = 0.3; constraints.gridwidth = 3; constraints.anchor = GridBagConstraints.LINE_START; languagePanel.add(useSpecific, constraints); // Language combo box. int numberOfLanguages = Integer .parseInt(controller.getLocaliser().getString("showPreferencesPanel.numberOfLanguages")); // Languages are added to the combo box in alphabetic order. languageDataSet = new TreeSet<LanguageData>(); for (int i = 0; i < numberOfLanguages; i++) { String languageCode = controller.getLocaliser() .getString("showPreferencesPanel.languageCode." + (i + 1)); String language = controller.getLocaliser().getString("showPreferencesPanel.language." + (i + 1)); LanguageData languageData = new LanguageData(); languageData.languageCode = languageCode; languageData.language = language; languageData.image = createImageIcon(languageCode); languageData.image.setDescription(language); languageDataSet.add(languageData); } Integer[] indexArray = new Integer[languageDataSet.size()]; int index = 0; for (@SuppressWarnings("unused") LanguageData languageData : languageDataSet) { indexArray[index] = index; index++; } languageComboBox = new JComboBox(indexArray); languageComboBox.setFont(FontSizer.INSTANCE.getAdjustedDefaultFont()); languageComboBox.setOpaque(false); LanguageComboBoxRenderer renderer = new LanguageComboBoxRenderer(); FontMetrics fontMetrics = getFontMetrics(FontSizer.INSTANCE.getAdjustedDefaultFont()); Dimension preferredSize = new Dimension(fontMetrics.stringWidth(A_LONG_LANGUAGE_NAME) + LANGUAGE_COMBO_WIDTH_DELTA + LANGUAGE_CODE_IMAGE_WIDTH, fontMetrics.getHeight() + COMBO_HEIGHT_DELTA); renderer.setPreferredSize(preferredSize); languageComboBox.setRenderer(renderer); // Get the languageCode value stored in the model. String userLanguageCode = controller.getModel().getUserPreference(CoreModel.USER_LANGUAGE_CODE); if (userLanguageCode == null || CoreModel.USER_LANGUAGE_IS_DEFAULT.equals(userLanguageCode)) { useDefaultLocale.setSelected(true); languageComboBox.setEnabled(false); } else { useSpecific.setSelected(true); int startingIndex = 0; Integer languageCodeIndex = 0; for (LanguageData languageData : languageDataSet) { if (languageData.languageCode.equals(userLanguageCode)) { languageCodeIndex = startingIndex; break; } startingIndex++; } if (languageCodeIndex != 0) { languageComboBox.setSelectedItem(languageCodeIndex); languageComboBox.setEnabled(true); } } // Store original value for use by submit action. originalUserLanguageCode = userLanguageCode; constraints.fill = GridBagConstraints.NONE; constraints.gridx = 3; constraints.gridy = 6; constraints.weightx = 0.8; constraints.weighty = 0.6; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.LINE_START; languagePanel.add(languageComboBox, constraints); JPanel fill1 = new JPanel(); fill1.setOpaque(false); constraints.fill = GridBagConstraints.BOTH; constraints.gridx = 4; constraints.gridy = 6; constraints.weightx = 20; constraints.weighty = 1; constraints.gridwidth = 1; constraints.anchor = GridBagConstraints.LINE_END; languagePanel.add(fill1, constraints); return languagePanel; }
From source file:org.ut.biolab.medsavant.client.filter.FilterHistoryPanel.java
public FilterHistoryPanel() { FilterController.getInstance().addListener(new Listener<FilterEvent>() { @Override//from w w w . j av a2 s .c o m public void handleEvent(final FilterEvent event) { new MedSavantWorker<Void>("FilterHistoryPanel") { @Override protected void showProgress(double fraction) { } @Override protected void showSuccess(Void result) { } @Override protected Void doInBackground() throws Exception { int numLeft = ResultController.getInstance().getFilteredVariantCount(); addFilterSet(event.getFilter(), event.getType(), numLeft); return null; } }.execute(); } }); ReferenceController.getInstance().addListener(new Listener<ReferenceEvent>() { @Override public void handleEvent(ReferenceEvent event) { if (event.getType() == ReferenceEvent.Type.CHANGED) { reset(); } } }); //this.setBackground(new Color(100,100,100)); this.setBorder(ViewUtil.getMediumBorder()); this.setMinimumSize(new Dimension(200, 300)); this.setPreferredSize(new Dimension(200, 300)); this.setName("History"); this.setLayout(new BorderLayout()); table = new JTable() { @Override public TableCellRenderer getCellRenderer(int row, int column) { if (model.getColumnClass(column).equals(JPanel.class)) { return new JPanelRenderer(); } return super.getCellRenderer(row, column); } }; model = new ProgressTableModel(); table.setModel(model); JPanel modePanel = ViewUtil.getClearPanel(); ButtonGroup group = new ButtonGroup(); JRadioButton globalButton = new JRadioButton("Global"); ViewUtil.makeSmall(globalButton); globalButton.setSelected(true); globalButton.setOpaque(false); JRadioButton relativeButton = new JRadioButton("Relative to previous change"); ViewUtil.makeSmall(relativeButton); relativeButton.setOpaque(false); globalButton.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { changeMode(Mode.GLOBAL); } }); relativeButton.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { changeMode(Mode.RELATIVE); } }); group.add(globalButton); group.add(relativeButton); modePanel.add(globalButton); modePanel.add(relativeButton); this.add(modePanel, BorderLayout.NORTH); final JScrollPane scrollPane = new JScrollPane(); scrollPane.getViewport().add(table); this.add(scrollPane, BorderLayout.CENTER); reset(); //FilterController.addFilterListener(this); }