List of usage examples for javax.swing JScrollPane setAutoscrolls
@BeanProperty(bound = false, expert = true, description = "Determines if this component automatically scrolls its contents when dragged.") public void setAutoscrolls(boolean autoscrolls)
autoscrolls
property. From source file:Main.java
/** * Creates a new <code>JScrollPane</code> object with the given properties. * * @param list The list of the scroll pane * @return A <code>JScrollPane</code> object */// w ww . ja v a 2 s . co m public static JScrollPane createJScrollPane(JList list) { JScrollPane jScrollPane = new JScrollPane(); jScrollPane.setViewportView(list); jScrollPane.setAutoscrolls(true); return jScrollPane; }
From source file:net.sf.xmm.moviemanager.gui.DialogIMDB.java
JPanel createMoviehitsList() { /* Movies List panel...*/ JPanel panelMoviesList = new JPanel(); panelMoviesList.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), Localizer.get("DialogIMDB.panel-movie-list.title")), //$NON-NLS-1$ BorderFactory.createEmptyBorder(5, 5, 5, 5))); listMovies = new JList() { public String getToolTipText(MouseEvent e) { if (getCellBounds(0, 0) == null) return null; String retVal = null; int row = (int) e.getPoint().getY() / (int) getCellBounds(0, 0).getHeight(); if (row >= 0 && row < getModel().getSize() && getMoviesList().getModel().getElementAt(row) instanceof ModelIMDbSearchHit) { retVal = ((ModelIMDbSearchHit) getMoviesList().getModel().getElementAt(row)).getAka(); if (retVal != null && retVal.trim().equals("")) //$NON-NLS-1$ retVal = null;/* ww w . j a v a 2 s .co m*/ } return retVal; } public JToolTip createToolTip() { JMultiLineToolTip tooltip = new JMultiLineToolTip(); tooltip.setComponent(this); return tooltip; } }; // Unfortunately setting tooltip timeout affects ALL tooltips ToolTipManager ttm = ToolTipManager.sharedInstance(); ttm.registerComponent(listMovies); ttm.setInitialDelay(0); ttm.setReshowDelay(0); listMovies.setFixedCellHeight(18); listMovies.setFont(new Font(listMovies.getFont().getName(), Font.PLAIN, listMovies.getFont().getSize())); listMovies.setLayoutOrientation(JList.VERTICAL); listMovies.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); listMovies.setCellRenderer(new MovieHitListCellRenderer()); listMovies.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent event) { // Open we page if (SwingUtilities.isRightMouseButton(event)) { int index = listMovies.locationToIndex(event.getPoint()); if (index >= 0) { ModelIMDbSearchHit hit = (ModelIMDbSearchHit) listMovies.getModel().getElementAt(index); if (hit.getUrlID() != null && !hit.getUrlID().equals("")) { BrowserOpener opener = new BrowserOpener(hit.getCompleteUrl()); opener.executeOpenBrowser(MovieManager.getConfig().getSystemWebBrowser(), MovieManager.getConfig().getBrowserPath()); } } } else if (SwingUtilities.isLeftMouseButton(event) && event.getClickCount() >= 2) { buttonSelect.doClick(); } } }); KeyStroke enterKeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, true); ActionListener listKeyBoardActionListener = new ActionListener() { public void actionPerformed(ActionEvent ae) { log.debug("ActionPerformed: " + "Movielist - ENTER pressed."); //$NON-NLS-1$ buttonSelect.doClick(); } }; listMovies.registerKeyboardAction(listKeyBoardActionListener, enterKeyStroke, JComponent.WHEN_FOCUSED); JScrollPane scrollPaneMovies = new JScrollPane(listMovies); scrollPaneMovies.setAutoscrolls(true); //scrollPaneMovies.registerKeyboardAction(listKeyBoardActionListener,enterKeyStroke, JComponent.WHEN_FOCUSED); panelMoviesList.setLayout(new BorderLayout()); panelMoviesList.add(scrollPaneMovies, BorderLayout.CENTER); return panelMoviesList; }
From source file:be.agiv.security.demo.Main.java
private void showException(Exception e) { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append(e.getMessage()); stringBuffer.append("\n"); for (StackTraceElement stackTraceElement : e.getStackTrace()) { stringBuffer.append(stackTraceElement.getClassName()); stringBuffer.append("."); stringBuffer.append(stackTraceElement.getMethodName()); stringBuffer.append(":"); stringBuffer.append(stackTraceElement.getLineNumber()); stringBuffer.append("\n"); }// w w w . ja va 2s . c o m Throwable cause = e.getCause(); while (null != cause) { stringBuffer.append("\n"); stringBuffer.append("Caused by: "); stringBuffer.append(cause.getMessage()); stringBuffer.append(" - "); stringBuffer.append(cause.getClass().getName()); stringBuffer.append("\n"); for (StackTraceElement stackTraceElement : e.getStackTrace()) { stringBuffer.append(stackTraceElement.getClassName()); stringBuffer.append("."); stringBuffer.append(stackTraceElement.getMethodName()); stringBuffer.append(":"); stringBuffer.append(stackTraceElement.getLineNumber()); stringBuffer.append("\n"); } cause = cause.getCause(); } JTextArea textArea = new JTextArea(stringBuffer.toString(), 10, 40); JScrollPane scrollPane = new JScrollPane(textArea); scrollPane.setAutoscrolls(true); JOptionPane.showMessageDialog(this, scrollPane, e.getClass().getSimpleName(), JOptionPane.ERROR_MESSAGE); }
From source file:nl.detoren.ijsco.ui.Mainscreen.java
public JPanel createPanelGroepen() { JPanel panel = new JPanel(); panel.setLayout(new GridLayout(1, 0)); groepenText = new JTextArea(40, 40); groepenText.setBorder(BorderFactory.createLineBorder(Color.BLACK)); groepenText.setFont(new Font("courier new", Font.PLAIN, 12)); groepenText.setLineWrap(false);// w ww.jav a 2 s.c o m if (status.groepen != null) { groepenText.setText(status.groepen.getDescription()); groepenText.setCaretPosition(0); } JScrollPane scrollpane = new JScrollPane(groepenText); scrollpane.setAutoscrolls(true); scrollpane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); panel.add(scrollpane); return panel; }
From source file:org.isatools.isacreator.spreadsheet.Spreadsheet.java
public void instantiateSpreadsheet() { ResourceInjector.get("spreadsheet-package.style").inject(this); observers = new ArrayList<CopyPasteObserver>(); spreadsheetPopups = new SpreadsheetPopupMenus(this); spreadsheetFunctions = new SpreadsheetFunctions(this); columnDependencies = new HashMap<TableColumn, List<TableColumn>>(); Collections.synchronizedMap(columnDependencies); hiddenColumns = new HashSet<String>(); setLayout(new BorderLayout()); createSpreadsheetModel();/* w w w .j a v a2 s. c o m*/ populateSpreadsheetWithContent(); addOntologyTermsToUserHistory(); // assign copy/paste listener new CopyPasteAdaptor(this); JScrollPane pane = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); pane.setBackground(UIHelper.BG_COLOR); pane.setAutoscrolls(true); pane.getViewport().setBackground(UIHelper.BG_COLOR); pane.setBorder(UIHelper.EMPTY_BORDER); IAppWidgetFactory.makeIAppScrollPane(pane); add(pane, BorderLayout.CENTER); createButtonPanel(); addUndoableEditListener(undoManager); }
From source file:org.isatools.isacreatorconfigurator.configui.FieldInterface.java
private void instantiateFields(String initFieldName) { // OVERALL CONTAINER JPanel container = new JPanel(); container.setLayout(new BoxLayout(container, BoxLayout.PAGE_AXIS)); container.setBackground(UIHelper.BG_COLOR); JLabel fieldDefinitionLab = new JLabel(fieldDefinitionHeader, JLabel.CENTER); container.add(fieldDefinitionLab);/*from ww w . j a va 2s. c om*/ container.add(Box.createVerticalStrut(5)); // FIELD LABEL & INPUT BOX CONTAINER JPanel fieldCont = new JPanel(new GridLayout(1, 2)); fieldCont.setBackground(UIHelper.BG_COLOR); fieldName = new RoundedJTextField(15); fieldName.setText(initFieldName); fieldName.setEditable(false); UIHelper.renderComponent(fieldName, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); JLabel fieldNameLab = UIHelper.createLabel("Field Name: ", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); fieldCont.add(fieldNameLab); fieldCont.add(fieldName); container.add(fieldCont); JPanel descCont = new JPanel(new GridLayout(1, 2)); descCont.setBackground(UIHelper.BG_COLOR); description = new RoundedJTextArea(); description.setLineWrap(true); description.setWrapStyleWord(true); UIHelper.renderComponent(description, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); JScrollPane descScroll = new JScrollPane(description, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); descScroll.setBackground(UIHelper.BG_COLOR); descScroll.setPreferredSize(new Dimension(150, 65)); descScroll.getViewport().setBackground(UIHelper.BG_COLOR); IAppWidgetFactory.makeIAppScrollPane(descScroll); JLabel descLab = UIHelper.createLabel("Description: ", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); descLab.setVerticalAlignment(JLabel.TOP); descCont.add(descLab); descCont.add(descScroll); container.add(descCont); // add datatype information JPanel datatypeCont = new JPanel(new GridLayout(1, 2)); datatypeCont.setBackground(UIHelper.BG_COLOR); DataTypes[] allowedDataTypes = initFieldName.equals(UNIT_STR) ? new DataTypes[] { DataTypes.ONTOLOGY_TERM } : DataTypes.values(); datatype = new JComboBox(allowedDataTypes); datatype.addActionListener(this); UIHelper.renderComponent(datatype, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, UIHelper.BG_COLOR); JLabel dataTypeLab = UIHelper.createLabel("Datatype:", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); datatypeCont.add(dataTypeLab); datatypeCont.add(datatype); container.add(datatypeCont); defaultValContStd = new JPanel(new GridLayout(1, 2)); defaultValContStd.setBackground(UIHelper.BG_COLOR); defaultValCont = Box.createHorizontalBox(); defaultValCont.setPreferredSize(new Dimension(150, 25)); defaultValStd = new RoundedFormattedTextField(null, UIHelper.TRANSPARENT_LIGHT_GREEN_COLOR, UIHelper.DARK_GREEN_COLOR); defaultValCont.setPreferredSize(new Dimension(120, 25)); defaultValStd.setFormatterFactory(new DefaultFormatterFactory( new RegExFormatter(".*", defaultValStd, false, UIHelper.DARK_GREEN_COLOR, UIHelper.RED_COLOR, UIHelper.TRANSPARENT_LIGHT_GREEN_COLOR, UIHelper.TRANSPARENT_LIGHT_GREEN_COLOR))); defaultValStd.setForeground(UIHelper.DARK_GREEN_COLOR); defaultValStd.setFont(UIHelper.VER_11_PLAIN); defaultValCont.add(defaultValStd); defaultValLabStd = UIHelper.createLabel(DEFAULT_VAL_STR, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); defaultValContStd.add(defaultValLabStd); defaultValContStd.add(defaultValCont); container.add(defaultValContStd); defaultValContBool = new JPanel(new GridLayout(1, 2)); defaultValContBool.setBackground(UIHelper.BG_COLOR); defaultValContBool.setVisible(false); listDataSourceCont = new JPanel(new GridLayout(2, 1)); listDataSourceCont.setBackground(UIHelper.BG_COLOR); listDataSourceCont.setVisible(false); JLabel listValLab = UIHelper.createLabel("Please enter comma separated list of values:", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); listDataSourceCont.add(listValLab); listValues = new RoundedJTextArea("SampleVal1, SampleVal2, SampleVal3", 3, 5); listValues.setLineWrap(true); listValues.setWrapStyleWord(true); UIHelper.renderComponent(listValues, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); JScrollPane listScroll = new JScrollPane(listValues, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); listScroll.setBackground(UIHelper.BG_COLOR); listScroll.getViewport().setBackground(UIHelper.BG_COLOR); listDataSourceCont.add(listScroll); container.add(listDataSourceCont); IAppWidgetFactory.makeIAppScrollPane(listScroll); sourceEntryPanel = new JPanel(new BorderLayout()); sourceEntryPanel.setSize(new Dimension(125, 190)); sourceEntryPanel.setOpaque(false); sourceEntryPanel.setVisible(false); preferredOntologySource = new JPanel(); preferredOntologySource.setLayout(new BoxLayout(preferredOntologySource, BoxLayout.PAGE_AXIS)); preferredOntologySource.setVisible(false); recommendOntologySource = new JCheckBox("Use recommended ontology source?", false); UIHelper.renderComponent(recommendOntologySource, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); recommendOntologySource.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (recommendOntologySource.isSelected()) { sourceEntryPanel.setVisible(true); } else { sourceEntryPanel.setVisible(false); } } }); JPanel useOntologySourceCont = new JPanel(new GridLayout(1, 1)); useOntologySourceCont.add(recommendOntologySource); preferredOntologySource.add(useOntologySourceCont); JPanel infoCont = new JPanel(new GridLayout(1, 1)); JLabel infoLab = UIHelper.createLabel( "<html>click on the <strong>configure ontologies</strong> button to open the ontology configurator to edit the list of ontologies and search areas within an ontology</html>", UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR); infoLab.setPreferredSize(new Dimension(100, 40)); infoCont.add(infoLab); sourceEntryPanel.add(infoCont, BorderLayout.NORTH); JLabel preferredOntologiesLab = new JLabel(preferredOntologiesSidePanelIcon); preferredOntologiesLab.setVerticalAlignment(SwingConstants.TOP); sourceEntryPanel.add(preferredOntologiesLab, BorderLayout.WEST); ontologiesToUseModel = new DefaultTableModel(new String[0][2], ontologyColumnHeaders) { @Override public boolean isCellEditable(int i, int i1) { return false; } }; ontologiesToUse = new JTable(ontologiesToUseModel); ontologiesToUse.getTableHeader().setBackground(UIHelper.BG_COLOR); try { ontologiesToUse.setDefaultRenderer(Class.forName("java.lang.Object"), new CustomSpreadsheetCellRenderer()); } catch (ClassNotFoundException e) { // empty } renderTableHeader(); JScrollPane ontologiesToUseScroller = new JScrollPane(ontologiesToUse, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); ontologiesToUseScroller.setBorder(new EmptyBorder(0, 0, 0, 0)); ontologiesToUseScroller.setPreferredSize(new Dimension(100, 80)); ontologiesToUseScroller.setBackground(UIHelper.BG_COLOR); ontologiesToUseScroller.getViewport().setBackground(UIHelper.BG_COLOR); IAppWidgetFactory.makeIAppScrollPane(ontologiesToUseScroller); sourceEntryPanel.add(ontologiesToUseScroller); JPanel buttonCont = new JPanel(new BorderLayout()); final JLabel openConfigButton = new JLabel(ontologyConfigIcon); openConfigButton.setVerticalAlignment(SwingConstants.TOP); openConfigButton.setHorizontalAlignment(SwingConstants.RIGHT); MouseAdapter showOntologyConfigurator = new MouseAdapter() { public void mouseEntered(MouseEvent mouseEvent) { openConfigButton.setIcon(ontologyConfigIconOver); } public void mouseExited(MouseEvent mouseEvent) { openConfigButton.setIcon(ontologyConfigIcon); } public void mousePressed(MouseEvent mouseEvent) { SwingUtilities.invokeLater(new Runnable() { public void run() { if (openConfigButton.isEnabled()) { openConfigButton.setIcon(ontologyConfigIcon); ontologyConfig = new OntologyConfigUI(ontologiesToQuery, selectedOntologies); ontologyConfig.addPropertyChangeListener("ontologySelected", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent propertyChangeEvent) { selectedOntologies = (ListOrderedMap<String, RecommendedOntology>) propertyChangeEvent .getNewValue(); updateTable(); } }); showPopupInCenter(ontologyConfig); } } }); } }; openConfigButton.addMouseListener(showOntologyConfigurator); buttonCont.add(openConfigButton, BorderLayout.EAST); sourceEntryPanel.add(buttonCont, BorderLayout.SOUTH); preferredOntologySource.add(sourceEntryPanel); container.add(preferredOntologySource); String[] contents = new String[] { "true", "false" }; defaultValBool = new JComboBox(contents); UIHelper.renderComponent(defaultValBool, UIHelper.VER_12_PLAIN, UIHelper.DARK_GREEN_COLOR, UIHelper.BG_COLOR); JLabel defaultValLabBool = UIHelper.createLabel(DEFAULT_VAL_STR, UIHelper.VER_12_BOLD, UIHelper.DARK_GREEN_COLOR); defaultValContBool.add(defaultValLabBool); defaultValContBool.add(defaultValBool); container.add(defaultValContBool); // RegExp data entry isInputFormatted = new JCheckBox("Is the input formatted?", false); isInputFormatted.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); isInputFormatted.setHorizontalAlignment(SwingConstants.LEFT); UIHelper.renderComponent(isInputFormatted, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); isInputFormatted.addActionListener(this); container.add(UIHelper.wrapComponentInPanel(isInputFormatted)); inputFormatCont = new JPanel(); inputFormatCont.setLayout(new BoxLayout(inputFormatCont, BoxLayout.LINE_AXIS)); inputFormatCont.setVisible(false); inputFormatCont.setBackground(UIHelper.BG_COLOR); inputFormat = new RoundedJTextField(10); inputFormat.setText(".*"); inputFormat.setSize(new Dimension(150, 19)); inputFormat.setPreferredSize(new Dimension(160, 25)); inputFormat.setToolTipText("Field expects a regular expression describing the input format."); UIHelper.renderComponent(inputFormat, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); JLabel inputFormatLab = UIHelper.createLabel("Input format:", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); inputFormatLab.setVerticalAlignment(SwingConstants.TOP); inputFormatCont.add(inputFormatLab); inputFormatCont.add(inputFormat); JLabel checkRegExp = new JLabel(checkRegExIcon, JLabel.RIGHT); checkRegExp.setOpaque(false); checkRegExp.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { String regexToCheck = inputFormat.getText(); final CheckRegExGUI regexChecker = new CheckRegExGUI(regexToCheck); SwingUtilities.invokeLater(new Runnable() { public void run() { regexChecker.createGUI(); } }); regexChecker.addPropertyChangeListener("close", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { main.getApplicationContainer().hideSheet(); } }); SwingUtilities.invokeLater(new Runnable() { public void run() { main.getApplicationContainer().showJDialogAsSheet(regexChecker); } }); } } ); inputFormatCont.add(checkRegExp); container.add(inputFormatCont); usesTemplateForWizard = new JCheckBox("Requires template for wizard?", false); usesTemplateForWizard.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); usesTemplateForWizard.setHorizontalAlignment(SwingConstants.LEFT); UIHelper.renderComponent(usesTemplateForWizard, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); usesTemplateForWizard.addActionListener(this); container.add(UIHelper.wrapComponentInPanel(usesTemplateForWizard)); wizardTemplatePanel = new JPanel(new GridLayout(1, 2)); wizardTemplatePanel.setVisible(false); wizardTemplatePanel.setBackground(UIHelper.BG_COLOR); wizardTemplate = new RoundedJTextArea(); wizardTemplate.setToolTipText("A template for the wizard to auto-create the data..."); wizardTemplate.setLineWrap(true); wizardTemplate.setWrapStyleWord(true); UIHelper.renderComponent(wizardTemplate, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); JScrollPane wizScroll = new JScrollPane(wizardTemplate, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); wizScroll.getViewport().setBackground(UIHelper.BG_COLOR); wizScroll.setPreferredSize(new Dimension(70, 60)); IAppWidgetFactory.makeIAppScrollPane(wizScroll); JLabel wizardTemplateLab = UIHelper.createLabel("Template definition:", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); wizardTemplateLab.setVerticalAlignment(JLabel.TOP); wizardTemplatePanel.add(wizardTemplateLab); wizardTemplatePanel.add(wizScroll); container.add(wizardTemplatePanel); JPanel checkCont = new JPanel(new GridLayout(3, 2)); checkCont.setBackground(UIHelper.BG_COLOR); checkCont.setBorder(new TitledBorder(new RoundedBorder(UIHelper.DARK_GREEN_COLOR, 4), "Behavioural Attributes", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR)); required = new JCheckBox("Required ", true); UIHelper.renderComponent(required, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); checkCont.add(required); acceptsMultipleValues = new JCheckBox("Allow multiple instances", false); UIHelper.renderComponent(acceptsMultipleValues, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); checkCont.add(acceptsMultipleValues); acceptsFileLocations = new JCheckBox("Accepts file locations", false); acceptsFileLocations.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { acceptsMultipleValues.setSelected(false); acceptsMultipleValues.setEnabled(!acceptsFileLocations.isSelected()); } }); UIHelper.renderComponent(acceptsFileLocations, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); checkCont.add(acceptsFileLocations); hidden = new JCheckBox("hidden?", false); UIHelper.renderComponent(hidden, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); checkCont.add(hidden); forceOntologySelection = new JCheckBox("Force ontology selection", false); UIHelper.renderComponent(forceOntologySelection, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); checkCont.add(forceOntologySelection); container.add(checkCont); JScrollPane contScroll = new JScrollPane(container, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); contScroll.setBorder(null); contScroll.setAutoscrolls(true); IAppWidgetFactory.makeIAppScrollPane(contScroll); add(contScroll, BorderLayout.NORTH); }
From source file:org.nuxeo.launcher.gui.NuxeoFrame.java
/** * @param logFile//from w w w .j a va2 s. c o m */ protected JComponent buildLogPanel(String logFile) { ColoredTextPane textArea = new ColoredTextPane(); textArea.setEditable(false); textArea.setAutoscrolls(true); textArea.setBackground(new Color(54, 55, 67)); textArea.setMaxSize(LOG_MAX_SIZE); JScrollPane logsScroller = new JScrollPane(textArea); logsScroller.setVisible(true); logsScroller.setBorder(BorderFactory.createLineBorder(Color.BLACK)); logsScroller.setAutoscrolls(true); logsScroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); logsScroller.setWheelScrollingEnabled(true); logsScroller.setPreferredSize(new Dimension(450, 160)); controller.initLogsManagement(logFile, textArea); logsScroller.addComponentListener(new LogsPanelListener(logFile)); return logsScroller; }
From source file:org.ohdsi.whiteRabbit.WhiteRabbitMain.java
private JComponent createConsolePanel() { JTextArea consoleArea = new JTextArea(); consoleArea.setToolTipText("General progress information"); consoleArea.setEditable(false);// w ww . j a v a 2 s.c om Console console = new Console(); console.setTextArea(consoleArea); System.setOut(new PrintStream(console)); System.setErr(new PrintStream(console)); JScrollPane consoleScrollPane = new JScrollPane(consoleArea); consoleScrollPane.setBorder(BorderFactory.createTitledBorder("Console")); consoleScrollPane.setPreferredSize(new Dimension(800, 200)); consoleScrollPane.setAutoscrolls(true); ObjectExchange.console = console; return consoleScrollPane; }