List of usage examples for com.jgoodies.forms.layout CellConstraints xyw
public CellConstraints xyw(int col, int row, int colSpan)
Examples:
cc.xyw(1, 3, 7); cc.xyw(1, 3, 2);
From source file:br.com.ant.system.view.ColoniaFormigasView.java
License:Open Source License
private JPanel montarRightTopPainel() { FormLayout layout = new FormLayout("$lcgap, left:p, $lcgap, p:grow, $lcgap", "$lg, p,$lg, p,$lg, p,$lg, p,$lg, p"); CellConstraints cc = new CellConstraints(); JPanel rightTopPanel = new JPanel(layout); rightTopPanel.setBorder(BorderFactory.createTitledBorder("Opes:")); iteracoesLabel = new JLabel("Num. Iteracoes: "); iteracoesField = new NumberField(); iteracoesField.setText("5"); monothreadButton = new JRadioButton("MonoThread", true); multiThreadButton = new JRadioButton("MultiThread"); JPanel panelGroup = new JPanel(); ButtonGroup group = new ButtonGroup(); group.add(monothreadButton);// w ww. j av a2 s . c om group.add(multiThreadButton); panelGroup.add(monothreadButton); panelGroup.add(multiThreadButton); JPanel panelArquivo = new JPanel(new GridBagLayout()); panelArquivo.setBorder(BorderFactory.createTitledBorder("Arquivo de cidades")); GridBagConstraints gbc = new GridBagConstraints(); caminhoArquivoField = new JTextField(); caminhoArquivoField.setEnabled(false); caminhoArquivoField.setText("C:\\Users\\Sildu\\Desktop\\distancias.csv"); gbc.gridx = 0; gbc.gridy = 0; gbc.weighty = 1; gbc.weightx = 0.9; gbc.gridheight = GridBagConstraints.REMAINDER; gbc.gridwidth = GridBagConstraints.RELATIVE; gbc.fill = GridBagConstraints.BOTH; gbc.anchor = GridBagConstraints.LINE_START; panelArquivo.add(caminhoArquivoField, gbc); gbc.gridx = 1; gbc.gridy = 0; gbc.weighty = 1; gbc.weightx = 0.1; gbc.gridheight = GridBagConstraints.REMAINDER; gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.fill = GridBagConstraints.BOTH; gbc.anchor = GridBagConstraints.LINE_END; buscarArquivoButton = new JButton(new BuscarArquivoAction()); panelArquivo.add(buscarArquivoButton, gbc); executeButton = new JButton(new ExecutarAction()); rightTopPanel.add(panelGroup, cc.xyw(2, 2, 4)); rightTopPanel.add(iteracoesLabel, cc.xy(2, 4)); rightTopPanel.add(iteracoesField, cc.xy(4, 4)); rightTopPanel.add(panelArquivo, cc.xyw(2, 6, 4)); rightTopPanel.add(executeButton, cc.xyw(2, 10, 3)); return rightTopPanel; }
From source file:brainflow.app.toplevel.BrainFlow.java
private IImageSource specialHandling(IImageSource dataSource) { if (dataSource.getFileFormat().equals("Analyze7.5")) { JPanel panel = new JPanel(); JLabel messageLabel = new JLabel("Please select correct image orientation from menu: "); java.util.List<Anatomy3D> choices = Anatomy3D.getInstanceList(); JComboBox choiceBox = new JComboBox(choices.toArray()); //todo hackery alert Anatomy anatomy = dataSource.getImageInfo().getAnatomy(); choiceBox.setSelectedItem(anatomy); FormLayout layout = new FormLayout("4dlu, l:p, p:g, 4dlu", "6dlu, p, 10dlu, p, 6dlu"); CellConstraints cc = new CellConstraints(); panel.setLayout(layout);// ww w.j a v a 2 s. c om panel.add(messageLabel, cc.xyw(2, 2, 2)); panel.add(choiceBox, cc.xyw(2, 4, 2)); JOptionPane.showMessageDialog(brainFrame, panel, "Analyze 7.5 image format ...", JOptionPane.WARNING_MESSAGE); Anatomy selectedAnatomy = (Anatomy) choiceBox.getSelectedItem(); if (selectedAnatomy != anatomy) { //todo hackery alert dataSource.getImageInfo().setAnatomy((Anatomy3D) selectedAnatomy); dataSource.releaseData(); } } return dataSource; }
From source file:ca.phon.app.project.checkwizard.CheckWizardStep1.java
License:Open Source License
private void init() { setLayout(new BorderLayout()); header = new DialogHeader("Check Transcriptions", "Select sessions and operations to perform."); add(header, BorderLayout.NORTH); JPanel topPanel = new JPanel(); FormLayout topLayout = new FormLayout("20px, pref, pref:grow", "pref, pref, pref, pref, pref"); CellConstraints cc = new CellConstraints(); topPanel.setLayout(topLayout);/* w w w. j a va 2s . com*/ final SyllabifierLibrary library = SyllabifierLibrary.getInstance(); final Iterator<Syllabifier> syllabifiers = library.availableSyllabifiers(); final List<Syllabifier> orderedSyllabifiers = new ArrayList<Syllabifier>(); while (syllabifiers.hasNext()) orderedSyllabifiers.add(syllabifiers.next()); Collections.sort(orderedSyllabifiers, new SyllabifierComparator()); syllabifierList = new JComboBox(orderedSyllabifiers.toArray(new Syllabifier[0])); syllabifierList.setEnabled(false); syllabifierList.setRenderer(new SyllabifierCellRenderer()); final String preferredSyllabifier = PrefHelper.get(PhonProperties.SYLLABIFIER_LANGUAGE, PhonProperties.DEFAULT_SYLLABIFIER_LANGUAGE); syllabifierList.setSelectedItem(preferredSyllabifier); checkIPAButton = new JRadioButton("Check IPA Tiers"); checkIPAButton.setToolTipText("Check IPA tiers for invalid transcriptions."); resetSyllabificationButton = new JRadioButton("Reset syllabification"); resetSyllabificationButton.setToolTipText("Reset syllabification for all IPA tiers in selected sessions."); resetAlignmentBox = new JCheckBox("also reset phone alignment"); resetAlignmentBox.setEnabled(false); resetAlignmentButton = new JRadioButton("Reset phone alignment"); resetAlignmentButton.setToolTipText("Reset alignment for all records in selected sessions."); ButtonGroup btnGroup = new ButtonGroup(); btnGroup.add(checkIPAButton); btnGroup.add(resetSyllabificationButton); btnGroup.add(resetAlignmentButton); resetSyllabificationButton.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent arg0) { resetAlignmentBox.setEnabled(resetSyllabificationButton.isSelected()); syllabifierList.setEnabled(resetSyllabificationButton.isSelected()); } }); checkIPAButton.setSelected(true); topPanel.add(checkIPAButton, cc.xyw(1, 1, 3)); topPanel.add(resetSyllabificationButton, cc.xyw(1, 2, 2)); topPanel.add(syllabifierList, cc.xy(3, 2)); topPanel.add(resetAlignmentBox, cc.xy(2, 4)); topPanel.add(resetAlignmentButton, cc.xyw(1, 5, 3)); topPanel.setBorder(BorderFactory.createTitledBorder("Operation")); JPanel centerPanel = new JPanel(new BorderLayout()); sessionSelector = new SessionSelector(project); sessionSelector.setVisibleRowCount(20); centerPanel.add(new JScrollPane(sessionSelector), BorderLayout.CENTER); centerPanel.setBorder(BorderFactory.createTitledBorder("Select sessions")); JPanel innerPanel = new JPanel(new BorderLayout()); innerPanel.add(topPanel, BorderLayout.NORTH); innerPanel.add(centerPanel, BorderLayout.CENTER); super.add(innerPanel, BorderLayout.CENTER); }
From source file:ca.phon.app.project.CopySessionEP.java
License:Open Source License
private void begin() { if (project1 == null || project2 == null || corpus1 == null || corpus2 == null || session == null) { final CopySessionForm csf = new CopySessionForm(); if (project1 != null) csf.setSelectedProject(project1); if (corpus1 != null) csf.setSelectedCorpus(corpus1); if (session != null) csf.setSelectedSession(session); if (project2 != null) csf.setDestinationProject(project2); if (corpus2 != null) csf.setSelectedCorpus(corpus2); // show the window String titleString = (move ? "Move " : "Copy ") + "Session"; final CommonModuleFrame dialog = new CommonModuleFrame(titleString); // setup display FormLayout layout = new FormLayout("fill:pref:grow, right:pref", "pref, 3dlu, fill:pref:grow, 3dlu, pref, 5dlu"); dialog.getContentPane().setLayout(layout); DialogHeader header = new DialogHeader(titleString, ""); JButton okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { @Override/*from w w w .ja va 2 s . c om*/ public void actionPerformed(ActionEvent e) { dialog.setVisible(false); dialog.dispose(); // copy the session copySession(csf.getSelectedProject(), csf.getDestinationProject(), csf.getSelectedCorpus(), csf.getDestinationCorpus(), csf.getSelectedSession(), force); } }); JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dialog.setVisible(false); dialog.dispose(); } }); CellConstraints cc = new CellConstraints(); dialog.getContentPane().add(header, cc.xyw(1, 1, 2)); dialog.getContentPane().add(csf, cc.xyw(1, 3, 2)); dialog.getContentPane().add(ButtonBarBuilder.buildOkCancelBar(okButton, cancelButton), cc.xy(2, 5)); dialog.getRootPane().setDefaultButton(okButton); dialog.pack(); dialog.setVisible(true); } else { // we have enough info, don't show dialog copySession(project1, project2, corpus1, corpus2, session, force); } }
From source file:ca.phon.app.project.CopySessionForm.java
License:Open Source License
private void init() { // setup layout FormLayout layout = new FormLayout("5dlu, pref, 3dlu, fill:pref:grow, 5dlu", "5dlu, pref, 3dlu, pref, 3dlu, pref, 3dlu, pref, 5dlu, pref, 3dlu, pref, 3dlu, pref, 5dlu"); CellConstraints cc = new CellConstraints(); this.setLayout(layout); // create components final List<Project> openProjects = Workspace.userWorkspace().getProjects(); sessionCombo = new JComboBox(); corpus1Combo = new JComboBox(); corpus1Combo.addItemListener(new ItemListener() { @Override/*w w w . ja va 2 s . c o m*/ public void itemStateChanged(ItemEvent e) { fillSessionList(); } }); corpus2Combo = new JComboBox(); proj1Combo = new JComboBox(openProjects.toArray()); proj1Combo.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { fillCorpusList(proj1Combo); } }); proj1Combo.setSelectedIndex(0); fillCorpusList(proj1Combo); fillSessionList(); proj2Combo = new JComboBox(openProjects.toArray()); proj2Combo.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { fillCorpusList(proj2Combo); } }); proj2Combo.setSelectedIndex(0); fillCorpusList(proj2Combo); // add components this.add(DefaultComponentFactory.getInstance().createSeparator("Selection"), cc.xyw(2, 2, 3)); this.add(new JLabel("Project"), cc.xy(2, 4)); this.add(proj1Combo, cc.xy(4, 4)); this.add(new JLabel("Corpus"), cc.xy(2, 6)); this.add(corpus1Combo, cc.xy(4, 6)); this.add(new JLabel("Session"), cc.xy(2, 8)); this.add(sessionCombo, cc.xy(4, 8)); this.add(DefaultComponentFactory.getInstance().createSeparator("Destination"), cc.xyw(2, 10, 3)); this.add(new JLabel("Project"), cc.xy(2, 12)); this.add(proj2Combo, cc.xy(4, 12)); this.add(new JLabel("Corpus"), cc.xy(2, 14)); this.add(corpus2Combo, cc.xy(4, 14)); }
From source file:ca.phon.app.query.QueryInfoPanel.java
License:Open Source License
private void init() { setLayout(new BorderLayout()); starBox = new StarBox(IconSize.SMALL); starBox.addActionListener(new ActionListener() { @Override//from w w w.jav a 2s . co m public void actionPerformed(ActionEvent e) { toggleStarred(); } }); // query name nameLabel = new JXLabel(); Font nameFont = nameLabel.getFont().deriveFont(Font.BOLD, 14.0f); nameLabel.setFont(nameFont); final ImageIcon searchIcon = IconManager.getInstance().getIcon("actions/system-search", IconSize.SMALL); final PhonUIAction openAction = new PhonUIAction(this, "onOpenQuery"); openAction.putValue(PhonUIAction.NAME, "Open Query"); openAction.putValue(PhonUIAction.SMALL_ICON, searchIcon); openAction.putValue(PhonUIAction.SHORT_DESCRIPTION, "Open query in editor"); openButton = new JButton(openAction); nameField = new JTextField(); nameField.setFont(nameFont); uuidLabel = new JLabel(); dateLabel = new JLabel(); commentsArea = new JTextArea(); commentsArea.setRows(5); commentsArea.setLineWrap(true); commentsArea.setEditable(false); commentsArea.setFont(Font.getFont("dialog")); final JScrollPane commentsLabelScroller = new JScrollPane(commentsArea); // layout form components final FormLayout layout = new FormLayout("right:pref, 3dlu, fill:pref:grow, right:pref", "pref, 3dlu, pref, 3dlu, pref, 3dlu, top:pref, fill:pref:grow"); final CellConstraints cc = new CellConstraints(); infoSection = new JPanel(layout); infoSection.setBorder(BorderFactory.createTitledBorder("Information")); infoSection.add(starBox, cc.xy(1, 1)); infoSection.add(nameLabel, cc.xy(3, 1)); infoSection.add(openButton, cc.xy(4, 1)); infoSection.add(new JLabel("UUID:"), cc.xy(1, 3)); infoSection.add(uuidLabel, cc.xyw(3, 3, 2)); infoSection.add(new JLabel("Date:"), cc.xy(1, 5)); infoSection.add(dateLabel, cc.xyw(3, 5, 2)); infoSection.add(new JLabel("Comments:"), cc.xy(1, 7)); infoSection.add(commentsLabelScroller, cc.xywh(3, 7, 2, 2)); resultsModel = new ResultSetTableModel(project, null); resultsModel.addPropertyChangeListener(bgTaskPropertyListener); resultsTable = new JXTable(resultsModel); resultsTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); resultsTable.addMouseListener(resultsMouseListener); resultsRowSorter = new TableRowSorter<ResultSetTableModel>(resultsModel); resultsRowSorter.setSortsOnUpdates(true); final RowSorter.SortKey sortKey = new RowSorter.SortKey(ResultSetTableModel.Columns.ID.ordinal(), SortOrder.ASCENDING); resultsRowSorter.setSortKeys(Collections.singletonList(sortKey)); resultsTable.setRowSorter(resultsRowSorter); resultsTable.setColumnControlVisible(true); resultsTable.addHighlighter(HighlighterFactory.createSimpleStriping()); resultsTable.setVisibleRowCount(10); // remove selection column resultsTable.getColumnModel().removeColumn(resultsTable.getColumn(0)); JScrollPane resultsScroller = new JScrollPane(resultsTable); final ImageIcon reportIcon = IconManager.getInstance().getIcon("mimetypes/x-office-spreadsheet", IconSize.SMALL); final PhonUIAction reportAction = new PhonUIAction(this, "onReport"); reportAction.putValue(PhonUIAction.NAME, "Report"); reportAction.putValue(PhonUIAction.SHORT_DESCRIPTION, "Create report"); reportAction.putValue(PhonUIAction.SMALL_ICON, reportIcon); reportButton = new JButton(reportAction); busyLabel = new JXBusyLabel(new Dimension(16, 16)); busyLabel.setBusy(false); hideResultsBox = new JCheckBox("Hide empty result sets"); hideResultsBox.setSelected(false); hideResultsBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { toggleRowFilter(); } }); // system preference openEditorBox = new JCheckBox("Open session with result set"); openEditorBox.setSelected(true); resultsSection = new JPanel(new BorderLayout()); resultsSection.setBorder(BorderFactory.createTitledBorder("Results")); final FormLayout topLayout = new FormLayout("pref, left:pref, left:pref, fill:pref:grow, right:pref", "pref"); final JPanel topResultsPanel = new JPanel(); topResultsPanel.setLayout(topLayout); topResultsPanel.add(busyLabel, cc.xy(1, 1)); topResultsPanel.add(hideResultsBox, cc.xy(2, 1)); topResultsPanel.add(openEditorBox, cc.xy(3, 1)); topResultsPanel.add(reportButton, cc.xy(5, 1)); resultsSection.add(topResultsPanel, BorderLayout.NORTH); resultsSection.add(resultsScroller, BorderLayout.CENTER); openButton.setEnabled(false); reportButton.setEnabled(false); add(infoSection, BorderLayout.NORTH); add(resultsSection, BorderLayout.CENTER); }
From source file:ca.phon.app.query.report.GroupSectionPanel.java
License:Open Source License
private void init() { super.setInformationText(getClass().getName() + ".info", INFO_TEXT); Group gt = getSection();// w w w . ja va 2s. c om FormLayout layout = new FormLayout("5dlu, fill:pref:grow", "pref, pref"); JPanel panel = new JPanel(layout); CellConstraints cc = new CellConstraints(); printSessionInfoBox = new JCheckBox("Include session information"); printSessionInfoBox.setSelected(gt.isPrintSessionHeader()); printSessionInfoBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { getSection().setPrintSessionHeader(printSessionInfoBox.isSelected()); printParticipantInfoBox.setEnabled(printSessionInfoBox.isSelected()); } }); printParticipantInfoBox = new JCheckBox("Include participant information"); printParticipantInfoBox.setSelected(gt.isPrintParticipantInformation()); printParticipantInfoBox.setEnabled(printSessionInfoBox.isSelected()); printParticipantInfoBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { getSection().setPrintParticipantInformation(printParticipantInfoBox.isSelected()); } }); panel.add(printSessionInfoBox, cc.xyw(1, 1, 2)); panel.add(printParticipantInfoBox, cc.xy(2, 2)); panel.setBorder(BorderFactory.createTitledBorder("Options")); add(panel, BorderLayout.CENTER); }
From source file:ca.phon.app.query.report.ResultListingSectionPanel.java
License:Open Source License
private void init() { // get absolute locations of icons String addImgRelPath = "data" + File.separator + "icons" + File.separator + "16x16" + File.separator + "actions" + File.separator + "list-add.png"; File addImgFile = new File(addImgRelPath); String addImgURI = addImgFile.toURI().toASCIIString(); String removeImgRelPath = "data" + File.separator + "icons" + File.separator + "16x16" + File.separator + "actions" + File.separator + "list-remove.png"; File remImgFile = new File(removeImgRelPath); String remImgURI = remImgFile.toURI().toASCIIString(); String infoTxt = INFO_TEXT.replaceAll("\\$\\{field_add_img\\}", addImgURI) .replaceAll("\\$\\{field_remove_img\\}", remImgURI); super.setInformationText(getClass().getName() + ".info", infoTxt); // list panel FormLayout listLayout = new FormLayout("fill:pref:grow, pref", "pref, fill:pref:grow"); JPanel listPanel = new JPanel(listLayout); CellConstraints cc = new CellConstraints(); ResultListing resList = getSection(); fieldList = new JXList(resList.getField().toArray(new ResultListingField[0])); fieldList.setCellRenderer(new FieldListCellRenderer()); fieldList.addListSelectionListener(new FieldListSelectionListener()); fieldList.setMinimumSize(new Dimension(200, 0)); ActionMap fieldActionMap = fieldList.getActionMap(); InputMap fieldInputMap = fieldList.getInputMap(JComponent.WHEN_FOCUSED); PhonUIAction showListAction = new PhonUIAction(this, "onShowPopup"); ImageIcon addIcn = IconManager.getInstance().getIcon("actions/list-add", IconSize.XSMALL); showListAction.putValue(PhonUIAction.SMALL_ICON, addIcn); showListAction.putValue(PhonUIAction.SHORT_DESCRIPTION, "Add field..."); addFieldButton = new JButton(showListAction); PhonUIAction removeFieldAction = new PhonUIAction(this, "onDelField"); ImageIcon delIcn = IconManager.getInstance().getIcon("actions/list-remove", IconSize.XSMALL); removeFieldAction.putValue(PhonUIAction.SMALL_ICON, delIcn); removeFieldAction.putValue(PhonUIAction.SHORT_DESCRIPTION, "Remove selected field"); delFieldButton = new JButton(removeFieldAction); String delActID = "_remove_field_"; fieldActionMap.put(delActID, removeFieldAction); KeyStroke delKs1 = KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0); KeyStroke delKs2 = KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0); fieldInputMap.put(delKs1, delActID); fieldInputMap.put(delKs2, delActID); PhonUIAction moveFieldUpAction = new PhonUIAction(this, "onMoveFieldUp"); ImageIcon upIcn = IconManager.getInstance().getIcon("actions/go-up", IconSize.XSMALL); moveFieldUpAction.putValue(PhonUIAction.SMALL_ICON, upIcn); moveFieldUpAction.putValue(PhonUIAction.SHORT_DESCRIPTION, "Move selected field up"); upFieldButton = new JButton(moveFieldUpAction); PhonUIAction moveFieldDownAction = new PhonUIAction(this, "onMoveFieldDown"); ImageIcon downIcn = IconManager.getInstance().getIcon("actions/go-down", IconSize.XSMALL); moveFieldDownAction.putValue(PhonUIAction.SMALL_ICON, downIcn); moveFieldDownAction.putValue(PhonUIAction.SHORT_DESCRIPTION, "Move selected field down"); downFieldButton = new JButton(moveFieldDownAction); FormLayout topBtnLayout = new FormLayout( "fill:pref:grow, right:pref, right:pref, " + (upFieldButton.getPreferredSize().width) + "px", "pref"); JPanel topBtnPanel = new JPanel(topBtnLayout); FormLayout sideBtnLayout = new FormLayout("pref", "pref, 3dlu, pref, fill:pref:grow"); JPanel sideBtnPanel = new JPanel(sideBtnLayout); JScrollPane listScroller = new JScrollPane(fieldList); topBtnPanel.add(addFieldButton, cc.xy(2, 1)); topBtnPanel.add(delFieldButton, cc.xy(3, 1)); sideBtnPanel.add(upFieldButton, cc.xy(1, 1)); sideBtnPanel.add(downFieldButton, cc.xy(1, 3)); listPanel.add(topBtnPanel, cc.xyw(1, 1, 2)); listPanel.add(sideBtnPanel, cc.xywh(2, 2, 1, 1)); listPanel.add(listScroller, cc.xy(1, 2)); // field form fieldOptionsPanel = new JPanel(new BorderLayout()); fieldOptionsPanel.setBorder(BorderFactory.createTitledBorder("Options")); namePanel = new JPanel(new FormLayout("left:pref, 3dlu, fill:pref:grow", "pref")); nameField = new JTextField(); nameField.getDocument().addDocumentListener(new NameFieldListener()); namePanel.add(new JLabel("Field name:"), cc.xy(1, 1)); namePanel.add(nameField, cc.xy(3, 1)); fieldOptionsPanel.add(namePanel, BorderLayout.NORTH); // format selection tableOptBox = new JRadioButton("Table"); listOptBox = new JRadioButton("List"); ButtonGroup btnGroup = new ButtonGroup(); FormatHandler formatHandler = new FormatHandler(); tableOptBox.setSelected(resList.getFormat() == ResultListingFormatType.TABLE); tableOptBox.addActionListener(formatHandler); listOptBox.setSelected(!tableOptBox.isSelected()); listOptBox.addActionListener(formatHandler); includeExcludedBox = new JCheckBox("Include excluded results"); includeExcludedBox.setSelected(getSection().isIncludeExcluded()); includeExcludedBox.addActionListener(new ActionListener() { @Override/*from w w w . jav a 2s . c o m*/ public void actionPerformed(ActionEvent arg0) { getSection().setIncludeExcluded(includeExcludedBox.isSelected()); } }); btnGroup.add(tableOptBox); btnGroup.add(listOptBox); FormLayout splitLayout = new FormLayout("200px:nogrow, fill:default:grow", "fill:default:grow"); fieldPanel = new JPanel(splitLayout); fieldPanel.add(listPanel, cc.xy(1, 1)); fieldPanel.add(fieldOptionsPanel, cc.xy(2, 1)); fieldPanel.setBorder(BorderFactory.createTitledBorder("Field Outline")); JPanel formatPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); formatPanel.add(new JLabel("Display data as:")); formatPanel.add(tableOptBox); formatPanel.add(listOptBox); formatPanel.add(includeExcludedBox); formatPanel.setBorder(BorderFactory.createTitledBorder("Options")); JPanel cPanel = new JPanel(new BorderLayout()); cPanel.add(formatPanel, BorderLayout.NORTH); cPanel.add(fieldPanel, BorderLayout.CENTER); add(cPanel, BorderLayout.CENTER); nameField.setEnabled(false); }
From source file:ca.phon.app.query.SaveQueryDialog.java
License:Open Source License
private void init() { // final PathExpander pe = new PathExpander(); nameField = new JTextField(); nameField.getDocument().addDocumentListener(new DocumentListener() { @Override/*from w w w.j av a2 s . co m*/ public void insertUpdate(DocumentEvent de) { updateLocationFields(); } @Override public void removeUpdate(DocumentEvent de) { updateLocationFields(); } @Override public void changedUpdate(DocumentEvent de) { updateLocationFields(); } }); includeFormOptionsBox = new JCheckBox("Include current form settings"); includeFormOptionsBox.setSelected(true); ButtonGroup btnGrp = new ButtonGroup(); saveInProjectBtn = new JRadioButton("Save in project resources"); btnGrp.add(saveInProjectBtn); saveInUserDirBtn = new JRadioButton("Save in user library"); btnGrp.add(saveInUserDirBtn); saveOtherBtn = new JRadioButton("Save in another location..."); btnGrp.add(saveOtherBtn); saveInUserDirBtn.setSelected(true); projSaveLocField = new JLabel(); // projSaveLocField.setFont(projSaveLocField.getFont().deriveFont(10.0f)); libSaveLocField = new JLabel(); // libSaveLocField.setFont(libSaveLocField.getFont().deriveFont(10.0f)); updateLocationFields(); saveBtn = new JButton("Save"); saveBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { save(); } }); super.getRootPane().setDefaultButton(saveBtn); cancelBtn = new JButton("Cancel"); cancelBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { setVisible(false); } }); final DialogHeader header = new DialogHeader("Save Query", ""); JComponent btnBar = ButtonBarBuilder.buildOkCancelBar(saveBtn, cancelBtn); final FormLayout formLayout = new FormLayout("3dlu, 12dlu, fill:pref:grow, 3dlu", "pref, pref, pref, pref, pref, pref, pref, pref, pref, pref"); final CellConstraints cc = new CellConstraints(); setLayout(formLayout); add(header, cc.xyw(2, 1, 2)); add(new JLabel("Name: (without extension)"), cc.xyw(2, 2, 2)); add(nameField, cc.xy(3, 3)); add(includeFormOptionsBox, cc.xy(3, 4)); add(saveInUserDirBtn, cc.xyw(2, 5, 2)); // add(libSaveLocField, cc.xy(3, 6)); add(saveInProjectBtn, cc.xyw(2, 7, 2)); // add(projSaveLocField, cc.xy(3, 8)); add(saveOtherBtn, cc.xyw(2, 9, 2)); add(btnBar, cc.xyw(2, 10, 2)); }
From source file:ca.phon.app.session.editor.RecordSortDialog.java
License:Open Source License
private void init() { setLayout(new BorderLayout()); header = new DialogHeader("Sort Records", "Sort records by one or more tiers."); createComboBoxes();//from ww w. ja v a 2s.co m createCheckBoxes(); FormLayout layout = new FormLayout("3dlu, pref, fill:pref:grow, pref, 3dlu", "pref, pref, pref, pref, 3dlu"); JPanel formPanel = new JPanel(layout); CellConstraints cc = new CellConstraints(); for (int i = 0; i < 3; i++) { String lblText = (i == 0 ? "Sort by:" : "then by:"); formPanel.add(new JLabel(lblText), cc.xy(2, i + 1)); formPanel.add(comboBoxes[i], cc.xy(3, i + 1)); formPanel.add(checkBoxes[i], cc.xy(4, i + 1)); } PhonUIAction okAct = new PhonUIAction(this, "onOk"); okAct.putValue(Action.NAME, "Ok"); okAct.putValue(Action.SHORT_DESCRIPTION, "Sort records and close"); okButton = new JButton(okAct); PhonUIAction cancelAct = new PhonUIAction(this, "onCancel"); cancelAct.putValue(Action.NAME, "Cancel"); cancelAct.putValue(Action.SHORT_DESCRIPTION, "Close dialog"); cancelButton = new JButton(cancelAct); // bind cancel action to ESC key KeyStroke escKs = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); InputMap inputMap = getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); ActionMap actionMap = getRootPane().getActionMap(); actionMap.put("_CANCEL_DIALOG_", cancelAct); inputMap.put(escKs, "_CANCEL_DIALOG_"); getRootPane().setInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW, inputMap); getRootPane().setActionMap(actionMap); JComponent btnBar = ButtonBarBuilder.buildOkCancelBar(okButton, cancelButton); formPanel.add(btnBar, cc.xyw(2, 4, 3)); add(header, BorderLayout.NORTH); add(formPanel, BorderLayout.CENTER); super.getRootPane().setDefaultButton(okButton); // setup default button // add(btnBar, BorderLayout.SOUTH); }