protected void setLayout(final Editor editor, boolean activateErrorPanel, boolean isLoading) { if (progressBar == null) { progressBar = new JProgressBar(); progressBar.setVisible(false); createComponents(); buildErrorPanel(); loaderLabel = new JLabel(Toolkit.getLibIcon("manager/loader.gif")); loaderLabel.setOpaque(false); loaderLabel.setBackground(Color.WHITE); } int scrollBarWidth = contributionListPanel.scrollPane.getVerticalScrollBar().getPreferredSize().width; GroupLayout layout = new GroupLayout(this); setLayout(layout); // layout.setAutoCreateContainerGaps(true); // layout.setAutoCreateGaps(true); layout.setHorizontalGroup( layout .createParallelGroup(GroupLayout.Alignment.CENTER) .addGroup( layout .createSequentialGroup() .addGap(ContributionManagerDialog.STATUS_WIDTH) .addComponent( filterField, ContributionManagerDialog.FILTER_WIDTH, ContributionManagerDialog.FILTER_WIDTH, ContributionManagerDialog.FILTER_WIDTH) // .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addPreferredGap( LayoutStyle.ComponentPlacement.RELATED, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) .addComponent( categoryChooser, ContributionManagerDialog.AUTHOR_WIDTH, ContributionManagerDialog.AUTHOR_WIDTH, ContributionManagerDialog.AUTHOR_WIDTH) .addGap(scrollBarWidth)) .addComponent(loaderLabel) .addComponent(contributionListPanel) .addComponent(errorPanel) .addComponent(statusPanel)); layout.setVerticalGroup( layout .createSequentialGroup() .addContainerGap() .addGroup( layout .createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(categoryChooser) .addComponent(filterField)) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addGroup( layout .createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(loaderLabel) .addComponent(contributionListPanel)) .addComponent(errorPanel) .addComponent( statusPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)); layout.linkSize(SwingConstants.VERTICAL, categoryChooser, filterField); // these will occupy space even if not visible layout.setHonorsVisibility(contributionListPanel, false); layout.setHonorsVisibility(categoryChooser, false); setBackground(Color.WHITE); setBorder(null); }
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents DefaultComponentFactory compFactory = DefaultComponentFactory.getInstance(); _tabPane = new JTabbedPane(); JPanel paneCapture = new JPanel(); _txtHotkey = new JTextField(); _lblHotkey = new JLabel(); _lblDelay = new JLabel(); _spnDelay = new JSpinner(); _lblDelaySecs = new JLabel(); _lblNaming = new JLabel(); _radTimestamp = new JRadioButton(); _radOCR = new JRadioButton(); _radOff = new JRadioButton(); _paneTextEditing = new JPanel(); _chkExpandTab = new JCheckBox(); _lblTabWidth = new JLabel(); _cmbFontName = new JComboBox(); _lblFont = new JLabel(); _titleAppearance = compFactory.createTitle(""); _titleIndentation = compFactory.createTitle(""); _spnTabWidth = new JSpinner(); _lblFontSize = new JLabel(); _spnFontSize = new JSpinner(); JPanel paneGeneral = new JPanel(); _chkAutoUpdate = new JCheckBox(); _cmbLang = new JComboBox(); _lblUpdates = new JLabel(); _lblLanguage = new JLabel(); JPanel paneOkCancel = new JPanel(); JPanel hSpacer1 = new JPanel(null); _btnOk = new JButton(); _btnApply = new JButton(); _btnCancel = new JButton(); // ======== this ======== Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); // ======== _tabPane ======== { _tabPane.setBorder(new EmptyBorder(10, 10, 0, 10)); // ======== paneCapture ======== { // ---- _txtHotkey ---- _txtHotkey.setHorizontalAlignment(SwingConstants.RIGHT); _txtHotkey.addFocusListener( new FocusAdapter() { @Override public void focusGained(FocusEvent e) { txtHotkeyFocusGained(e); } }); _txtHotkey.addKeyListener( new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { txtHotkeyKeyPressed(e); } }); // ---- _lblHotkey ---- _lblHotkey.setLabelFor(_txtHotkey); // ---- _lblDelay ---- _lblDelay.setLabelFor(_spnDelay); // ---- _spnDelay ---- _spnDelay.setModel(new SpinnerNumberModel(1.0, 0.0, null, 0.1)); // ---- _radTimestamp ---- _radTimestamp.setSelected(true); GroupLayout paneCaptureLayout = new GroupLayout(paneCapture); paneCapture.setLayout(paneCaptureLayout); paneCaptureLayout.setHorizontalGroup( paneCaptureLayout .createParallelGroup() .add( paneCaptureLayout .createSequentialGroup() .add(26, 26, 26) .add( paneCaptureLayout .createParallelGroup() .add(GroupLayout.TRAILING, _lblDelay) .add(GroupLayout.TRAILING, _lblHotkey) .add(GroupLayout.TRAILING, _lblNaming)) .addPreferredGap(LayoutStyle.RELATED) .add( paneCaptureLayout .createParallelGroup() .add(_radTimestamp) .add(_radOCR) .add(_radOff) .add( paneCaptureLayout .createSequentialGroup() .add( _spnDelay, GroupLayout.DEFAULT_SIZE, 148, Short.MAX_VALUE) .addPreferredGap(LayoutStyle.RELATED) .add( _lblDelaySecs, GroupLayout.DEFAULT_SIZE, 161, Short.MAX_VALUE)) .add(_txtHotkey, GroupLayout.DEFAULT_SIZE, 315, Short.MAX_VALUE)) .add(69, 69, 69))); paneCaptureLayout.setVerticalGroup( paneCaptureLayout .createParallelGroup() .add( paneCaptureLayout .createSequentialGroup() .add(34, 34, 34) .add( paneCaptureLayout .createParallelGroup(GroupLayout.BASELINE) .add( _lblHotkey, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE) .add( _txtHotkey, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.RELATED) .add( paneCaptureLayout .createParallelGroup() .add( _lblDelay, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE) .add( _spnDelay, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .add( _lblDelaySecs, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.RELATED) .add( paneCaptureLayout .createParallelGroup(GroupLayout.LEADING, false) .add( paneCaptureLayout .createSequentialGroup() .add( paneCaptureLayout .createParallelGroup(GroupLayout.BASELINE) .add( _lblNaming, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE) .add(_radTimestamp)) .add(18, 18, 18) .add(_radOff) .addPreferredGap(LayoutStyle.RELATED)) .add( GroupLayout.TRAILING, paneCaptureLayout .createSequentialGroup() .add(_radOCR) .add(21, 21, 21))) .add(80, 80, 80))); } _tabPane.addTab(I18N._I("prefTabScreenCapturing"), paneCapture); // ======== _paneTextEditing ======== { // ---- _lblTabWidth ---- _lblTabWidth.setLabelFor(_spnTabWidth); // ---- _cmbFontName ---- _cmbFontName.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { fontNameItemStateChanged(e); } }); // ---- _lblFont ---- _lblFont.setLabelFor(_cmbFontName); // ---- _lblFontSize ---- _lblFontSize.setLabelFor(_cmbFontName); // ---- _spnFontSize ---- _spnFontSize.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { fontSizeStateChanged(e); } }); GroupLayout _paneTextEditingLayout = new GroupLayout(_paneTextEditing); _paneTextEditing.setLayout(_paneTextEditingLayout); _paneTextEditingLayout.setHorizontalGroup( _paneTextEditingLayout .createParallelGroup() .add( GroupLayout.TRAILING, _paneTextEditingLayout .createSequentialGroup() .add(95, 95, 95) .add( _paneTextEditingLayout .createParallelGroup() .add( _titleIndentation, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .add( _paneTextEditingLayout .createSequentialGroup() .add( _titleAppearance, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.RELATED) .add( _paneTextEditingLayout .createParallelGroup() .add( _paneTextEditingLayout .createSequentialGroup() .add(29, 29, 29) .add( _paneTextEditingLayout .createParallelGroup() .add( GroupLayout.TRAILING, _lblTabWidth) .add(GroupLayout.TRAILING, _lblFont) .add( GroupLayout.TRAILING, _lblFontSize)) .addPreferredGap(LayoutStyle.RELATED) .add( _paneTextEditingLayout .createParallelGroup() .add( _cmbFontName, 0, 218, Short.MAX_VALUE) .add( _spnFontSize, GroupLayout.PREFERRED_SIZE, 67, GroupLayout.PREFERRED_SIZE) .add( _spnTabWidth, GroupLayout.PREFERRED_SIZE, 52, GroupLayout.PREFERRED_SIZE)) .addPreferredGap( LayoutStyle.RELATED, 97, Short.MAX_VALUE)) .add( _chkExpandTab, GroupLayout.DEFAULT_SIZE, 420, Short.MAX_VALUE)))) .addContainerGap())); _paneTextEditingLayout.setVerticalGroup( _paneTextEditingLayout .createParallelGroup() .add( _paneTextEditingLayout .createSequentialGroup() .add(21, 21, 21) .add( _titleIndentation, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .add( _paneTextEditingLayout .createParallelGroup() .add( _paneTextEditingLayout .createSequentialGroup() .add(81, 81, 81) .add( _titleAppearance, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .add( _paneTextEditingLayout .createSequentialGroup() .addPreferredGap(LayoutStyle.RELATED) .add(_chkExpandTab) .addPreferredGap(LayoutStyle.RELATED) .add( _paneTextEditingLayout .createParallelGroup() .add( _lblTabWidth, GroupLayout.PREFERRED_SIZE, 16, GroupLayout.PREFERRED_SIZE) .add( _spnTabWidth, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .add(40, 40, 40) .add( _paneTextEditingLayout .createParallelGroup(GroupLayout.BASELINE) .add(_lblFont) .add( _cmbFontName, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.RELATED) .add( _paneTextEditingLayout .createParallelGroup(GroupLayout.TRAILING) .add( _lblFontSize, GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE) .add( _spnFontSize, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))) .addContainerGap(154, Short.MAX_VALUE))); _paneTextEditingLayout.linkSize( new Component[] {_lblTabWidth, _spnTabWidth}, GroupLayout.VERTICAL); _paneTextEditingLayout.linkSize( new Component[] {_cmbFontName, _lblFont}, GroupLayout.VERTICAL); } _tabPane.addTab(I18N._I("PreferencesWin.paneTextEditing.tab.title"), _paneTextEditing); // ======== paneGeneral ======== { // ---- _lblUpdates ---- _lblUpdates.setFont( _lblUpdates.getFont().deriveFont(_lblUpdates.getFont().getStyle() | Font.BOLD)); // ---- _lblLanguage ---- _lblLanguage.setFont( _lblLanguage.getFont().deriveFont(_lblLanguage.getFont().getStyle() | Font.BOLD)); GroupLayout paneGeneralLayout = new GroupLayout(paneGeneral); paneGeneral.setLayout(paneGeneralLayout); paneGeneralLayout.setHorizontalGroup( paneGeneralLayout .createParallelGroup() .add( paneGeneralLayout .createSequentialGroup() .add(137, 137, 137) .add( paneGeneralLayout .createParallelGroup() .add( paneGeneralLayout .createSequentialGroup() .add(_lblLanguage) .add(185, 185, 185)) .add( paneGeneralLayout .createSequentialGroup() .add(38, 38, 38) .add( _cmbLang, GroupLayout.PREFERRED_SIZE, 215, GroupLayout.PREFERRED_SIZE)) .add( paneGeneralLayout .createSequentialGroup() .add(_lblUpdates) .add(318, 318, 318)) .add( GroupLayout.TRAILING, paneGeneralLayout .createSequentialGroup() .add(38, 38, 38) .add( _chkAutoUpdate, GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE))) .addContainerGap())); paneGeneralLayout.setVerticalGroup( paneGeneralLayout .createParallelGroup() .add( paneGeneralLayout .createSequentialGroup() .add(26, 26, 26) .add(_lblUpdates) .addPreferredGap(LayoutStyle.RELATED) .add(_chkAutoUpdate) .add(40, 40, 40) .add(_lblLanguage) .addPreferredGap(LayoutStyle.RELATED) .add( _cmbLang, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addContainerGap(196, Short.MAX_VALUE))); } _tabPane.addTab(I18N._I("prefTabGeneralSettings"), paneGeneral); } contentPane.add(_tabPane, BorderLayout.CENTER); // ======== paneOkCancel ======== { paneOkCancel.setBorder(new EmptyBorder(5, 5, 5, 5)); paneOkCancel.setLayout(new BoxLayout(paneOkCancel, BoxLayout.X_AXIS)); paneOkCancel.add(hSpacer1); // ---- _btnOk ---- _btnOk.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { btnOkActionPerformed(e); } }); paneOkCancel.add(_btnOk); // ---- _btnCancel ---- _btnCancel.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { btnCancelActionPerformed(e); } }); paneOkCancel.add(_btnCancel); // ---- _btnApply ---- _btnApply.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { btnApplyActionPerformed(e); } }); paneOkCancel.add(_btnApply); } contentPane.add(paneOkCancel, BorderLayout.SOUTH); setSize(600, 475); setLocationRelativeTo(getOwner()); // ---- btngrpNaming ---- ButtonGroup btngrpNaming = new ButtonGroup(); btngrpNaming.add(_radTimestamp); btngrpNaming.add(_radOCR); btngrpNaming.add(_radOff); initComponentsI18n(); // JFormDesigner - End of component initialization //GEN-END:initComponents }