private JComponent createReplaceAllPanel() { JPanel panel = new JPanel(new FlowLayout()); String text = UIUtil.replaceMnemonicAmpersand(RefactoringBundle.message("replace.all.occurences", myOccurrencesCount)); myReplaceAllCheckBox = new JCheckBox(text); panel.add(myReplaceAllCheckBox); return panel; }
JPanel panel = new JPanel(); panel.add(new JLabel("Global"), new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); panel.add(isGlobalCheckBox = new JCheckBox(), new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); contentPanel.add(panel,new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); JPanel spacer = new JPanel(); spacer.setPreferredSize(new Dimension()); contentPanel.add(spacer, new GridBagConstraints(6, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
private void initializeComponents () { JPanel contentPanel = getContentPanel(); additiveCheckbox = new JCheckBox(); contentPanel.add(additiveCheckbox, new GridBagConstraints(1, 1, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0)); attachedCheckBox = new JCheckBox(); contentPanel.add(attachedCheckBox, new GridBagConstraints(1, 2, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0)); continuousCheckbox = new JCheckBox(); contentPanel.add(continuousCheckbox, new GridBagConstraints(1, 3, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0)); alignedCheckbox = new JCheckBox(); contentPanel.add(alignedCheckbox, new GridBagConstraints(1, 4, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0)); behindCheckbox = new JCheckBox(); contentPanel.add(behindCheckbox, new GridBagConstraints(1, 5, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0)); premultipliedAlphaCheckbox = new JCheckBox(); contentPanel.add(premultipliedAlphaCheckbox, new GridBagConstraints(1, 6, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0));
public SearchBar(RSyntaxTextArea textArea) { rTextArea = textArea; JLabel findLabel = new JLabel(NLS.str("search.find") + ":"); add(findLabel); add(searchField); add(prevButton); add(nextButton); markAllCB = new JCheckBox(NLS.str("search.mark_all")); markAllCB.addActionListener(new ForwardListener()); add(markAllCB); regexCB = new JCheckBox(NLS.str("search.regex")); regexCB.addActionListener(new ForwardListener()); add(regexCB); matchCaseCB = new JCheckBox(NLS.str("search.match_case")); matchCaseCB.addActionListener(new ForwardListener()); add(matchCaseCB); wholeWordCB = new JCheckBox(NLS.str("search.whole_word")); wholeWordCB.addActionListener(new ForwardListener()); add(wholeWordCB);
public ReportFinishedDialog(BenchmarkAggregatorFrame parentFrame, File reportFile) { super(parentFrame, "Report generation finished"); this.parentFrame = parentFrame; this.reportFile = reportFile; addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { refresh(); } }); JPanel mainPanel = new JPanel(new BorderLayout(0, 10)); exitCheckBox = new JCheckBox("Exit application", exitApplicationWhenReportFinished); mainPanel.add(exitCheckBox, BorderLayout.NORTH); mainPanel.add(createButtonPanel(), BorderLayout.CENTER); mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); getContentPane().add(mainPanel); }
JPanel panel = new JPanel(new GridBagLayout()); EditorPanel.addContent(panel, i, 0, new JLabel("Shape"), false, GridBagConstraints.WEST, GridBagConstraints.NONE, 0,0); EditorPanel.addContent(panel, i++,1, shapeCombo = new JComboBox(new DefaultComboBoxModel(spawnShapes)), false, GridBagConstraints.WEST, GridBagConstraints.NONE, 1,0); EditorPanel.addContent(panel, i, 0, edgesLabel = new JLabel("Edges"), false, GridBagConstraints.WEST, GridBagConstraints.NONE, 0,0); EditorPanel.addContent(panel, i++, 1, edgesCheckbox = new JCheckBox(), false, GridBagConstraints.WEST, GridBagConstraints.NONE, 0,0); EditorPanel.addContent(panel, i, 0, sideLabel = new JLabel("Side"), false, GridBagConstraints.WEST, GridBagConstraints.NONE, 0,0); EditorPanel.addContent(panel, i++, 1, sideCombo = new JComboBox(new DefaultComboBoxModel(SpawnSide.values())), false, GridBagConstraints.WEST, GridBagConstraints.NONE, 1, 0); edgesCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
import java.awt.*; import javax.swing.*; class DisableMe { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { JPanel gui = new JPanel(new GridLayout(1,0)); for (int ii=1; ii<7; ii++) { JCheckBox cb = new JCheckBox(""+ii, ii%3==0); cb.setEnabled(ii%2==0); gui.add(cb); } JOptionPane.showMessageDialog(null, gui); } }); } }
PROGRESS_BAR.setMaximum( 100 ); OUTPUT_LABEL = new JLabel( "Processing" ); testFrame.getContentPane().add( PROGRESS_BAR, BorderLayout.CENTER ); testFrame.getContentPane().add( OUTPUT_LABEL, BorderLayout.SOUTH ); testFrame.getContentPane().add( new JCheckBox( "Click me to proof UI is responsive" ), BorderLayout.NORTH ); frame.setVisible( true );
public FileTreeNode(File file, FileTreeNode parent) { super(file); this.setParent(parent); this.file = file; boolean isLeaf = file.isFile(); if(isLeaf) { check = new JCheckBox(this.toString(),isLeaf); check.setOpaque(true); check.setBackground(Color.WHITE); } else label = new JLabel(this.toString()); this.setAllowsChildren(!isLeaf); }
final Image image = ImageIO.read(new URL("http://sstatic.net/so/img/logo.png")); final JFrame frame = new JFrame(); frame.add(new ImagePanel(image)); frame.setSize(800, 600); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); this.image = image; this.tile = false; final JCheckBox checkBox = new JCheckBox(); checkBox.setAction(new AbstractAction("Tile") { public void actionPerformed(ActionEvent e) { add(checkBox, BorderLayout.SOUTH); };
private SettingsGroup makeDecompilationGroup() { JCheckBox fallback = new JCheckBox(); fallback.setSelected(settings.isFallbackMode()); fallback.addItemListener(e -> { JCheckBox showInconsistentCode = new JCheckBox(); showInconsistentCode.setSelected(settings.isShowInconsistentCode()); showInconsistentCode.addItemListener(e -> { JCheckBox resourceDecode = new JCheckBox(); resourceDecode.setSelected(settings.isSkipResources()); resourceDecode.addItemListener(e -> { JCheckBox autoStartJobs = new JCheckBox(); autoStartJobs.setSelected(settings.isAutoStartJobs()); autoStartJobs.addItemListener(e -> settings.setAutoStartJobs(e.getStateChange() == ItemEvent.SELECTED)); JCheckBox escapeUnicode = new JCheckBox(); escapeUnicode.setSelected(settings.escapeUnicode()); escapeUnicode.addItemListener(e -> { JCheckBox replaceConsts = new JCheckBox(); replaceConsts.setSelected(settings.isReplaceConsts()); replaceConsts.addItemListener(e -> { JCheckBox useImports = new JCheckBox(); useImports.setSelected(settings.isUseImports()); useImports.addItemListener(e -> {
JPanel panel = new JPanel(); panel.add(new JLabel("Global"), new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); panel.add(isGlobalCheckBox = new JCheckBox(), new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); contentPanel.add(panel,new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); JPanel spacer = new JPanel(); spacer.setPreferredSize(new Dimension()); contentPanel.add(spacer, new GridBagConstraints(6, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE,
@Nullable @Override public JComponent createComponent() { FormBuilder builder = FormBuilder.createFormBuilder(); myCbUseRecursiveReferenceSearch = new JCheckBox("Use recursive reference search"); builder.addComponent(myCbUseRecursiveReferenceSearch); JPanel result = new JPanel(new BorderLayout()); result.add(builder.getPanel(), BorderLayout.NORTH); if (myIsDialog) { result.setPreferredSize(new Dimension(300, -1)); } return result; }
private void initializeComponents () { JPanel contentPanel = getContentPanel(); additiveCheckbox = new JCheckBox(); contentPanel.add(additiveCheckbox, new GridBagConstraints(1, 1, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0)); attachedCheckBox = new JCheckBox(); contentPanel.add(attachedCheckBox, new GridBagConstraints(1, 2, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0)); continuousCheckbox = new JCheckBox(); contentPanel.add(continuousCheckbox, new GridBagConstraints(1, 3, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0)); alignedCheckbox = new JCheckBox(); contentPanel.add(alignedCheckbox, new GridBagConstraints(1, 4, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0)); behindCheckbox = new JCheckBox(); contentPanel.add(behindCheckbox, new GridBagConstraints(1, 5, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0)); premultipliedAlphaCheckbox = new JCheckBox(); contentPanel.add(premultipliedAlphaCheckbox, new GridBagConstraints(1, 6, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0));
JLabel label = new JLabel("Find What:"); textField = new JTextField(); findButton = new JButton("Find"); findButton.addActionListener(new FindButton()); mcase = new JCheckBox("Match Case"); regex = new JCheckBox("Regex"); wholew = new JCheckBox("Whole Words"); classname = new JCheckBox("Classnames");
JPanel panel = new JPanel(new GridBagLayout()); EditorPanel.addContent(panel, i, 0, new JLabel("Shape"), false, GridBagConstraints.WEST, GridBagConstraints.NONE, 0,0); EditorPanel.addContent(panel, i++,1, shapeCombo = new JComboBox(new DefaultComboBoxModel(spawnShapes)), false, GridBagConstraints.WEST, GridBagConstraints.NONE, 1,0); EditorPanel.addContent(panel, i, 0, edgesLabel = new JLabel("Edges"), false, GridBagConstraints.WEST, GridBagConstraints.NONE, 0,0); EditorPanel.addContent(panel, i++, 1, edgesCheckbox = new JCheckBox(), false, GridBagConstraints.WEST, GridBagConstraints.NONE, 0,0); EditorPanel.addContent(panel, i, 0, sideLabel = new JLabel("Side"), false, GridBagConstraints.WEST, GridBagConstraints.NONE, 0,0); EditorPanel.addContent(panel, i++, 1, sideCombo = new JComboBox(new DefaultComboBoxModel(SpawnSide.values())), false, GridBagConstraints.WEST, GridBagConstraints.NONE, 1, 0); edgesCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
/** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL */ private void $$$setupUI$$$() { mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout(0, 0)); excludedMethodForm = new ExcludedMethodForm(); mainPanel.add(excludedMethodForm.$$$getRootComponent$$$(), BorderLayout.CENTER); saveReturnValueCheckBox = new JCheckBox(); saveReturnValueCheckBox.setText("Save return value"); mainPanel.add(saveReturnValueCheckBox, BorderLayout.SOUTH); }
import javax.swing.*; import java.awt.event.*; public class Example extends JFrame{ public JCheckBox one; public Example() { one = new JCheckBox("CT scan performed"); one.addItemListener(new CheckBoxListener()); setSize(300,300); getContentPane().add(one); setVisible(true); } private class CheckBoxListener implements ItemListener{ public void itemStateChanged(ItemEvent e) { if(e.getSource()==one){ if(one.isSelected()) { System.out.println("one has been selected"); } else {System.out.println("nothing");} } } } public static void main(String[] args) { new Example(); } }