List of usage examples for com.jgoodies.forms.layout FormLayout FormLayout
public FormLayout(ColumnSpec[] colSpecs, RowSpec[] rowSpecs)
From source file:ca.parkie.portfinder.client.NetworkInterfaceDialog.java
License:GNU General Public License
/** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection ALL//from w w w . ja va 2 s . c om */ private void $$$setupUI$$$() { contentPane = new JPanel(); contentPane.setLayout(new FormLayout("fill:d:grow", "center:d:grow")); contentPane.setPreferredSize(new Dimension(370, 51)); final JPanel panel1 = new JPanel(); panel1.setLayout(new FormLayout( "fill:d:noGrow,left:4dlu:noGrow,fill:d:noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow", "center:30px:noGrow")); CellConstraints cc = new CellConstraints(); contentPane.add(panel1, new CellConstraints(1, 1, 1, 1, CellConstraints.CENTER, CellConstraints.FILL, new Insets(11, 11, 11, 11))); final JLabel label1 = new JLabel(); label1.setText("Select the network interface to use:"); panel1.add(label1, cc.xy(1, 1, CellConstraints.LEFT, CellConstraints.DEFAULT)); networkInterfaceCombo = new JComboBox(); panel1.add(networkInterfaceCombo, cc.xy(3, 1)); okButton = new JButton(); okButton.setEnabled(false); okButton.setText("Ok"); panel1.add(okButton, cc.xy(5, 1)); label1.setLabelFor(networkInterfaceCombo); }
From source file:ca.phon.app.fonts.FontPreferencesPanel.java
License:Open Source License
private void init() { restartPanel = new HidablePanel(FontPreferencesPanel.class.getName() + ".restartPanel"); restartPanel.setTopLabelText("Please re-open Phon"); restartPanel.getTopLabel().setFont(FontPreferences.getTitleFont()); restartPanel.setBottomLabelText("It is recommended to restart Phon after making changes to font settings."); restartPanel.setVisible(false);//from w w w .jav a 2s. c om tierFontBtn = new FontSelectionButton(); tierFontBtn.setFontProp(FontPreferences.TIER_FONT); tierFontBtn.setDefaultVal(FontPreferences.DEFAULT_TIER_FONT); tierFontBtn.setTopLabelText("<html><b>Tier font</b> • Default font for tiers</html>"); tierFontBtn.setSelectedFont(FontPreferences.getTierFont()); uiIpaFontBtn = new FontSelectionButton(); uiIpaFontBtn.setFontProp(FontPreferences.UI_IPA_FONT); uiIpaFontBtn.setDefaultVal(FontPreferences.DEFAULT_UI_IPA_FONT); uiIpaFontBtn.setTopLabelText( "<html><b>UI Font</b> • Font used for UI controls which display IPA text</html>"); uiIpaFontBtn.setSelectedFont(FontPreferences.getUIIpaFont()); final JPanel tierFontsPanel = new JPanel(new VerticalLayout()); tierFontsPanel.add(tierFontBtn); tierFontsPanel.add(uiIpaFontBtn); tierFontsPanel.setBorder(BorderFactory.createTitledBorder("IPA Fonts")); final Hashtable<Integer, JLabel> hashTbl = new Hashtable<Integer, JLabel>(); hashTbl.put(0, new JLabel("Default")); fontSizeSlider = new JSlider(-2, 4); fontSizeSlider.setPaintTicks(true); fontSizeSlider.setMajorTickSpacing(2); fontSizeSlider.setSnapToTicks(true); fontSizeSlider.setToolTipText("Adjust font size"); fontSizeSlider.setLabelTable(hashTbl); fontSizeSlider.setPaintLabels(true); fontSizeSlider.setValue(FontPreferences.getFontSizeIncrease()); fontSizeSlider.setFocusable(false); fontSizeSlider.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { int val = fontSizeSlider.getValue(); if (Math.abs(val) % 2 == 0 && !fontSizeSlider.getValueIsAdjusting()) { FontPreferences.setFontSizeIncrease(val); final Runnable later = new Runnable() { @Override public void run() { // FontPreferences.setupFontPreferences(); } }; SwingUtilities.invokeLater(later); } } }); // setup font scaler final JLabel smallLbl = new JLabel("A"); smallLbl.setFont(getFont().deriveFont(12.0f)); smallLbl.setHorizontalAlignment(SwingConstants.CENTER); JLabel largeLbl = new JLabel("A"); largeLbl.setFont(getFont().deriveFont(24.0f)); largeLbl.setHorizontalAlignment(SwingConstants.CENTER); final FormLayout fontSizeLayout = new FormLayout( "fill:pref:grow(0.5), pref, fill:pref:grow, pref, fill:pref:grow(0.5)", "pref"); final CellConstraints cc = new CellConstraints(); final JPanel fontSizePanel = new JPanel(fontSizeLayout); fontSizePanel.add(smallLbl, cc.xy(2, 1)); fontSizePanel.add(fontSizeSlider, cc.xy(3, 1)); fontSizePanel.add(largeLbl, cc.xy(4, 1)); controlFontBtn = new FontSelectionButton(); controlFontBtn.setFontProp(FontPreferences.CONTROL_FONT); controlFontBtn.setDefaultVal(FontPreferences.DEFAULT_CONTROL_FONT); controlFontBtn.setTopLabelText("<html><b>Control font</b> • Default font for UI controls</html>"); controlFontBtn.setSelectedFont(FontPreferences.getControlFont()); titleFontBtn = new FontSelectionButton(); titleFontBtn.setFontProp(FontPreferences.TITLE_FONT); titleFontBtn.setDefaultVal(FontPreferences.DEFAULT_TITLE_FONT); titleFontBtn.setTopLabelText("<html><b>Title font</b> • Font used in titles</html>"); titleFontBtn.setSelectedFont(FontPreferences.getTitleFont()); smallFontBtn = new FontSelectionButton(); smallFontBtn.setFontProp(FontPreferences.SMALL_FONT); smallFontBtn.setDefaultVal(FontPreferences.DEFAULT_SMALL_FONT); smallFontBtn.setTopLabelText("<html><b>Small font</b> • Font used in tool tips</html>"); smallFontBtn.setSelectedFont(FontPreferences.getSmallFont()); menuFontBtn = new FontSelectionButton(); menuFontBtn.setFontProp(FontPreferences.MENU_FONT); menuFontBtn.setDefaultVal(FontPreferences.DEFAULT_MENU_FONT); menuFontBtn.setTopLabelText("<html><b>Menu font</b> • Font used in menus</html>"); menuFontBtn.setSelectedFont(FontPreferences.getMenuFont()); monospaceBtn = new FontSelectionButton(); monospaceBtn.setFontProp(FontPreferences.MONOSPACE_FONT); monospaceBtn.setDefaultVal(FontPreferences.DEFAULT_MONOSPACE_FONT); monospaceBtn.setTopLabelText("<html><b>Monospace font</b> • Font used in consoles</html>"); monospaceBtn.setSelectedFont(FontPreferences.getMonospaceFont()); final JPanel uiFontsPanel = new JPanel(new VerticalLayout()); // uiFontsPanel.add(fontSizePanel); uiFontsPanel.add(controlFontBtn); uiFontsPanel.add(menuFontBtn); uiFontsPanel.add(titleFontBtn); uiFontsPanel.add(smallFontBtn); uiFontsPanel.add(monospaceBtn); uiFontsPanel.setBorder(BorderFactory.createTitledBorder("UI Fonts")); setLayout(new VerticalLayout()); add(restartPanel); add(tierFontsPanel); add(uiFontsPanel); }
From source file:ca.phon.app.log.BufferPanel.java
License:Open Source License
private void init() { setLayout(new BorderLayout()); final FormLayout topLayout = new FormLayout("pref, pref,3dlu, pref, fill:pref:grow, pref, 3dlu, right:pref", "pref"); final CellConstraints cc = new CellConstraints(); final JPanel topPanel = new JPanel(topLayout); final PhonUIAction saveAct = new PhonUIAction(this, "onSaveBuffer"); saveAct.putValue(PhonUIAction.SHORT_DESCRIPTION, "Save buffer..."); saveAct.putValue(PhonUIAction.SMALL_ICON, IconManager.getInstance().getIcon("actions/document-save", IconSize.SMALL)); saveButton = new JButton(saveAct); openFileAfterSavingBox = new JCheckBox("Open after saving"); openFileAfterSavingBox.setSelected(openFileAfterSaving); openFileAfterSavingBox.addChangeListener(e -> { BufferPanel.this.openFileAfterSaving = openFileAfterSavingBox.isSelected(); PrefHelper.getUserPreferences().putBoolean(OPEN_AFTER_SAVING_PROP, BufferPanel.this.openFileAfterSaving); });/*w w w . ja v a2 s . co m*/ final PhonUIAction firstRowAsHeaderAct = new PhonUIAction(this, "onToggleFirstRowAsHeader"); firstRowAsHeaderAct.putValue(PhonUIAction.NAME, "Use first row as column header"); firstRowAsHeaderAct.putValue(PhonUIAction.SELECTED_KEY, Boolean.TRUE); firstRowAsHeaderBox = new JCheckBox(firstRowAsHeaderAct); busyLabel.setVisible(false); buttons = new BufferPanelButtons(this); topPanel.add(firstRowAsHeaderBox, cc.xy(4, 1)); topPanel.add(saveButton, cc.xy(1, 1)); topPanel.add(openFileAfterSavingBox, cc.xy(2, 1)); topPanel.add(busyLabel, cc.xy(6, 1)); topPanel.add(buttons, cc.xy(8, 1)); add(topPanel, BorderLayout.NORTH); logScroller = new RTextScrollPane(logBuffer, true); add(logScroller, BorderLayout.CENTER); final ActionMap am = dataTable.getActionMap(); final InputMap im = dataTable.getInputMap(JComponent.WHEN_FOCUSED); final String deleteRowsKey = "__delete_rows__"; final PhonUIAction deleteRowsAct = new PhonUIAction(this, "deleteSelectedRows"); am.put(deleteRowsKey, deleteRowsAct); final KeyStroke delKs = KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0); im.put(delKs, deleteRowsKey); final String defaultActKey = "__default_act__"; final TableAction defaultAct = new TableAction(tableAct); am.put(defaultActKey, defaultAct); final KeyStroke defKs = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0); im.put(defKs, defaultActKey); dataTable.setActionMap(am); dataTable.setInputMap(JComponent.WHEN_FOCUSED, im); dataTable.addMouseListener(new TableMouseAdapter(tableAct)); tableScroller = new JScrollPane(dataTable, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); }
From source file:ca.phon.app.log.BufferWindow.java
License:Open Source License
private void init() { setLayout(new BorderLayout()); final DialogHeader header = new DialogHeader("Buffers", ""); add(header, BorderLayout.NORTH); final JPanel centerPanel = new JPanel(new BorderLayout()); final JPanel selectionPanel = new JPanel(new FormLayout("pref, 3dlu, fill:pref:grow, 3dlu, pref", "pref")); final CellConstraints cc = new CellConstraints(); selectionPanel.add(new JLabel("Buffer: "), cc.xy(1, 1)); buffersBox = new JComboBox(); buffersBox.addItemListener(new ItemListener() { @Override/* w ww. j ava 2 s . co m*/ public void itemStateChanged(ItemEvent e) { final String bufferName = e.getItem().toString(); selectBuffer(bufferName); } }); selectionPanel.add(buffersBox, cc.xy(3, 1)); closeButton = new JButton(new CloseCurrentBufferAction()); selectionPanel.add(closeButton, cc.xy(5, 1)); centerPanel.add(selectionPanel, BorderLayout.NORTH); buffersPanel = new JPanel(buffersLayout); centerPanel.add(buffersPanel, BorderLayout.CENTER); add(centerPanel, BorderLayout.CENTER); }
From source file:ca.phon.app.opgraph.syllabifier.SyllabifierSettingsPanel.java
License:Open Source License
private void init() { final FormLayout layout = new FormLayout("right:pref, 3dlu, fill:pref:grow", "pref, 3dlu, pref"); setLayout(layout);//w w w .j av a 2 s. co m final CellConstraints cc = new CellConstraints(); add(new JLabel("Syllabifier name:"), cc.xy(1, 1)); nameField = new JTextField(); add(nameField, cc.xy(3, 1)); add(new JLabel("Syllabifier language:"), cc.xy(1, 3)); languageField = new JTextField(); add(languageField, cc.xy(3, 3)); }
From source file:ca.phon.app.prefs.EditorPrefsPanel.java
License:Open Source License
private void init() { CellConstraints cc = new CellConstraints(); final IPADictionaryLibrary dictLibrary = IPADictionaryLibrary.getInstance(); final String dictLangPref = PrefHelper.get(PhonProperties.IPADICTIONARY_LANGUAGE, PhonProperties.DEFAULT_IPADICTIONARY_LANGUAGE); final Language dictLang = Language.parseLanguage(dictLangPref); Language langs[] = dictLibrary.availableLanguages().toArray(new Language[0]); Arrays.sort(langs, new LanguageComparator()); cmbDictionaryLanguage = new JComboBox<>(langs); cmbDictionaryLanguage.setSelectedItem(dictLang); cmbDictionaryLanguage.addItemListener(new DictionaryLanguageListener()); cmbDictionaryLanguage.setRenderer(new LanguageCellRenderer()); JPanel jpanel1 = new JPanel(new FlowLayout(FlowLayout.LEFT)); jpanel1.setBorder(new TitledBorder("Dictionary Language")); jpanel1.add(cmbDictionaryLanguage);// w w w.j av a 2 s . com final SyllabifierLibrary syllabifierLibrary = SyllabifierLibrary.getInstance(); final Language syllLangPref = syllabifierLibrary.defaultSyllabifierLanguage(); Syllabifier defSyllabifier = null; final Iterator<Syllabifier> syllabifiers = syllabifierLibrary.availableSyllabifiers(); List<Syllabifier> sortedSyllabifiers = new ArrayList<Syllabifier>(); while (syllabifiers.hasNext()) { final Syllabifier syllabifier = syllabifiers.next(); if (syllabifier.getLanguage().equals(syllLangPref)) defSyllabifier = syllabifier; sortedSyllabifiers.add(syllabifier); } Collections.sort(sortedSyllabifiers, new SyllabifierComparator()); cmbSyllabifierLanguage = new JComboBox<>(sortedSyllabifiers.toArray(new Syllabifier[0])); cmbSyllabifierLanguage.setRenderer(new SyllabifierCellRenderer()); if (defSyllabifier != null) cmbSyllabifierLanguage.setSelectedItem(defSyllabifier); cmbSyllabifierLanguage.addItemListener(new SyllabifierLanguageListener()); JPanel jpanel2 = new JPanel(new FlowLayout(FlowLayout.LEFT)); jpanel2.setBorder(new TitledBorder("Syllabifier Language")); jpanel2.add(cmbSyllabifierLanguage); autosaveBox = new JComboBox<>(autosaveTimes); final Integer autosavePref = PrefHelper.getInt(PhonProperties.AUTOSAVE_INTERVAL, PhonProperties.DEFAULT_AUTOSAVE_INTERVAL); autosaveBox.setSelectedItem((autosavePref / 60)); autosaveBox.addItemListener(new AutosaveTimeListener()); autosaveBox.setRenderer(new AutosaveTimeRenderer()); JPanel jpanel4 = new JPanel(new FlowLayout(FlowLayout.LEFT)); jpanel4.add(autosaveBox); jpanel4.setBorder(BorderFactory.createTitledBorder("Autosave Sessions")); final PhonUIAction backupAct = new PhonUIAction(this, "toggleBackupWhenSave"); backupAct.putValue(PhonUIAction.NAME, "Backup session file to <project>" + File.separator + "backups.zip when saving sessions."); backupAct.putValue(PhonUIAction.SELECTED_KEY, PrefHelper.getBoolean(SessionEditor.BACKUP_WHEN_SAVING, true)); backupWhenSaveBox = new JCheckBox(backupAct); JPanel jpanel5 = new JPanel(new FlowLayout(FlowLayout.LEFT)); jpanel5.add(backupWhenSaveBox); jpanel5.setBorder(BorderFactory.createTitledBorder("Backup Sessions")); JPanel innerPanel = new JPanel(); FormLayout layout = new FormLayout("fill:pref:grow", "pref, pref, pref, pref, pref"); innerPanel.setLayout(layout); innerPanel.add(jpanel1, cc.xy(1, 1)); innerPanel.add(jpanel2, cc.xy(1, 2)); innerPanel.add(jpanel4, cc.xy(1, 4)); innerPanel.add(jpanel5, cc.xy(1, 5)); setLayout(new BorderLayout()); JScrollPane innerScroller = new JScrollPane(innerPanel); add(innerScroller, BorderLayout.CENTER); }
From source file:ca.phon.app.prefs.GeneralPrefsPanel.java
License:Open Source License
private void init() { CellConstraints cc = new CellConstraints(); // update checking boolean doCheckUpdate = PrefHelper.getBoolean(checkForUpdateAtStartupProp, true); JCheckBox checkForUpdatesBox = new JCheckBox("Check for updates when application starts"); checkForUpdatesBox.setSelected(doCheckUpdate); checkForUpdatesBox.addChangeListener(new ChangeListener() { @Override//from w w w . ja va 2s. c o m public void stateChanged(ChangeEvent e) { JCheckBox box = (JCheckBox) e.getSource(); boolean doCheckUpdate = box.isSelected(); PrefHelper.getUserPreferences().putBoolean(checkForUpdateAtStartupProp, doCheckUpdate); } }); JPanel updatesPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); FormLayout layout = new FormLayout("fill:pref:grow", "pref, pref"); JPanel innerPanel = new JPanel(layout); updatesPanel.add(checkForUpdatesBox); updatesPanel.setBorder(BorderFactory.createTitledBorder("Program Updates")); innerPanel.add(updatesPanel, cc.xy(1, 1)); // info messages PhonUIAction resetInfoMessagesAct = new PhonUIAction(this, "onResetInfoMessages"); resetInfoMessagesAct.putValue(Action.NAME, "Reset Information Messages"); JButton resetInfoMessagesBtn = new JButton(resetInfoMessagesAct); JPanel resetPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); resetPanel.add(resetInfoMessagesBtn); resetPanel.setBorder(BorderFactory.createTitledBorder("Information Messages")); innerPanel.add(resetPanel, cc.xy(1, 2)); // UI theme JScrollPane innerScroller = new JScrollPane(innerPanel); setLayout(new BorderLayout()); add(innerScroller, BorderLayout.CENTER); }
From source file:ca.phon.app.prefs.MediaPrefsPanel.java
License:Open Source License
private void init() { List<String> mediaPaths = MediaLocator.getMediaIncludePaths(); pathListPanel = new PathListPanel(mediaPaths); pathListPanel.addPropertyChangeListener(PathListPanel.PATH_LIST_CHANGED_PROP, new PropertyChangeListener() { @Override//from w ww .j a v a2 s.com public void propertyChange(PropertyChangeEvent evt) { MediaLocator.setMediaIncludePaths(pathListPanel.getPaths()); } }); String mediaLblTxt = "<html>" + "<p>The default location for media is the project's __res/media folder.<br>" + "Phon will search the default media folder followed by the paths listed below if the<br> full path to media is not specified in Session Information.</p>" + "" + "</html>"; JPanel mediaPathPanel = new JPanel(new BorderLayout()); mediaPathPanel.add(new JLabel(mediaLblTxt), BorderLayout.NORTH); mediaPathPanel.add(pathListPanel); mediaPathPanel.setBorder(BorderFactory.createTitledBorder("Media Folders")); FormLayout layout = new FormLayout("fill:pref:grow", "pref"); CellConstraints cc = new CellConstraints(); setLayout(layout); add(mediaPathPanel, cc.xy(1, 1)); }
From source file:ca.phon.app.prefs.PathListPanel.java
License:Open Source License
private void init() { setLayout(new BorderLayout()); FormLayout layout = new FormLayout("fill:pref:grow, pref, pref, pref", "pref, pref, pref, pref, fill:pref:grow"); CellConstraints cc = new CellConstraints(); setLayout(layout);//from www .j a va 2s . c o m pathList = new JList(new PathListModel()); pathList.setVisibleRowCount(6); JScrollPane pathScroller = new JScrollPane(pathList); add(pathScroller, cc.xywh(1, 2, 3, 4)); add(getMoveUpButton(), cc.xy(4, 2)); add(getMoveDownButton(), cc.xy(4, 3)); add(getRemovePathButton(), cc.xy(2, 1)); add(getAddPathButton(), cc.xy(3, 1)); }
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);/*from ww w . j a va 2s .c o m*/ 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); }