List of usage examples for javax.swing ScrollPaneConstants VERTICAL_SCROLLBAR_AS_NEEDED
int VERTICAL_SCROLLBAR_AS_NEEDED
To view the source code for javax.swing ScrollPaneConstants VERTICAL_SCROLLBAR_AS_NEEDED.
Click Source Link
From source file:org.nuclos.client.dbtransfer.DBTransferImport.java
private PanelWizardStep newStep3(final MainFrameTab ifrm) { final SpringLocaleDelegate localeDelegate = getSpringLocaleDelegate(); final PanelWizardStep step = new PanelWizardStep( localeDelegate.getMessage("dbtransfer.import.step3.1", "System Parameter"), localeDelegate.getMessage("dbtransfer.import.step3.2", "Bestimmen Sie die Parameter dieses Systems. Sie k\u00f6nnen w\u00e4hlen zwischen dem aktuellen Zustand und dem aus der Konfigurationsdatei importierten Zustand (default). Sollte keine der beiden Vorgaben stimmen, so k\u00f6nnen Sie auch einen anderen Wert setzen.")) { @Override/*from w w w. j av a2 s . c om*/ public void prepare() { setupParameterPanel(importTransferObject.getParameter()); } @Override public void applyState() throws InvalidStateException { setSelectedIncomingParameter.clear(); setSelectedCurrentParameter.clear(); mapSelectedOtherParameter.clear(); for (ParameterEditor pe : lstParameterEditors) { if (pe.isCurrentValue()) setSelectedCurrentParameter.add(pe.getName()); if (pe.isIncomingValue()) setSelectedIncomingParameter.add(pe.getName()); if (pe.isOtherValue()) mapSelectedOtherParameter.put(pe.getName(), pe.getValue()); } } }; step.setComplete(true); utils.initJPanel(step, new double[] { TableLayout.FILL }, new double[] { TableLayout.PREFERRED, TableLayout.FILL, TableLayout.PREFERRED }); rbCurrentAll.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { resetParameterEditors(true); } }); rbIncomingAll.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { resetParameterEditors(false); } }); final JScrollPane scroll = new JScrollPane(jpnParameter); scroll.setPreferredSize(new Dimension(680, 250)); scroll.setBorder(new LineBorder(Color.LIGHT_GRAY, 1)); scroll.getVerticalScrollBar().setUnitIncrement(20); scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); scroll.getViewport().addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { Dimension parameterPanelSize = new Dimension(scroll.getViewport().getWidth(), jpnParameter.getPreferredSize().height); jpnParameter.setPreferredSize(parameterPanelSize); } }); step.add(jpnParameterHeader, "0,0"); step.add(scroll, "0,1"); step.add(jpnParameterFooter, "0,2"); return step; }
From source file:org.pentaho.reporting.engine.classic.core.modules.gui.base.PreviewParametersDialog.java
private JScrollPane createParametersPanel() { parametersPanel = new ParameterReportControllerPane(); try {/*w w w . j a va2 s.co m*/ parametersPanel.setReport(masterReport); } catch (ReportProcessingException e) { parametersPanel.setErrorMessage(e.getMessage()); logger.error("Failed to query parameters", e); // NON-NLS } parametersPanel.hideControls(); final JPanel carrierPanel = new JPanel(new BorderLayout()); carrierPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); carrierPanel.add(parametersPanel, BorderLayout.NORTH); final JScrollPane result = new JScrollPane(carrierPanel); result.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); return result; }
From source file:org.pentaho.reporting.tools.configeditor.ConfigDescriptionEditor.java
/** * Creates and returns the entry list component that will hold all config description entries within a list. * * @return the created entry list./* ww w . ja va2 s.com*/ */ private JPanel createEntryList() { final Action addEntryAction = new AddEntryAction(); final Action removeEntryAction = new RemoveEntryAction(); model = new ConfigDescriptionModel(); entryList = new JList(model); entryList.addListSelectionListener(new ConfigListSelectionListener()); final JToolBar toolbar = new JToolBar(); toolbar.setFloatable(false); toolbar.add(addEntryAction); toolbar.add(removeEntryAction); final JPanel panel = new JPanel(); panel.setMinimumSize(new Dimension(200, 0)); panel.setLayout(new BorderLayout()); panel.add(toolbar, BorderLayout.NORTH); panel.add(new JScrollPane(entryList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER); return panel; }
From source file:org.photovault.swingui.PhotoViewController.java
/** * Sets up the window layout so that the collection is displayed as one vertical * column with preview image on right/* w w w. jav a 2 s. co m*/ */ private void setupLayoutPreviewWithVerticalIcons() { // Minimum size is the size of one thumbnail int thumbColWidth = thumbPane.getColumnWidth(); int thumbRowHeight = thumbPane.getRowHeight(); scrollLayer.setMinimumSize(new Dimension(thumbColWidth + 20, thumbRowHeight)); scrollLayer.setPreferredSize(new Dimension(thumbColWidth + 20, thumbRowHeight)); thumbScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); thumbScroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); scrollLayer.setVisible(true); thumbPane.setColumnCount(1); previewPane.setVisible(true); layeredPane.removeAll(); layeredPane.setVisible(false); splitPane.setVisible(true); splitPane.remove(previewPane); splitPane.remove(scrollLayer); splitPane.setOrientation(JSplitPane.HORIZONTAL_SPLIT); splitPane.setLeftComponent(scrollLayer); splitPane.setRightComponent(previewPane); // Left component should not be resized splitPane.setResizeWeight(0.0); Dimension minThumbDim = thumbPane.getMinimumSize(); scrollLayer.setMinimumSize(new Dimension((int) minThumbDim.getWidth(), 0)); previewPane.setMinimumSize(new Dimension(splitPane.getWidth() - 250 - splitPane.getInsets().left, 0)); splitPane.validate(); getView().validate(); }
From source file:org.photovault.swingui.PhotoViewController.java
/** Hide the preview pane/*w ww . ja v a2s . c o m*/ */ private void setupLayoutNoPreview() { // Minimum size is the size of one thumbnail thumbScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); thumbScroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); int thumbColWidth = thumbPane.getColumnWidth(); int thumbRowHeight = thumbPane.getRowHeight(); splitPane.setVisible(false); layeredPane.setVisible(true); scrollLayer.setMinimumSize(new Dimension(thumbColWidth, thumbRowHeight + 50)); scrollLayer.setVisible(true); thumbPane.setRowCount(-1); thumbPane.setColumnCount(-1); splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); splitPane.remove(previewPane); splitPane.remove(scrollLayer); layeredPane.add(scrollLayer, new Integer(1)); layeredPane.add(previewPane, new Integer(2)); previewPane.setVisible(false); thumbScroll.setVisible(true); getView().validate(); }
From source file:org.revager.tools.GUITools.java
/** * Sets the given text area into a scroll pane. * // ww w . j a v a2 s. c om * @param txt * the text area * * @return the scroll pane */ public static JScrollPane setIntoScrllPn(JTextArea txt) { txt.setLineWrap(true); txt.setWrapStyleWord(true); return new JScrollPane(txt, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); }
From source file:org.stanwood.swing.AboutDialog.java
private JComponent createAuthorsTab() { JScrollPane scroll = new JScrollPane(); scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); Box box = Box.createVerticalBox(); box.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); for (Author author : authors) { box.add(new JLabel(author.getName())); JXHyperlink link = new JXHyperlink( new LinkAction(this, author.getEmail(), "mailto:" + author.getEmail())); box.add(link);/* www. jav a 2 s .c om*/ link.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); JLabel lblDescription = new JLabel(author.getDescription()); lblDescription.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); box.add(lblDescription); } scroll.getViewport().add(box); return scroll; }
From source file:org.stanwood.swing.AboutDialog.java
private JComponent createAboutTab() { JScrollPane scroll = new JScrollPane(); scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); Box box = Box.createVerticalBox(); box.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); box.add(Box.createVerticalGlue()); if (message != null) { JXLabel lblMessage = new JXLabel(message); lblMessage.setLineWrap(true);/*from ww w . j a v a 2 s . c om*/ box.add(lblMessage); } if (appUrl != null) { JXHyperlink link = new JXHyperlink(new LinkAction(this, appUrl, appUrl)); box.add(link); } box.add(Box.createVerticalGlue()); scroll.getViewport().add(box); return scroll; }
From source file:pcgen.gui2.tabs.bio.BiographyInfoPane.java
private void initComponents() { setLayout(new GridBagLayout()); Box vbox = Box.createVerticalBox(); allButton.setText(LanguageBundle.getString("in_all")); //$NON-NLS-1$ allButton.setActionCommand(ALL_COMMAND); noneButton.setText(LanguageBundle.getString("in_none")); //$NON-NLS-1$ noneButton.setActionCommand(NONE_COMMAND); Box hbox = Box.createHorizontalBox(); hbox.add(new JLabel(LanguageBundle.getString("in_descCheckItem"))); //$NON-NLS-1$ hbox.add(Box.createRigidArea(new Dimension(5, 0))); hbox.add(allButton);// w w w . j av a 2 s.c o m hbox.add(Box.createRigidArea(new Dimension(3, 0))); hbox.add(noneButton); vbox.add(hbox); itemsPanel.setLayout(new GridBagLayout()); itemsPanel.setBorder(new EmptyBorder(8, 5, 8, 5)); vbox.add(Box.createVerticalStrut(10)); detailsScroll = new JScrollPane(itemsPanel); detailsScroll.setPreferredSize(detailsScroll.getMaximumSize()); detailsScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); detailsScroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); detailsScroll.setMinimumSize(new Dimension(600, 0)); vbox.add(detailsScroll); vbox.add(Box.createVerticalStrut(10)); hbox = Box.createHorizontalBox(); hbox.add(Box.createHorizontalGlue()); addCustomItemButton = new JButton(); hbox.add(addCustomItemButton); hbox.add(Box.createHorizontalGlue()); vbox.add(hbox); vbox.add(Box.createVerticalGlue()); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.NORTHWEST; gbc.weightx = 1; gbc.fill = GridBagConstraints.VERTICAL; gbc.weighty = 1; gbc.insets = new Insets(5, 5, 5, 5); add(vbox, gbc); }
From source file:pcgen.gui2.tabs.SummaryInfoTab.java
private void initMiddlePanel(JPanel middlePanel) { middlePanel.setLayout(new GridLayout(2, 1)); JPanel statsPanel = new JPanel(); setPanelTitle(statsPanel, LanguageBundle.getString("in_sumAbilityScores")); //$NON-NLS-1$ statsPanel.setLayout(new BoxLayout(statsPanel, BoxLayout.Y_AXIS)); StatTableModel.initializeTable(statsTable); JScrollPane pane = new JScrollPane(statsTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER) { @Override/*w w w . j av a 2 s. c o m*/ public Dimension getMaximumSize() { //This prevents the scroll pane from taking up more space than it needs. return super.getPreferredSize(); } }; pane.setBorder(BorderFactory.createEmptyBorder()); JPanel statsBox = new JPanel(); statsBox.setLayout(new BoxLayout(statsBox, BoxLayout.X_AXIS)); statsBox.add(Box.createHorizontalGlue()); statsBox.add(pane); statsBox.add(Box.createHorizontalGlue()); statsPanel.add(statsBox); JPanel statTotalPanel = new JPanel(); statTotalPanel.setLayout(new BoxLayout(statTotalPanel, BoxLayout.X_AXIS)); //this makes box layout use the statTotalPanel to distribute extra space statTotalPanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE)); statTotalPanel.add(Box.createHorizontalGlue()); FontManipulation.title(statTotalLabel); statTotalPanel.add(statTotalLabel); statTotalPanel.add(statTotal); FontManipulation.title(modTotalLabel); statTotalPanel.add(modTotalLabel); statTotalPanel.add(modTotal); statTotalPanel.add(Box.createHorizontalGlue()); generateRollsButton.setText(LanguageBundle.getString("in_sumGenerate_Rolls")); //$NON-NLS-1$ statTotalPanel.add(generateRollsButton); rollMethodButton.setText(LanguageBundle.getString("in_sumRoll_Method")); //$NON-NLS-1$ statTotalPanel.add(Box.createRigidArea(new Dimension(5, 0))); statTotalPanel.add(rollMethodButton); statTotalPanel.add(Box.createHorizontalGlue()); statsPanel.add(statTotalPanel); middlePanel.add(statsPanel); InfoPaneHandler.initializeEditorPane(infoPane); pane = new JScrollPane(infoPane); setPanelTitle(pane, LanguageBundle.getString("in_sumStats")); //$NON-NLS-1$ middlePanel.add(pane); }