List of usage examples for javax.swing JCheckBox JCheckBox
public JCheckBox(Action a)
From source file:ProgressBarTest.java
public ProgressBarFrame() { setTitle("ProgressBarTest"); setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); // this text area holds the activity output textArea = new JTextArea(); // set up panel with button and progress bar final int MAX = 1000; JPanel panel = new JPanel(); startButton = new JButton("Start"); progressBar = new JProgressBar(0, MAX); progressBar.setStringPainted(true);/*from w w w . j a va 2 s . c o m*/ panel.add(startButton); panel.add(progressBar); checkBox = new JCheckBox("indeterminate"); checkBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { progressBar.setIndeterminate(checkBox.isSelected()); progressBar.setStringPainted(!progressBar.isIndeterminate()); } }); panel.add(checkBox); add(new JScrollPane(textArea), BorderLayout.CENTER); add(panel, BorderLayout.SOUTH); // set up the button action startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { startButton.setEnabled(false); activity = new SimulatedActivity(MAX); activity.execute(); } }); }
From source file:SourceInDemo.java
public SourceInDemo() { super("Source In"); add(new ImageViewer(), BorderLayout.CENTER); JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEADING)); panel.add(shadow = new JCheckBox("Drop Shadow")); shadow.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent changeEvent) { repaint();/*from www . java 2 s. co m*/ } }); add(panel, BorderLayout.SOUTH); setSize(350, 250); setLocationRelativeTo(null); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
From source file:CheckBoxTest.java
public CheckBoxFrame() { setTitle("CheckBoxTest"); setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); // add the sample text label label = new JLabel("The quick brown fox jumps over the lazy dog."); label.setFont(new Font("Serif", Font.PLAIN, FONTSIZE)); add(label, BorderLayout.CENTER); // this listener sets the font attribute of // the label to the check box state ActionListener listener = new ActionListener() { public void actionPerformed(ActionEvent event) { int mode = 0; if (bold.isSelected()) mode += Font.BOLD; if (italic.isSelected()) mode += Font.ITALIC; label.setFont(new Font("Serif", mode, FONTSIZE)); }/*from w ww . j a va 2s .com*/ }; // add the check boxes JPanel buttonPanel = new JPanel(); bold = new JCheckBox("Bold"); bold.addActionListener(listener); buttonPanel.add(bold); italic = new JCheckBox("Italic"); italic.addActionListener(listener); buttonPanel.add(italic); add(buttonPanel, BorderLayout.SOUTH); }
From source file:GridBagLayoutTest.java
public FontFrame() { setTitle("GridBagLayoutTest"); setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT); GridBagLayout layout = new GridBagLayout(); setLayout(layout);//from ww w.j ava 2 s . c o m ActionListener listener = new FontAction(); // construct components JLabel faceLabel = new JLabel("Face: "); face = new JComboBox(new String[] { "Serif", "SansSerif", "Monospaced", "Dialog", "DialogInput" }); face.addActionListener(listener); JLabel sizeLabel = new JLabel("Size: "); size = new JComboBox(new String[] { "8", "10", "12", "15", "18", "24", "36", "48" }); size.addActionListener(listener); bold = new JCheckBox("Bold"); bold.addActionListener(listener); italic = new JCheckBox("Italic"); italic.addActionListener(listener); sample = new JTextArea(); sample.setText("The quick brown fox jumps over the lazy dog"); sample.setEditable(false); sample.setLineWrap(true); sample.setBorder(BorderFactory.createEtchedBorder()); // add components to grid, using GBC convenience class add(faceLabel, new GBC(0, 0).setAnchor(GBC.EAST)); add(face, new GBC(1, 0).setFill(GBC.HORIZONTAL).setWeight(100, 0).setInsets(1)); add(sizeLabel, new GBC(0, 1).setAnchor(GBC.EAST)); add(size, new GBC(1, 1).setFill(GBC.HORIZONTAL).setWeight(100, 0).setInsets(1)); add(bold, new GBC(0, 2, 2, 1).setAnchor(GBC.CENTER).setWeight(100, 100)); add(italic, new GBC(0, 3, 2, 1).setAnchor(GBC.CENTER).setWeight(100, 100)); add(sample, new GBC(2, 0, 1, 4).setFill(GBC.BOTH).setWeight(100, 100)); }
From source file:misc.FocusTraversalDemo.java
public FocusTraversalDemo() { super(new BorderLayout()); JTextField tf1 = new JTextField("Field 1"); JTextField tf2 = new JTextField("A Bigger Field 2"); JTextField tf3 = new JTextField("Field 3"); JTextField tf4 = new JTextField("A Bigger Field 4"); JTextField tf5 = new JTextField("Field 5"); JTextField tf6 = new JTextField("A Bigger Field 6"); JTable table = new JTable(4, 3); togglePolicy = new JCheckBox("Custom FocusTraversalPolicy"); togglePolicy.setActionCommand("toggle"); togglePolicy.addActionListener(this); togglePolicy.setFocusable(false); //Remove it from the focus cycle. //Note that HTML is allowed and will break this run of text //across two lines. label = new JLabel( "<html>Use Tab (or Shift-Tab) to navigate from component to component.<p>Control-Tab (or Control-Shift-Tab) allows you to break out of the JTable.</html>"); JPanel leftTextPanel = new JPanel(new GridLayout(3, 2)); leftTextPanel.add(tf1, BorderLayout.PAGE_START); leftTextPanel.add(tf3, BorderLayout.CENTER); leftTextPanel.add(tf5, BorderLayout.PAGE_END); leftTextPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 5)); JPanel rightTextPanel = new JPanel(new GridLayout(3, 2)); rightTextPanel.add(tf2, BorderLayout.PAGE_START); rightTextPanel.add(tf4, BorderLayout.CENTER); rightTextPanel.add(tf6, BorderLayout.PAGE_END); rightTextPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 5)); JPanel tablePanel = new JPanel(new GridLayout(0, 1)); tablePanel.add(table, BorderLayout.CENTER); tablePanel.setBorder(BorderFactory.createEtchedBorder()); JPanel bottomPanel = new JPanel(new GridLayout(2, 1)); bottomPanel.add(togglePolicy, BorderLayout.PAGE_START); bottomPanel.add(label, BorderLayout.PAGE_END); add(leftTextPanel, BorderLayout.LINE_START); add(rightTextPanel, BorderLayout.CENTER); add(tablePanel, BorderLayout.LINE_END); add(bottomPanel, BorderLayout.PAGE_END); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); Vector<Component> order = new Vector<Component>(7); order.add(tf1);/* w w w . j a v a2s . c o m*/ order.add(tf2); order.add(tf3); order.add(tf4); order.add(tf5); order.add(tf6); order.add(table); newPolicy = new MyOwnFocusTraversalPolicy(order); }
From source file:EditorPaneExample19.java
public EditorPaneExample19() { super("JEditorPane Example 19"); pane = new JEditorPane(); pane.setEditable(true); // Editable getContentPane().add(new JScrollPane(pane), "Center"); // Add a menu bar menuBar = new JMenuBar(); setJMenuBar(menuBar);// www.j a v a 2s .com // Populate it createMenuBar(); // Build the panel of controls JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.gridwidth = 1; c.gridheight = 1; c.anchor = GridBagConstraints.EAST; c.fill = GridBagConstraints.NONE; c.weightx = 0.0; c.weighty = 0.0; JLabel urlLabel = new JLabel("URL: ", JLabel.RIGHT); panel.add(urlLabel, c); JLabel loadingLabel = new JLabel("State: ", JLabel.RIGHT); c.gridy = 1; panel.add(loadingLabel, c); JLabel typeLabel = new JLabel("Type: ", JLabel.RIGHT); c.gridy = 2; panel.add(typeLabel, c); c.gridy = 3; panel.add(new JLabel(LOAD_TIME), c); c.gridy = 4; c.gridwidth = 2; c.weightx = 1.0; c.anchor = GridBagConstraints.WEST; onlineLoad = new JCheckBox("Online Load"); panel.add(onlineLoad, c); onlineLoad.setSelected(true); onlineLoad.setForeground(typeLabel.getForeground()); c.gridy = 5; c.gridwidth = 2; c.weightx = 1.0; c.anchor = GridBagConstraints.WEST; editableBox = new JCheckBox("Editable JEditorPane"); panel.add(editableBox, c); editableBox.setSelected(true); editableBox.setForeground(typeLabel.getForeground()); c.gridy = 6; c.weightx = 0.0; JButton saveButton = new JButton("Save"); panel.add(saveButton, c); saveButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { EditorKit kit = pane.getEditorKit(); try { if (kit instanceof RTFEditorKit) { kit.write(System.out, pane.getDocument(), 0, pane.getDocument().getLength()); System.out.flush(); } else { if (writer == null) { writer = new OutputStreamWriter(System.out); pane.write(writer); writer.flush(); } kit.write(writer, pane.getDocument(), 0, pane.getDocument().getLength()); writer.flush(); } } catch (Exception e) { System.out.println("Write failed"); } } }); c.gridx = 1; c.gridy = 0; c.weightx = 1.0; c.anchor = GridBagConstraints.EAST; c.fill = GridBagConstraints.HORIZONTAL; urlCombo = new JComboBox(); panel.add(urlCombo, c); urlCombo.setEditable(true); loadingState = new JLabel(spaces, JLabel.LEFT); loadingState.setForeground(Color.black); c.gridy = 1; panel.add(loadingState, c); loadedType = new JLabel(spaces, JLabel.LEFT); loadedType.setForeground(Color.black); c.gridy = 2; panel.add(loadedType, c); timeLabel = new JLabel(""); c.gridy = 3; panel.add(timeLabel, c); getContentPane().add(panel, "South"); // Register a custom EditorKit for HTML ClassLoader loader = getClass().getClassLoader(); if (loader != null) { // Java 2 JEditorPane.registerEditorKitForContentType("text/html", "AdvancedSwing.Chapter4.EnhancedHTMLEditorKit", loader); } else { // JDK 1.1 JEditorPane.registerEditorKitForContentType("text/html", "AdvancedSwing.Chapter4.EnhancedHTMLEditorKit"); } // Allocate the empty tree model DefaultMutableTreeNode emptyRootNode = new DefaultMutableTreeNode("Empty"); emptyModel = new DefaultTreeModel(emptyRootNode); // Create and place the heading tree tree = new JTree(emptyModel); tree.setPreferredSize(new Dimension(200, 200)); getContentPane().add(new JScrollPane(tree), "East"); // Change page based on combo selection urlCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (populatingCombo == true) { return; } Object selection = urlCombo.getSelectedItem(); loadNewPage(selection); } }); // Change editability based on the checkbox editableBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { pane.setEditable(editableBox.isSelected()); pane.revalidate(); pane.repaint(); } }); // Listen for page load to complete pane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("page")) { loadComplete(); displayLoadTime(); populateCombo(findLinks(pane.getDocument(), null)); TreeNode node = buildHeadingTree(pane.getDocument()); tree.setModel(new DefaultTreeModel(node)); createMenuBar(); enableMenuBar(true); getRootPane().revalidate(); enableInput(); loadingPage = false; } } }); // Listener for tree selection tree.addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent evt) { TreePath path = evt.getNewLeadSelectionPath(); if (path != null) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent(); Object userObject = node.getUserObject(); if (userObject instanceof Heading) { Heading heading = (Heading) userObject; try { Rectangle textRect = pane.modelToView(heading.getOffset()); textRect.y += 3 * textRect.height; pane.scrollRectToVisible(textRect); } catch (BadLocationException e) { } } } } }); // Listener for hypertext events pane.addHyperlinkListener(new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent evt) { // Ignore hyperlink events if the frame is busy if (loadingPage == true) { return; } if (evt.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { JEditorPane sp = (JEditorPane) evt.getSource(); if (evt instanceof HTMLFrameHyperlinkEvent) { HTMLDocument doc = (HTMLDocument) sp.getDocument(); doc.processHTMLFrameHyperlinkEvent((HTMLFrameHyperlinkEvent) evt); } else { loadNewPage(evt.getURL()); } } else if (evt.getEventType() == HyperlinkEvent.EventType.ENTERED) { pane.setCursor(handCursor); } else if (evt.getEventType() == HyperlinkEvent.EventType.EXITED) { pane.setCursor(defaultCursor); } } }); }
From source file:EditorPaneExample9.java
public EditorPaneExample9() { super("JEditorPane Example 9"); pane = new JEditorPane(); pane.setEditable(false); // Read-only getContentPane().add(new JScrollPane(pane), "Center"); // Build the panel of controls JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.gridwidth = 1;/* w w w .j a v a 2 s .c o m*/ c.gridheight = 1; c.anchor = GridBagConstraints.EAST; c.fill = GridBagConstraints.NONE; c.weightx = 0.0; c.weighty = 0.0; JLabel urlLabel = new JLabel("URL: ", JLabel.RIGHT); panel.add(urlLabel, c); JLabel loadingLabel = new JLabel("State: ", JLabel.RIGHT); c.gridy = 1; panel.add(loadingLabel, c); JLabel typeLabel = new JLabel("Type: ", JLabel.RIGHT); c.gridy = 2; panel.add(typeLabel, c); c.gridy = 3; panel.add(new JLabel(LOAD_TIME), c); c.gridy = 4; c.gridwidth = 2; c.weightx = 1.0; c.anchor = GridBagConstraints.WEST; onlineLoad = new JCheckBox("Online Load"); panel.add(onlineLoad, c); onlineLoad.setSelected(true); onlineLoad.setForeground(typeLabel.getForeground()); c.gridx = 1; c.gridy = 0; c.anchor = GridBagConstraints.EAST; c.fill = GridBagConstraints.HORIZONTAL; textField = new JTextField(32); panel.add(textField, c); loadingState = new JLabel(spaces, JLabel.LEFT); loadingState.setForeground(Color.black); c.gridy = 1; panel.add(loadingState, c); loadedType = new JLabel(spaces, JLabel.LEFT); loadedType.setForeground(Color.black); c.gridy = 2; panel.add(loadedType, c); timeLabel = new JLabel(""); c.gridy = 3; panel.add(timeLabel, c); getContentPane().add(panel, "South"); // Change page based on text field textField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String url = textField.getText(); try { // Check if the new page and the old // page are the same. URL newURL = new URL(url); URL loadedURL = pane.getPage(); if (loadedURL != null && loadedURL.sameFile(newURL)) { return; } // Try to display the page textField.setEnabled(false); // Disable input textField.paintImmediately(0, 0, textField.getSize().width, textField.getSize().height); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); // Busy cursor loadingState.setText("Loading..."); loadingState.paintImmediately(0, 0, loadingState.getSize().width, loadingState.getSize().height); loadedType.setText(""); loadedType.paintImmediately(0, 0, loadedType.getSize().width, loadedType.getSize().height); timeLabel.setText(""); timeLabel.paintImmediately(0, 0, timeLabel.getSize().width, timeLabel.getSize().height); startTime = System.currentTimeMillis(); // Choose the loading method if (onlineLoad.isSelected()) { // Usual load via setPage pane.setPage(url); loadedType.setText(pane.getContentType()); } else { pane.setContentType("text/html"); loadedType.setText(pane.getContentType()); if (loader == null) { loader = new HTMLDocumentLoader(); } HTMLDocument doc = loader.loadDocument(new URL(url)); loadComplete(); pane.setDocument(doc); displayLoadTime(); } } catch (Exception e) { System.out.println(e); JOptionPane.showMessageDialog(pane, new String[] { "Unable to open file", url }, "File Open Error", JOptionPane.ERROR_MESSAGE); loadingState.setText("Failed"); textField.setEnabled(true); setCursor(Cursor.getDefaultCursor()); } } }); // Listen for page load to complete pane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("page")) { loadComplete(); displayLoadTime(); } } }); }
From source file:com.floreantpos.config.ui.AddPrinterGroupDialog.java
private void init() { JPanel contentPane = (JPanel) getContentPane(); contentPane.setLayout(new MigLayout("", "[][grow]", "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ add(new JLabel(Messages.getString("AddPrinterGroupDialog.4"))); //$NON-NLS-1$ add(tfName, "grow, wrap"); //$NON-NLS-1$ chkDefault = new JCheckBox(Messages.getString("AddPrinterGroupDialog.1")); //$NON-NLS-1$ add(new JLabel(), "grow"); //$NON-NLS-1$ add(chkDefault, "wrap"); //$NON-NLS-1$ PosPrinters printersKitchen = PosPrinters.load(); printers = printersKitchen.getKitchenPrinters(); printerList = new CheckBoxList(new Vector<Printer>(printers)); JPanel listPanel = new JPanel(new BorderLayout()); listPanel.setBorder(new TitledBorder(Messages.getString("AddPrinterGroupDialog.6"))); //$NON-NLS-1$ listPanel.add(new JScrollPane(printerList)); add(listPanel, "newline, span 2, grow"); //$NON-NLS-1$ JPanel panel = new JPanel(); contentPane.add(panel, "cell 0 4 3 1,grow"); //$NON-NLS-1$ JButton btnOk = new JButton(Messages.getString("AddPrinterGroupDialog.9")); //$NON-NLS-1$ btnOk.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (StringUtils.isEmpty(tfName.getText())) { POSMessageDialog.showError(Application.getPosWindow(), Messages.getString("AddPrinterGroupDialog.10")); //$NON-NLS-1$ return; }//from w w w .ja va 2 s.c o m List checkedValues = printerList.getCheckedValues(); if (checkedValues == null || checkedValues.size() == 0) { POSMessageDialog.showError(Application.getPosWindow(), Messages.getString("AddPrinterGroupDialog.11")); //$NON-NLS-1$ return; } setCanceled(false); dispose(); } }); panel.add(btnOk); JButton btnCancel = new JButton(Messages.getString("AddPrinterGroupDialog.12")); //$NON-NLS-1$ btnCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setCanceled(true); dispose(); } }); panel.add(btnCancel); }
From source file:BoxLayoutTest.java
public JCheckBox addCheckBox(JPanel p, String name) { JCheckBox checkBox = new JCheckBox(name); checkBox.addActionListener(this); p.add(checkBox);//w w w .ja v a 2 s .co m return checkBox; }
From source file:br.usp.poli.lta.cereda.wsn2spa.Editor.java
public Editor() { super("WSN2SPA"); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setResizable(false);// w w w . j a v a 2 s.c o m setLayout(new MigLayout()); txtDotOutput = new JTextField(15); txtYamlOutput = new JTextField(15); txtFile = new JTextField(10); txtFile.setEditable(false); checkDFAConvert = new JCheckBox("Convert submachines to DFA's"); checkMinimize = new JCheckBox("Apply state minimization"); checkMinimize.setEnabled(false); btnOpen = new JButton( new ImageIcon(getClass().getResource("/br/usp/poli/lta/cereda/wsn2spa/images/open.png"))); btnRun = new JButton("Convert WSN to SPA", new ImageIcon(getClass().getResource("/br/usp/poli/lta/cereda/wsn2spa/images/play.png"))); chooser = new JFileChooser(); chooser.setMultiSelectionEnabled(false); FileNameExtensionFilter filter = new FileNameExtensionFilter("Text files", "txt", "text"); chooser.setFileFilter(filter); btnOpen.addActionListener((ActionEvent ae) -> { int value = chooser.showOpenDialog(Editor.this); if (value == JFileChooser.APPROVE_OPTION) { file = chooser.getSelectedFile(); txtFile.setText(file.getName()); } }); checkDFAConvert.addChangeListener((ChangeEvent ce) -> { checkMinimize.setEnabled(checkDFAConvert.isSelected()); if (!checkDFAConvert.isSelected()) { checkMinimize.setSelected(false); } }); btnRun.addActionListener((ActionEvent ae) -> { boolean restore = checkMinimize.isEnabled(); state(false, txtDotOutput, txtYamlOutput, btnOpen, btnRun, checkDFAConvert, checkMinimize); try { if (!filled(txtDotOutput, txtYamlOutput, txtFile)) { throw new Exception( "The fields could not be empty. Make " + "sure to select the grammar file and provide " + "both DOT and YAML patterns in their respective " + "fields."); } if (!valid(txtDotOutput, txtYamlOutput)) { throw new Exception( "The DOT and YAML fields lack the " + "replacement pattern '%s' in order to generate " + "files corresponding to each submachine in the " + "automaton model. Make sure to include the " + "pattern."); } if (!file.exists()) { throw new Exception("The provided grammar file '" + "' does" + " not exist. Make sure the location is correct and" + " try again."); } String text = FileUtils.readFileToString(file, "UTF-8").trim(); WirthLexer wl = new WirthLexer(text); Generator g = new Generator(wl); g.generateAutomaton(); Writer writer = new Writer(g.getTransitions()); Map<String, String> map = writer.generateYAMLMap(txtYamlOutput.getText().trim()); if (Utils.neither(checkDFAConvert, checkMinimize)) { br.usp.poli.lta.cereda.wirth2ape.dot.Dot dot = new br.usp.poli.lta.cereda.wirth2ape.dot.Dot( g.getTransitions()); dot.generate(txtDotOutput.getText().trim()); for (String key : map.keySet()) { FileUtils.write(new File(key), map.get(key), "UTF-8"); } } else { for (String key : map.keySet()) { Triple<Integer, Set<Integer>, List<SimpleTransition>> spec = Reader.read(map.get(key)); br.usp.poli.lta.cereda.nfa2dfa.dot.Dot dot = new br.usp.poli.lta.cereda.nfa2dfa.dot.Dot(); dot.append(Reader.getName(), "original", spec); Conversion c; if (checkDFAConvert.isSelected()) { c = new Conversion(spec.getThird(), spec.getFirst(), spec.getSecond()); spec = c.convert(); dot.append(Reader.getName().concat("'"), "converted", spec); } if (checkMinimize.isSelected()) { c = new Conversion(spec.getThird(), spec.getFirst(), spec.getSecond()); spec = c.minimize(); dot.append(Reader.getName().concat("''"), "minimized", spec); } Yaml yaml = new Yaml(); Spec result = Utils.toFormat(spec); result.setName(Reader.getName()); map.put(key, yaml.dump(result)); String dotname = String.format(txtDotOutput.getText().trim(), Reader.getName()); dot.dump(dotname); } for (String key : map.keySet()) { FileUtils.write(new File(key), map.get(key), "UTF-8"); } } showMessage("Success!", "The structured pushdown automaton " + "spec was successfully generated from the provided " + "grammar file."); } catch (Exception exception) { showException("An exception was thrown", exception); } state(true, txtDotOutput, txtYamlOutput, btnOpen, btnRun, checkDFAConvert, checkMinimize); checkMinimize.setEnabled(restore); }); add(new JLabel("Grammar file:")); add(txtFile); add(btnOpen, "growx, wrap"); add(new JLabel("DOT pattern:")); add(txtDotOutput, "growx, span 2, wrap"); add(new JLabel("YAML pattern:")); add(txtYamlOutput, "growx, span 2, wrap"); add(checkDFAConvert, "span 3, wrap"); add(checkMinimize, "span 3, wrap"); add(btnRun, "growx, span 3"); pack(); setLocationRelativeTo(null); }