protected JPanel north2() { JPanel panel = new JPanel(); panel.setLayout(new GridLayout(5, 1)); panel.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)); JLabel typeLabel = new JLabel("Model"); JRadioButton dominantRB = new JRadioButton("Dominant"); dominantRB.setActionCommand("Dominant"); dominantRB.setSelected(true); JRadioButton recessiveRB = new JRadioButton("Recessive"); recessiveRB.setActionCommand("Recessive"); JRadioButton additiveRB = new JRadioButton("Additive"); additiveRB.setActionCommand("Additive"); JRadioButton alleleRB = new JRadioButton("Allele"); alleleRB.setActionCommand("Allele"); modelBgroup = new ButtonGroup(); modelBgroup.add(dominantRB); modelBgroup.add(recessiveRB); modelBgroup.add(additiveRB); modelBgroup.add(alleleRB); dominantRB.addActionListener(this); recessiveRB.addActionListener(this); additiveRB.addActionListener(this); alleleRB.addActionListener(this); panel.add(typeLabel); panel.add(dominantRB); panel.add(recessiveRB); panel.add(additiveRB); panel.add(alleleRB); return panel; }
// ----------------------------------------------------------------- // Sets up a panel with a label and a set of radio buttons // that control its text. // ----------------------------------------------------------------- public QuoteOptionsPanel() { comedyQuote = "Take my wife, please."; philosophyQuote = "I think, therefore I am."; carpentryQuote = "Measure twice. Cut once."; quote = new JLabel(comedyQuote); quote.setFont(new Font("Helvetica", Font.BOLD, 24)); comedy = new JRadioButton("Comedy", true); comedy.setBackground(Color.green); philosophy = new JRadioButton("Philosophy"); philosophy.setBackground(Color.green); carpentry = new JRadioButton("Carpentry"); carpentry.setBackground(Color.green); ButtonGroup group = new ButtonGroup(); group.add(comedy); group.add(philosophy); group.add(carpentry); QuoteListener listener = new QuoteListener(); comedy.addActionListener(listener); philosophy.addActionListener(listener); carpentry.addActionListener(listener); add(quote); add(comedy); add(philosophy); add(carpentry); setBackground(Color.green); setPreferredSize(new Dimension(300, 100)); }
public ReadOnlyStatusDialog(Project project, final FileInfo[] files) { super(project); myFiles = files; initFileList(); ActionListener listener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { myChangelist.setEnabled(myUsingVcsRadioButton.isSelected()); } }; myUsingVcsRadioButton.addActionListener(listener); myUsingFileSystemRadioButton.addActionListener(listener); if (myUsingVcsRadioButton.isEnabled()) { myUsingVcsRadioButton.setSelected(true); } else { myUsingFileSystemRadioButton.setSelected(true); } myChangelist.setEnabled(myUsingVcsRadioButton.isSelected()); myFileList.setCellRenderer(new FileListRenderer()); setTitle(VcsBundle.message("dialog.title.clear.read.only.file.status")); init(); }
/** * Adds the connection speed options to the display. * * @param index The default index. * @param comp The component to add to the display. * @return See above. */ private JPanel buildConnectionSpeed(int index, JComponent comp) { JPanel p = new JPanel(); p.setBorder(BorderFactory.createTitledBorder("Connection Speed")); buttonsGroup = new ButtonGroup(); JRadioButton button = new JRadioButton(); button.setText("LAN"); button.setActionCommand("" + HIGH_SPEED); button.addActionListener(this); button.setSelected(index == LoginCredentials.HIGH); buttonsGroup.add(button); p.add(button); button = new JRadioButton(); button.setText("High (Broadband)"); button.setActionCommand("" + MEDIUM_SPEED); button.setSelected(index == LoginCredentials.MEDIUM); button.addActionListener(this); buttonsGroup.add(button); p.add(button); button = new JRadioButton(); button.setText("Low (Dial-up)"); button.setActionCommand("" + LOW_SPEED); button.setSelected(index == LoginCredentials.LOW); button.addActionListener(this); buttonsGroup.add(button); p.add(button); if (comp == null) return p; JPanel content = new JPanel(); content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS)); content.add(comp); p = UIUtilities.buildComponentPanel(p); content.add(p); return content; }
private void addListeners() { btnBrowse.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { FileDialog fd = new FileDialog(frame, "Snapshot File", FileDialog.LOAD); fd.show(); String file = fd.getFile(); if (file == null) return; file = fd.getDirectory() + file; fd.dispose(); fldName.setText(file); } }); btnCancel.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { cancel = true; close(); } }); btnNext.addActionListener(next); btnBack.addActionListener(back); btnNone.setActionCommand("none"); btnInterval.setActionCommand("interval"); btnPauseAndEnd.setActionCommand("pause"); btnNone.addActionListener(captureAt); btnPauseAndEnd.addActionListener(captureAt); btnInterval.addActionListener(captureAt); }
private JPanel createFoodTypeButtons(String[] array) { JPanel radioPanel = new JPanel(); typeOfFood = new ArrayList<JRadioButton>(); JRadioButton type0Radio = new JRadioButton(this.e.nonPerishableFood); JRadioButton type1Radio = new JRadioButton(this.e.perishableFood); typeOfFood.add(type0Radio); typeOfFood.add(type1Radio); type0Radio.setActionCommand(this.e.nonPerishableFood); type1Radio.setActionCommand(this.e.perishableFood); // Register a listener for the radio buttons. RadioListener myListener = new RadioListener(type0Radio, type1Radio, newCreatureButton, newJewelButton); type0Radio.addActionListener(myListener); type1Radio.addActionListener(myListener); // Group the radio buttons. group = new ButtonGroup(); group.add(type0Radio); group.add(type1Radio); model = new DefaultButtonModel(); group.setSelected(model, false); radioPanel.setLayout(new GridLayout(0, 1)); radioPanel.add(type0Radio); radioPanel.add(type1Radio); return radioPanel; }
private JPanel createDynamicPanel() { // interacting rendering quality rdoDynamicRendQualLow = new JRadioButton("Low"); rdoDynamicRendQualHigh = new JRadioButton("High"); grpDynamicRendQual = new ButtonGroup(); grpDynamicRendQual.add(rdoDynamicRendQualLow); grpDynamicRendQual.add(rdoDynamicRendQualHigh); ActionListener rdoDynamicActionListener = new ActionListener() { public void actionPerformed(ActionEvent e) { dynamicRendQual = (rdoDynamicRendQualLow.isSelected() ? PPaintContext.LOW_QUALITY_RENDERING : PPaintContext.HIGH_QUALITY_RENDERING); } }; rdoDynamicRendQualLow.addActionListener(rdoDynamicActionListener); rdoDynamicRendQualHigh.addActionListener(rdoDynamicActionListener); JLabel lbl = new JLabel("Dynamic Rendering Quality: "); lbl.setPreferredSize(new Dimension(LABEL_WIDTH, 16)); JPanel pnlDynamic = new JPanel(new FlowLayout(FlowLayout.LEFT)); pnlDynamic.setBorder(BorderFactory.createEtchedBorder()); pnlDynamic.add(lbl); pnlDynamic.add(rdoDynamicRendQualLow); pnlDynamic.add(rdoDynamicRendQualHigh); return pnlDynamic; }
private JPanel getImageTypePanel() { buttonByteBinary = new JRadioButton("Byte Binary"); buttonByteBinary.setActionCommand("ByteBinary"); buttonByteBinary.addActionListener(this); buttonByteBinary.setSelected(true); params.setProperty("type", Integer.toString(BufferedImage.TYPE_BYTE_BINARY)); buttonByteIndexed = new JRadioButton("Byte Indexed"); buttonByteIndexed.setActionCommand("ByteIndexed"); buttonByteIndexed.addActionListener(this); buttonByteGrayScaled = new JRadioButton("Byte Gray Scale"); buttonByteGrayScaled.setActionCommand("ByteGrayScale"); buttonByteGrayScaled.addActionListener(this); ButtonGroup group = new ButtonGroup(); group.add(buttonByteBinary); group.add(buttonByteIndexed); group.add(buttonByteGrayScaled); JPanel p = new JPanel(new GridLayout(1, 0)); p.setBorder(new TitledBorder(new EtchedBorder(), "Image Type")); p.add(buttonByteBinary); p.add(buttonByteIndexed); p.add(buttonByteGrayScaled); return p; }
private JPanel getBPPPanel() { buttonBPP1 = new JRadioButton("1"); buttonBPP1.setActionCommand("bpp1"); buttonBPP1.addActionListener(this); buttonBPP1.setSelected(true); params.setProperty("bpp", "1"); buttonBPP2 = new JRadioButton("2"); buttonBPP2.setActionCommand("bpp2"); buttonBPP2.addActionListener(this); buttonBPP4 = new JRadioButton("4"); buttonBPP4.setActionCommand("bpp4"); buttonBPP4.addActionListener(this); buttonBPP8 = new JRadioButton("8"); buttonBPP8.setActionCommand("bpp8"); buttonBPP8.addActionListener(this); buttonBPP8.setEnabled(false); ButtonGroup group = new ButtonGroup(); group.add(buttonBPP1); group.add(buttonBPP2); group.add(buttonBPP4); group.add(buttonBPP8); JPanel p = new JPanel(new GridLayout(1, 0)); p.setBorder(new TitledBorder(new EtchedBorder(), "Bits Per Pixel")); p.add(buttonBPP1); p.add(buttonBPP2); p.add(buttonBPP4); p.add(buttonBPP8); return p; }
private JPanel getSouthWestPanel() { JPanel ret = new JPanel(); JRadioButton low = new JRadioButton("小写显示"); low.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { uppercase = false; } }); ret.add(low); JRadioButton up = new JRadioButton("大写显示"); up.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { uppercase = true; } }); ret.add(up); ButtonGroup bg = new ButtonGroup(); bg.add(low); bg.add(up); low.setSelected(true); return ret; }
private void initRadioButtons() { myDefaultOSApplicationRadioButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateControls(); } }); myBrowserRadioButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateControls(); IdeFocusManager.getInstance(myProject) .requestFocus(myBrowserSelector.getMainComponent(), true); } }); myPlayerRadioButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateControls(); IdeFocusManager.getInstance(myProject) .requestFocus(myPlayerTextWithBrowse.getTextField(), true); } }); }
public StyleConverter() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); text = new JTextArea(40, 80); sldButton1_0 = new JRadioButton(SLD_1_0); seButton_1_1 = new JRadioButton(SE_1_1); sldButton_1_1 = new JRadioButton(SLD_1_0); group = new ButtonGroup(); group.add(sldButton1_0); group.add(seButton_1_1); group.add(sldButton_1_1); sldButton1_0.addActionListener(convertListener); seButton_1_1.addActionListener(convertListener); sldButton_1_1.addActionListener(convertListener); importSLD = new JButton("Import SLD"); importSLD.setActionCommand("importSLD"); export.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (style != null) { importSLD(); } } }); importSE = new JButton("Import SE"); importSE.setEnabled(false); export = new JButton("Export"); export.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (style != null) { export(); } } }); getContentPane().setLayout(new MigLayout("", "[[]][][][grow][]", "[][][][][grow][]")); getContentPane().add(new JLabel("Format"), "cell 0 0,alignx left,aligny top"); getContentPane().add(sldButton1_0, "cell 1 0"); getContentPane().add(seButton_1_1, "cell 2 0"); getContentPane().add(sldButton_1_1, "cell 3 0"); getContentPane().add(new JLabel("Style"), "cell 0 1,alignx left,aligny top"); getContentPane().add(new JScrollPane(text), "cell 0 2 5 5,grow"); getContentPane().add(importSLD, "cell 6 2"); getContentPane().add(importSE, "cell 6 3"); getContentPane().add(export, "cell 6 5"); }
/** TabbedPaneDemo Constructor */ public TabbedPaneDemo(SwingSet2 swingset) { // Set the title for this demo, and an icon used to represent this // demo inside the SwingSet2 app. super(swingset, "TabbedPaneDemo", "toolbar/JTabbedPane.gif"); // create tab position controls JPanel tabControls = new JPanel(); tabControls.add(new JLabel(getString("TabbedPaneDemo.label"))); top = (JRadioButton) tabControls.add(new JRadioButton(getString("TabbedPaneDemo.top"))); left = (JRadioButton) tabControls.add(new JRadioButton(getString("TabbedPaneDemo.left"))); bottom = (JRadioButton) tabControls.add(new JRadioButton(getString("TabbedPaneDemo.bottom"))); right = (JRadioButton) tabControls.add(new JRadioButton(getString("TabbedPaneDemo.right"))); getDemoPanel().add(tabControls, BorderLayout.NORTH); group = new ButtonGroup(); group.add(top); group.add(bottom); group.add(left); group.add(right); top.setSelected(true); top.addActionListener(this); bottom.addActionListener(this); left.addActionListener(this); right.addActionListener(this); // create tab tabbedpane = new JTabbedPane(); getDemoPanel().add(tabbedpane, BorderLayout.CENTER); String name = getString("TabbedPaneDemo.laine"); JLabel pix = new JLabel(createImageIcon("tabbedpane/laine.jpg", name)); tabbedpane.add(name, pix); name = getString("TabbedPaneDemo.ewan"); pix = new JLabel(createImageIcon("tabbedpane/ewan.jpg", name)); tabbedpane.add(name, pix); name = getString("TabbedPaneDemo.hania"); pix = new JLabel(createImageIcon("tabbedpane/hania.jpg", name)); tabbedpane.add(name, pix); name = getString("TabbedPaneDemo.bounce"); spin = new HeadSpin(); tabbedpane.add(name, spin); tabbedpane .getModel() .addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { SingleSelectionModel model = (SingleSelectionModel) e.getSource(); if (model.getSelectedIndex() == tabbedpane.getTabCount() - 1) { spin.go(); } } }); }
protected void _init() { ButtonHandler handler = new ButtonHandler(); // Core JPanel corePanel = new JPanel(); corePanel.setLayout(new BoxLayout(corePanel, BoxLayout.X_AXIS)); corePanel.add( coreIncluded = new JRadioButton(jEdit.getProperty("options.clojure.included-core-label"))); corePanel.add(coreCustom = new JRadioButton(jEdit.getProperty("options.clojure.choose-label"))); ButtonGroup coreGroup = new ButtonGroup(); coreGroup.add(coreIncluded); coreGroup.add(coreCustom); corePanel.add(new JSeparator(JSeparator.VERTICAL)); corePanel.add(corePath = new JTextField()); coreBrowse = new JButton(jEdit.getProperty("vfs.browser.browse.label")); coreBrowse.addActionListener(new BrowseHandler(corePath)); corePanel.add(coreBrowse); String core = plugin.getClojureCore(); if (core.equals(ClojurePlugin.includedCore)) { coreIncluded.setSelected(true); corePath.setEnabled(false); coreBrowse.setEnabled(false); } else { coreCustom.setSelected(true); corePath.setText(core); } coreIncluded.addActionListener(handler); coreCustom.addActionListener(handler); addComponent("Core:", corePanel); // Contrib JPanel contribPanel = new JPanel(); contribPanel.setLayout(new BoxLayout(contribPanel, BoxLayout.X_AXIS)); contribPanel.add(contribIncluded = new JRadioButton("Included (1.1.0)")); contribPanel.add(contribCustom = new JRadioButton("Choose jar")); ButtonGroup contribGroup = new ButtonGroup(); contribGroup.add(contribIncluded); contribGroup.add(contribCustom); contribPanel.add(new JSeparator(JSeparator.VERTICAL)); contribPanel.add(contribPath = new JTextField()); contribBrowse = new JButton(jEdit.getProperty("vfs.browser.browse.label")); contribBrowse.addActionListener(new BrowseHandler(contribPath)); contribPanel.add(contribBrowse); String contrib = plugin.getClojureContrib(); if (contrib.equals(ClojurePlugin.includedContrib)) { contribIncluded.setSelected(true); contribPath.setEnabled(false); contribBrowse.setEnabled(false); } else { contribCustom.setSelected(true); contribPath.setText(contrib); } contribIncluded.addActionListener(handler); contribCustom.addActionListener(handler); addComponent("Contrib:", contribPanel); }
/** Constructs a <code>GDMInitDialog</code> with default initial parameters. */ public GDMInitDialog(Frame parent, boolean useGenes) { super(parent, "Gene Distance Matrix Initialization", true); Listener listener = new Listener(); addWindowListener(listener); ParameterPanel parameters = new ParameterPanel(); parameters.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(0, 0, 0, 0); genRadio = new JRadioButton("Genes"); genRadio.setBackground(Color.white); genRadio.setFocusPainted(false); gbc.gridx = 0; gbc.gridy = 4; parameters.add(genRadio, gbc); expRadio = new JRadioButton("Samples"); expRadio.setBackground(Color.white); expRadio.setFocusPainted(false); gbc.gridx = 1; gbc.gridy = 4; parameters.add(expRadio, gbc); ButtonGroup bg = new ButtonGroup(); bg.add(genRadio); bg.add(expRadio); genRadio.setActionCommand("gene-radio-command"); genRadio.addActionListener(listener); expRadio.setActionCommand("gene-radio-command"); expRadio.addActionListener(listener); genRadio.setEnabled(useGenes); genRadio.setSelected(useGenes); expRadio.setEnabled(!useGenes); expRadio.setSelected(!useGenes); gbc.gridx = 0; gbc.gridy = 10; displayLabel = new JLabel(" Display Interval "); parameters.add(displayLabel, gbc); gbc.gridx = 1; gbc.gridy = 10; textField = new JTextField(String.valueOf(1), 7); parameters.add(textField, gbc); this.addContent(parameters); this.setActionListeners(listener); pack(); }
public ToneMapPanel() { final JLabel midpointLabel = new JLabel("Midpoint:"); toneMappingChoice.add(noTRButton); toneMappingChoice.add(wardTRButton); toneMappingChoice.add(reinhardTRButton); noTRButton.setSelected(true); final ActionListener delegatingActionListener = new ActionListener() { @Override public void actionPerformed(final ActionEvent evt) { midpointValue.setEnabled(reinhardTRButton.isSelected()); midpointLabel.setEnabled(reinhardTRButton.isSelected()); fireActionEvent(); } }; noTRButton.addActionListener(delegatingActionListener); wardTRButton.addActionListener(delegatingActionListener); reinhardTRButton.addActionListener(delegatingActionListener); midpointValue.setColumns(4); midpointValue.setValue(0.18); midpointValue.addActionListener(delegatingActionListener); midpointValue.setEnabled(reinhardTRButton.isSelected()); midpointLabel.setEnabled(reinhardTRButton.isSelected()); maxLumValue.setValue(0.0); maxLumValue.setColumns(6); maxLumValue.addActionListener(delegatingActionListener); // midpointValue.addFocusListener(new FocusAdapter() { // // @Override // public void focusLost(FocusEvent e) { // super.focusLost(e); // } // // }); setLayout( new MigLayout( "wrap 2, ax center", "[align right, sg 1]r[align left, sg 1]", "[]r[]r[]r[]u[]r[]")); add(new JLabel("Mapping:")); add(noTRButton); add(wardTRButton, "skip 1"); add(reinhardTRButton, "skip 1"); add(midpointLabel); add(midpointValue); add(new JLabel("White Point: ")); add(maxLumValue); add(new JLabel("(0=>auto)"), "skip 1"); }
public MoveClassesOrPackagesDialog( Project project, boolean searchTextOccurences, PsiElement[] elementsToMove, final PsiElement initialTargetElement, MoveCallback moveCallback) { super(project, true); myElementsToMove = elementsToMove; myMoveCallback = moveCallback; myManager = PsiManager.getInstance(myProject); setTitle(MoveHandler.REFACTORING_NAME); mySearchTextOccurencesEnabled = searchTextOccurences; selectInitialCard(); init(); if (initialTargetElement instanceof PsiClass) { myMakeInnerClassOfRadioButton.setSelected(true); myInnerClassChooser.setText(((PsiClass) initialTargetElement).getQualifiedName()); ApplicationManager.getApplication() .invokeLater( () -> myInnerClassChooser.requestFocus(), ModalityState.stateForComponent(myMainPanel)); } else if (initialTargetElement instanceof PsiPackage) { myClassPackageChooser.setText(((PsiPackage) initialTargetElement).getQualifiedName()); } updateControlsEnabled(); myToPackageRadioButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { updateControlsEnabled(); myClassPackageChooser.requestFocus(); } }); myMakeInnerClassOfRadioButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { updateControlsEnabled(); myInnerClassChooser.requestFocus(); } }); for (PsiElement element : elementsToMove) { if (element.getContainingFile() != null) { myOpenInEditorPanel.add(initOpenInEditorCb(), BorderLayout.EAST); break; } } }
public FileSortTab(JabRefPreferences prefs) { this.prefs = prefs; FormLayout layout = new FormLayout("4dlu, left:pref, 4dlu, fill:pref", ""); DefaultFormBuilder builder = new DefaultFormBuilder(layout); builder.leadingColumnOffset(1); // EXPORT SORT ORDER // create Components exportInOriginalOrder = new JRadioButton(Localization.lang("Export entries in their original order")); exportInTableOrder = new JRadioButton(Localization.lang("Export in current table sort order")); exportInSpecifiedOrder = new JRadioButton(Localization.lang("Export entries ordered as specified")); ButtonGroup buttonGroup = new ButtonGroup(); buttonGroup.add(exportInOriginalOrder); buttonGroup.add(exportInTableOrder); buttonGroup.add(exportInSpecifiedOrder); ActionListener listener = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { boolean selected = e.getSource() == exportInSpecifiedOrder; exportOrderPanel.setEnabled(selected); } }; exportInOriginalOrder.addActionListener(listener); exportInTableOrder.addActionListener(listener); exportInSpecifiedOrder.addActionListener(listener); // create GUI builder.appendSeparator(Localization.lang("Export sort order")); builder.append(exportInOriginalOrder, 1); builder.nextLine(); builder.append(exportInTableOrder, 1); builder.nextLine(); builder.append(exportInSpecifiedOrder, 1); builder.nextLine(); exportOrderPanel = new SaveOrderConfigDisplay(); builder.append(exportOrderPanel.getPanel()); builder.nextLine(); // COMBINE EVERYTHING JPanel pan = builder.getPanel(); pan.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); setLayout(new BorderLayout()); add(pan, BorderLayout.CENTER); }
public RadioButtons() { rb1.addActionListener(al); rb2.addActionListener(al); rb3.addActionListener(al); g.add(rb1); g.add(rb2); g.add(rb3); t.setEditable(false); setLayout(new FlowLayout()); add(t); add(rb1); add(rb2); add(rb3); }
/** Constructeur par défaut. Construit une fenêtre permettant de modifier le thème. */ public ThemeView() { super("Configuration Theme"); /* *Initialisation des composants et attribution des titres à chaque composant */ selectionColor = new JColorChooser(GridView.getBackgroundColor()); bordersColor = new JRadioButton("Bordure des cases"); selectedCaseColor = new JRadioButton("Bordure de la case courante"); alreadyViewColor = new JRadioButton("Fond des cases déjà vues"); caseBackground = new JRadioButton("Fond des cases"); caseBackground.setSelected(true); // Création du groupe de bouttons options = new ButtonGroup(); options.add(bordersColor); options.add(selectedCaseColor); options.add(alreadyViewColor); options.add(caseBackground); // Disposition des composants dans le panneau this.setLayout(new BoxLayout(this.getContentPane(), BoxLayout.Y_AXIS)); // création d'une boite horizontale pour placer les composants du thème Box b = Box.createHorizontalBox(); b.add(caseBackground); b.add(bordersColor); this.add(Box.createRigidArea(new Dimension(0, 20))); this.add(b); this.add(Box.createRigidArea(new Dimension(0, 20))); b = Box.createHorizontalBox(); b.add(selectedCaseColor); b.add(alreadyViewColor); this.add(b); this.add(Box.createRigidArea(new Dimension(0, 20))); this.add(selectionColor); this.setDefaultCloseOperation(DISPOSE_ON_CLOSE); this.pack(); /* *Ajout d'ecouteurs */ caseBackground.addActionListener(this); bordersColor.addActionListener(this); selectionColor.getSelectionModel().addChangeListener(this); }
public JPanel generateLayerPanel(Map map) { LayerPanel = new JPanel(); LayerName = new JLabel(this.layerName + " : "); LayerPanel.add(LayerName); Sites = new JRadioButton("Sites"); Sites.addActionListener(this); LayerPanel.add(Sites); Mask = new JRadioButton("Mask"); Mask.addActionListener(this); if (sitesMask != null) { if (sitesMask.size() != 0) { valueIndex.mask = true; Mask.setSelected(true); LayerPanel.add(Mask); } else { Sites.setSelected(true); } } else { Sites.setSelected(true); } bGroup = new ButtonGroup(); bGroup.add(Sites); if (sitesMask != null) if (sitesMask.size() != 0) bGroup.add(Mask); JLabel alphaLabel = new JLabel("Alpha"); LayerPanel.add(alphaLabel); alpha = new JComboBox<>( new Integer[] {0, 15, 25, 50, 60, 70, 75, 100, 156, 206, 212, 224, 231, 248, 252, 255}); alpha.setSelectedIndex(11); alpha.addActionListener(this); LayerPanel.add(alpha); layerVisible.setSelected(true); layerVisible.addActionListener(map); LayerPanel.add(layerVisible); delete = new JButton("Delete"); delete.addActionListener(this); LayerPanel.add(delete); return LayerPanel; }
protected void initListeners() { cancelButton.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) { setCancelExit(true); setVisible(false); } }); okButton.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) { setCancelExit(false); setVisible(false); } }); newRadioButton.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) { setBrowsePanelVisable(); } }); fromRadioButton.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) { setBrowsePanelVisable(); } }); browseButton.addActionListener( new ActionListener() { public void actionPerformed(final ActionEvent e) { selectFile(); } }); nameTextField.addCaretListener( new CaretListener() { public void caretUpdate(final CaretEvent e) { updateState(); } }); }
public LibTypePanel() { super(new FlowLayout()); JLabel label = new JLabel("Add as a module or project level library?"); add(label); moduleRadio = new JRadioButton("Module"); JRadioButton projectRadio = new JRadioButton("Project"); ButtonGroup bg = new ButtonGroup(); bg.add(moduleRadio); bg.add(projectRadio); moduleRadio.setSelected(true); add(moduleRadio); add(projectRadio); projectRadio.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { if (!hasProjectLibWarningBeenShown) { hasProjectLibWarningBeenShown = true; Messages.showInfoMessage( LibTypePanel.this, "When adding at the project level, the library defaults as inactive for all modules. You must manually go to Settings->Modules->Libraries afterwards to activate.", "Jar Juggler"); } } }); }
/* * Information of the Server */ private static void ServerPanel() { serverpanel.setLayout(null); serverpanel.setBounds(400, 350, 240, 280); serverpanel.setBorder(BorderFactory.createTitledBorder("Server")); // serverpanel.setBackground(Color.WHITE);' JLabel serverLabel = new JLabel("Client: "); clientstatus = new JLabel(ClientStatus); serverLabel.setBounds(10, 20, 40, 20); clientstatus.setBounds(50, 20, 60, 20); serverpanel.add(serverLabel); serverpanel.add(clientstatus); contentPane.add(serverpanel); // Heartbeat Button!! enableHeartbeat = new JRadioButton(); JLabel Heartbeat = new JLabel("Heartbeat"); Heartbeat.setBounds(30, 45, 70, 30); enableHeartbeat.setBounds(10, 45, 20, 30); enableHeartbeat.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { JRadioButton radioButton = (JRadioButton) e.getSource(); server.enableHeartbeat = radioButton.isSelected(); System.out.println( "Server heartbeat has been toggled to" + ((radioButton.isSelected()) ? " On" : " Off")); } }); serverpanel.add(Heartbeat); serverpanel.add(enableHeartbeat); }
public GrChangeSignatureDialog(@NotNull Project project, GrMethod method) { super(project, true); myMethod = method; setTitle(ChangeSignatureHandler.REFACTORING_NAME); init(); updateSignature(); ActionListener listener = new ActionListener() { public void actionPerformed(ActionEvent e) { updateSignature(); } }; myPublicRadioButton.addActionListener(listener); myPrivateRadioButton.addActionListener(listener); myProtectedRadioButton.addActionListener(listener); }
/** * Create the physical control. * * @param bEditableControl Is this control editable? * @return The new control. */ public Component setupControl(boolean bEditableControl) { String strDesc = ((SRadioButton) this.getScreenField()).getButtonDesc(); JRadioButton control = null; String m_strImageButton = ((SRadioButton) this.getScreenField()).getImageButtonName(); if (m_strImageButton == null) control = new JRadioButton(strDesc); // Physical control else if ((strDesc == null) || (strDesc.length() == 0)) control = new JRadioButton( this.loadImageIcon( m_strImageButton, null)); // Get this image, then redisplay me when you're done else control = new JRadioButton( strDesc, this.loadImageIcon( m_strImageButton, null)); // Get this image, then redisplay me when you're done control.setOpaque(false); control.setHorizontalTextPosition(JToggleButton.LEFT); control.setIconTextGap( org.jbundle.base.screen.control.javafx.util.ScreenInfo.EXTRA_COL_SPACING); if (bEditableControl) { control.addFocusListener(this); control.addActionListener(this); } return control; }
// Boolean[] voidList contain pages need to be voided. Boolean[] selectList contain pages need // to be selected for sequence purpose public SwingViewSimpleBuilder( SwingSimpleController c, ButtonGroup statusButtonGroup, JLabel seqText, JButton submitButton, Boolean[][] statusArray) { super(c); swingControl = c; this.statusButtonGroup = statusButtonGroup; this.statusArray = statusArray; this.submitButton = submitButton; Enumeration buttons = statusButtonGroup.getElements(); this.voidButton = (JRadioButton) buttons.nextElement(); this.skipButton = (JRadioButton) buttons.nextElement(); this.selectButton = (JRadioButton) buttons.nextElement(); this.seqText = seqText; Icon ic = new ImageIcon("heart.gif"); this.seqText.setIcon(ic); // voidButton.setEnabled(false); voidButton.addActionListener( new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { voidButtonActionPerformed(evt); } }); // seqText = new JLabel(); seqText.setText("----"); // selectButton = new JRadioButton(); selectButton.addActionListener( new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { selectButtonActionPerformed(evt); } }); skipButton.addActionListener( new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { skipButtonActionPerformed(evt); } }); }
private void buildInner() { JPanel panel = new JPanel(); panel.setLayout(new GridLayout(3, 1)); // build the panel content // top line label and text field JLabel inputLabel = new JLabel("Enter values in kilometers"); _input = new JTextField(6); _input.addKeyListener(new InputKey()); JPanel line1 = new JPanel(); line1.add(inputLabel); line1.add(_input); // line 2 stuff here _units = new JLabel("miles"); _output = new JLabel(" "); JPanel line2 = new JPanel(); line2.add(_units); line2.add(_output); // line 3 the buttons JPanel line3 = new JPanel(); ActionListener buttonListener = new ButtonSelected(); JRadioButton miles = new JRadioButton("miles", true); miles.addActionListener(buttonListener); _currentUnits = "miles"; JRadioButton feet = new JRadioButton("feet"); feet.addActionListener(buttonListener); JRadioButton inches = new JRadioButton("inches"); inches.addActionListener(buttonListener); ButtonGroup group = new ButtonGroup(); group.add(miles); group.add(feet); group.add(inches); line3.add(miles); line3.add(feet); line3.add(inches); panel.add(line1); panel.add(line2); panel.add(line3); add(panel); }
/** * Inicializa el radioButton 'Name' * * @return jRadioButton */ public JRadioButton getNameRadioButton() { if (nameRadioButton == null) { nameRadioButton = new JRadioButton(); nameRadioButton.setText(PluginServices.getText(this, "por_nombre")); nameRadioButton.addActionListener(this); } return nameRadioButton; }
private JRadioButton getRegionButton( JRadioButton button, int x, int y, int w, int h, String tip) { button.setBounds(new Rectangle(x, y, w, h)); button.setBorder(BorderFactory.createLoweredBevelBorder()); button.setToolTipText(Messages.getString(tip)); button.addActionListener(alRegion); regionButtons.add(button); return button; }