Example usage for javax.swing ScrollPaneConstants HORIZONTAL_SCROLLBAR_NEVER

List of usage examples for javax.swing ScrollPaneConstants HORIZONTAL_SCROLLBAR_NEVER

Introduction

In this page you can find the example usage for javax.swing ScrollPaneConstants HORIZONTAL_SCROLLBAR_NEVER.

Prototype

int HORIZONTAL_SCROLLBAR_NEVER

To view the source code for javax.swing ScrollPaneConstants HORIZONTAL_SCROLLBAR_NEVER.

Click Source Link

Document

Used to set the horizontal scroll bar policy so that horizontal scrollbars are never displayed.

Usage

From source file:org.kuali.test.ui.base.SimpleInputDlg2.java

private void initComponents(String labelTxt, String txt) {
    setTitle(labelTxt);// w  w  w  . ja v a 2 s  .  c om
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(new JLabel(labelTxt + ":"), BorderLayout.NORTH);
    value = new JTextArea();
    value.setWrapStyleWord(true);
    value.setLineWrap(true);

    if (StringUtils.isNotBlank(txt)) {
        value.setText(txt);
    }

    getContentPane().add(new JScrollPane(value, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER), BorderLayout.CENTER);
    addStandardButtons();
    setDefaultBehavior();
}

From source file:org.nebulaframework.ui.swing.node.NodeMainUI.java

/**
 * Setup Job History Tab Pane//from  w ww  .  j  av a 2  s  .c  o  m
 * 
 * @return JPanel for History tab
 */
private JPanel setupHistory() {

    JPanel historyPanel = new JPanel();
    historyPanel.setLayout(new BorderLayout(10, 10));

    /* -- Job List  -- */
    JPanel jobListPanel = new JPanel();
    historyPanel.add(jobListPanel, BorderLayout.CENTER);

    jobListPanel.setLayout(new BorderLayout(10, 10));
    jobListPanel.setBorder(BorderFactory.createTitledBorder("Grid Jobs"));

    final JList jobList = new JList(historyList);
    JScrollPane jobListScroll = new JScrollPane(jobList);
    jobListPanel.add(jobListScroll, BorderLayout.CENTER);
    jobListScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    jobListScroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

    addUIElement("history.joblist", jobList);

    jobList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    jobList.addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {

            // Ignore intermediate events
            if (e.getValueIsAdjusting())
                return;

            displayJobInfo(jobList.getSelectedValue());
        }

    });

    JPanel jobInfoPanel = new JPanel();
    historyPanel.add(jobInfoPanel, BorderLayout.SOUTH);

    jobInfoPanel.setLayout(new BorderLayout(10, 10));
    jobInfoPanel.setBorder(BorderFactory.createTitledBorder("Job Information"));

    JPanel centerPanel = new JPanel();

    jobInfoPanel.add(centerPanel, BorderLayout.CENTER);

    centerPanel.setLayout(new GridLayout(0, 4, 10, 10));

    JLabel jobIdLabel = new JLabel("GridJob ID :");
    centerPanel.add(jobIdLabel);
    JLabel jobId = new JLabel("N/A");
    centerPanel.add(jobId);
    addUIElement("history.jobid", jobId); // Add to components map

    JLabel jobNameLabel = new JLabel("GridJob Name :");
    centerPanel.add(jobNameLabel);
    JLabel jobName = new JLabel("N/A");
    centerPanel.add(jobName);
    addUIElement("history.jobname", jobName); // Add to components map

    JLabel startTimeLabel = new JLabel("Start Time :");
    centerPanel.add(startTimeLabel);
    JLabel startTime = new JLabel("N/A");
    centerPanel.add(startTime);
    addUIElement("history.starttime", startTime); // Add to components map

    JLabel durationLabel = new JLabel("Duration :");
    centerPanel.add(durationLabel);
    JLabel duration = new JLabel("N/A");
    centerPanel.add(duration);
    addUIElement("history.duration", duration); // Add to components map

    JLabel tasksLabel = new JLabel("Tasks Executed :");
    centerPanel.add(tasksLabel);
    JLabel tasks = new JLabel("N/A");
    centerPanel.add(tasks);
    addUIElement("history.tasks", tasks); // Add to components map

    JLabel failuresLabel = new JLabel("Failures :");
    centerPanel.add(failuresLabel);
    JLabel failures = new JLabel("N/A");
    centerPanel.add(failures);
    addUIElement("history.failures", failures); // Add to components map

    // Place Holders
    centerPanel.add(new JLabel());
    centerPanel.add(new JLabel());

    return historyPanel;
}

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/*  w  w w .jav  a 2s.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.tools.configeditor.ConfigDescriptionEditor.java

/**
 * Creates the common entry detail editor. This editor contains all shared properties.
 *
 * @return the common entry editor./*from   ww w  .  j av  a2 s.co  m*/
 */
private JPanel createDetailEditorPanel() {
    final JLabel keyNameLabel = new JLabel(resources.getString("config-description-editor.keyname")); //$NON-NLS-1$
    final JLabel descriptionLabel = new JLabel(resources.getString("config-description-editor.description")); //$NON-NLS-1$
    final JLabel typeLabel = new JLabel(resources.getString("config-description-editor.type")); //$NON-NLS-1$
    final JLabel globalLabel = new JLabel(resources.getString("config-description-editor.global")); //$NON-NLS-1$
    final JLabel hiddenLabel = new JLabel(resources.getString("config-description-editor.hidden")); //$NON-NLS-1$

    hiddenField = new JCheckBox();
    globalField = new JCheckBox();
    final String font = ConfigEditorBoot.getInstance().getGlobalConfig()
            .getConfigProperty(ConfigDescriptionEditor.EDITOR_FONT_KEY, "Monospaced"); //$NON-NLS-1$
    final int fontSize = ParserUtil.parseInt(ConfigEditorBoot.getInstance().getGlobalConfig()
            .getConfigProperty(ConfigDescriptionEditor.EDITOR_FONT_SIZE_KEY), 12);
    descriptionField = new JTextArea();
    descriptionField.setFont(new Font(font, Font.PLAIN, fontSize));
    descriptionField.setLineWrap(true);
    descriptionField.setWrapStyleWord(true);
    keyNameField = new JTextField();

    final JPanel enumerationEditor = createEnumerationEditor();
    final JPanel textEditor = createTextEditor();
    final JPanel classEditor = createClassEditor();

    detailManagerPanel = new JPanel();
    detailManager = new CardLayout();
    detailManagerPanel.setLayout(detailManager);
    detailManagerPanel.add(classEditor, ConfigDescriptionEditor.CLASS_DETAIL_EDITOR_NAME);
    detailManagerPanel.add(textEditor, ConfigDescriptionEditor.TEXT_DETAIL_EDITOR_NAME);
    detailManagerPanel.add(enumerationEditor, ConfigDescriptionEditor.ENUM_DETAIL_EDITOR_NAME);

    final JPanel commonEntryEditorPanel = new JPanel();
    commonEntryEditorPanel.setLayout(new GridBagLayout());
    commonEntryEditorPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.insets = new Insets(3, 1, 1, 1);
    commonEntryEditorPanel.add(keyNameLabel, gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.weightx = 1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(3, 1, 1, 1);
    gbc.ipadx = 120;
    commonEntryEditorPanel.add(keyNameField, gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 1;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.insets = new Insets(3, 1, 1, 1);
    commonEntryEditorPanel.add(descriptionLabel, gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.weightx = 1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(3, 1, 1, 1);
    gbc.ipadx = 120;
    gbc.ipady = 120;
    commonEntryEditorPanel.add(new JScrollPane(descriptionField, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER), gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 2;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.insets = new Insets(3, 1, 1, 1);
    commonEntryEditorPanel.add(globalLabel, gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 2;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.weightx = 1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(3, 1, 1, 1);
    gbc.ipadx = 120;
    commonEntryEditorPanel.add(globalField, gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 3;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.insets = new Insets(3, 1, 1, 1);
    commonEntryEditorPanel.add(hiddenLabel, gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 3;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.weightx = 1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(3, 1, 1, 1);
    gbc.ipadx = 120;
    commonEntryEditorPanel.add(hiddenField, gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 4;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.insets = new Insets(3, 1, 1, 1);
    commonEntryEditorPanel.add(typeLabel, gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 4;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.weightx = 1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(3, 1, 1, 1);
    gbc.ipadx = 120;
    commonEntryEditorPanel.add(createTypeSelectionPane(), gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 5;
    gbc.gridwidth = 2;
    gbc.weighty = 1;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.weightx = 1;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets = new Insets(3, 1, 1, 1);
    gbc.ipadx = 120;
    commonEntryEditorPanel.add(detailManagerPanel, gbc);

    return commonEntryEditorPanel;
}

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  .j  av a2  s.c  o  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//from   w  ww  .j a  v a  2 s.  co 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 ava2 s.co m
 * @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.slage.ui.ConsolePanel.java

/**
 * Creates a new instance of ConsolePanel
 * /*from   w  ww  .  j ava 2 s.com*/
 * @param owningGame Game that owns this console
 */
public ConsolePanel(SlageGame owningGame) {
    this.game = owningGame;

    updateUI();

    textCommand.setBorder(null);

    // Pressing enter in the command sends it and posts it to the scrollback
    textCommand.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (getGame().isPaused())
                return;

            Command command = null;
            try {
                command = getGame().getParser().parseToCommand(textCommand.getText());
            } catch (Exception ex) {
                LOG.debug(ex);
            }

            // give focus to frame for keys
            getGame().getFrame().requestFocusInWindow();

            // blank out box
            textCommand.setText("");

            if (command != null)
                command.fire();
        }
    });

    listScrollback.setCellRenderer(new TextRenderer("Cell Renderer", null, null));

    // double clicking on the scrollback re-fires the command
    listScrollback.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent evt) {
            if (getGame().isPaused())
                return;

            if (evt.getClickCount() == 2 && listScrollback.getSelectedValue() instanceof Command) {
                Command comm = (Command) listScrollback.getSelectedValue();
                comm.fire();
            }
        }
    });

    setLayout(null);

    // set up scrolling for list scrollback
    scrollPane = new JScrollPane(listScrollback);
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

    scrollPane.setWheelScrollingEnabled(true);

    add(scrollPane, BorderLayout.NORTH);
    add(textCommand, BorderLayout.SOUTH);

    resize();

}

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);//  ww w.j  a  v a 2s .c o m
        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  w  w w.j a  v a2 s.  com*/
        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;
}