Example usage for javax.swing JScrollPane getViewport

List of usage examples for javax.swing JScrollPane getViewport

Introduction

In this page you can find the example usage for javax.swing JScrollPane getViewport.

Prototype

public JViewport getViewport() 

Source Link

Document

Returns the current JViewport.

Usage

From source file:org.barcelonamedia.uima.tools.docanalyzer.DBAnnotationViewerDialog.java

/**
 * Create an AnnotationViewer Dialog/*from w  w  w  .  j av a  2  s.c  o m*/
 * 
 * @param aParentFrame
 *          frame containing this panel
 * @param aTitle
 *          title to display for the dialog
 * @param aInputDir
 *          directory containing input files (in XCAS foramt) to read
 * @param aStyleMapFile
 *          filename of style map to be used to view files in HTML
 * @param aPerformanceStats
 *          string representaiton of performance statistics, optional.
 * @param aTypeSystem
 *          the CAS Type System to which the XCAS files must conform.
 * @param aTypesToDisplay
 *          array of types that should be highlighted in the viewer. This can be set to the output
 *          types of the Analysis Engine. A value of null means to display all types.
 */
/*public DBAnnotationViewerDialog(JFrame aParentFrame, String aDialogTitle, DBPrefsMediator med,
  File aStyleMapFile, String aPerformanceStats, TypeSystem aTypeSystem,
  final String[] aTypesToDisplay, String interactiveTempFN, boolean javaViewerRBisSelected,
  boolean javaViewerUCRBisSelected, boolean xmlRBisSelected, CAS cas) {
  super(aParentFrame, aDialogTitle);
  // create the AnnotationViewGenerator (for HTML view generation)
  this.med1 = med;
  this.cas = cas;
  annotationViewGenerator = new AnnotationViewGenerator(tempDir);
        
  launchThatViewer(med.getOutputDir(), interactiveTempFN, aTypeSystem, aTypesToDisplay,
    javaViewerRBisSelected, javaViewerUCRBisSelected, xmlRBisSelected, aStyleMapFile,
    tempDir);
}*/

public DBAnnotationViewerDialog(JFrame aParentFrame, String aDialogTitle, DBPrefsMediator med,
        File aStyleMapFile, String aPerformanceStats, TypeSystem aTypeSystem, final String[] aTypesToDisplay,
        boolean generatedStyleMap, CAS cas) {

    super(aParentFrame, aDialogTitle);

    this.xmiDAO = med.getXmiDAO();

    this.med1 = med;
    this.cas = cas;

    styleMapFile = aStyleMapFile;
    final String performanceStats = aPerformanceStats;
    typeSystem = aTypeSystem;
    typesToDisplay = aTypesToDisplay;

    // create the AnnotationViewGenerator (for HTML view generation)
    annotationViewGenerator = new AnnotationViewGenerator(tempDir);

    // create StyleMapEditor dialog
    styleMapEditor = new StyleMapEditor(aParentFrame, cas);
    JPanel resultsTitlePanel = new JPanel();
    resultsTitlePanel.setLayout(new BoxLayout(resultsTitlePanel, BoxLayout.Y_AXIS));

    resultsTitlePanel.add(new JLabel("These are the Analyzed Documents."));
    resultsTitlePanel.add(new JLabel("Select viewer type and double-click file to open."));

    try {

        String[] documents = this.xmiDAO.getXMIList();
        analyzedResultsList = new JList(documents);

        JScrollPane scrollPane = new JScrollPane();
        scrollPane.getViewport().add(analyzedResultsList, null);

        JPanel southernPanel = new JPanel();
        southernPanel.setLayout(new BoxLayout(southernPanel, BoxLayout.Y_AXIS));

        JPanel controlsPanel = new JPanel();
        controlsPanel.setLayout(new SpringLayout());

        Caption displayFormatLabel = new Caption("Results Display Format:");
        controlsPanel.add(displayFormatLabel);

        JPanel displayFormatPanel = new JPanel();
        displayFormatPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
        displayFormatPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
        javaViewerRB = new JRadioButton("Java Viewer");
        javaViewerUCRB = new JRadioButton("JV user colors");
        htmlRB = new JRadioButton("HTML");
        xmlRB = new JRadioButton("XML");

        ButtonGroup displayFormatButtonGroup = new ButtonGroup();
        displayFormatButtonGroup.add(javaViewerRB);
        displayFormatButtonGroup.add(javaViewerUCRB);
        displayFormatButtonGroup.add(htmlRB);
        displayFormatButtonGroup.add(xmlRB);

        // select the appropraite viewer button according to user's prefs
        javaViewerRB.setSelected(true); // default, overriden below

        if ("Java Viewer".equals(med.getViewType())) {
            javaViewerRB.setSelected(true);
        } else if ("JV User Colors".equals(med.getViewType())) {
            javaViewerUCRB.setSelected(true);
        } else if ("HTML".equals(med.getViewType())) {
            htmlRB.setSelected(true);
        } else if ("XML".equals(med.getViewType())) {
            xmlRB.setSelected(true);
        }

        displayFormatPanel.add(javaViewerRB);
        displayFormatPanel.add(javaViewerUCRB);
        displayFormatPanel.add(htmlRB);
        displayFormatPanel.add(xmlRB);

        controlsPanel.add(displayFormatPanel);

        SpringUtilities.makeCompactGrid(controlsPanel, 1, 2, // rows, cols
                4, 4, // initX, initY
                0, 0); // xPad, yPad

        JButton editStyleMapButton = new JButton("Edit Style Map");

        // event for the editStyleMapButton button
        editStyleMapButton.addActionListener(this);

        southernPanel.add(controlsPanel);

        // southernPanel.add( new JSeparator() );

        JPanel buttonsPanel = new JPanel();
        buttonsPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));

        // APL: edit style map feature disabled for SDK
        buttonsPanel.add(editStyleMapButton);

        if (performanceStats != null) {
            JButton perfStatsButton = new JButton("Performance Stats");
            perfStatsButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ae) {
                    JOptionPane.showMessageDialog((Component) ae.getSource(), performanceStats, null,
                            JOptionPane.PLAIN_MESSAGE);
                }
            });
            buttonsPanel.add(perfStatsButton);
        }

        JButton closeButton = new JButton("Close");
        buttonsPanel.add(closeButton);

        southernPanel.add(buttonsPanel);

        // add list and panel container to Dialog
        getContentPane().add(resultsTitlePanel, BorderLayout.NORTH);
        getContentPane().add(scrollPane, BorderLayout.CENTER);
        getContentPane().add(southernPanel, BorderLayout.SOUTH);

        // event for the closeButton button
        closeButton.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                DBAnnotationViewerDialog.this.setVisible(false);
            }
        });

        // event for analyzedResultsDialog window closing
        this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        setLF(); // set default look and feel
        analyzedResultsList.setCellRenderer(new MyListCellRenderer());

        // doubleclicking on document shows the annotated result
        MouseListener mouseListener = new ListMouseAdapter();
        // styleMapFile, analyzedResultsList,
        // inputDirPath,typeSystem , typesToDisplay ,
        // javaViewerRB , javaViewerUCRB ,xmlRB ,
        // viewerDirectory , this);

        // add mouse Listener to the list
        analyzedResultsList.addMouseListener(mouseListener);
    } catch (DAOException e) {

        displayError(e.getMessage());

        this.dispatchEvent(new WindowEvent(this, WindowEvent.WINDOW_CLOSING));
    }
}

From source file:org.executequery.gui.editor.QueryEditorTextPanel.java

/** Initializes the state of this instance. */
private void init() throws Exception {

    // setup the query text panel and associated scroller
    queryPane = new QueryEditorTextPane(this);

    JScrollPane queryScroller = new JScrollPane();
    queryScroller.getViewport().add(queryPane, BorderLayout.CENTER);
    queryScroller.setRowHeaderView(queryPane.getLineBorder());
    queryScroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    queryScroller.setBorder(new EditorScrollerBorder());

    add(queryScroller, BorderLayout.CENTER);
}

From source file:org.fit.cssbox.scriptbox.demo.tester.JavaScriptTesterUIPresenter.java

private JEditorPane getSelectedEditorPane() {
    JScrollPane scrollPane = (JScrollPane) sourceCodeTabbedPane.getSelectedComponent();
    JViewport viewport = scrollPane.getViewport();
    return (JEditorPane) viewport.getView();
}

From source file:org.freeplane.main.application.MapViewDockingWindows.java

static Component getContainedMapView(View dockedWindow) {
    JScrollPane scrollPane = (JScrollPane) dockedWindow.getComponent();
    Component view = scrollPane.getViewport().getView();
    return view;//from  w  w w  .jav a2s  .c  o  m
}

From source file:org.isatools.gui.datamanager.exportisa.ExportISAGUI.java

public void createGUI() {
    // header image
    add(UIHelper.wrapComponentInPanel(new JLabel(panelHeader, SwingConstants.RIGHT)), BorderLayout.NORTH);

    // add a checkable jtree with investigations & studies...
    JPanel availableSubmissionsContainer = new JPanel(new BorderLayout());
    availableSubmissionsContainer.setOpaque(false);

    JPanel optionsContainer = new JPanel();
    optionsContainer.setLayout(new BoxLayout(optionsContainer, BoxLayout.LINE_AXIS));
    optionsContainer.setOpaque(false);// ww  w.ja  v  a2 s.c  om

    JPanel optionsAndInformationPanel = new JPanel();
    optionsAndInformationPanel.setLayout(new BoxLayout(optionsAndInformationPanel, BoxLayout.PAGE_AXIS));
    optionsAndInformationPanel.setOpaque(false);

    JLabel fileInformation = UIHelper.createLabel("<html><i>where</i> to save the isatab files?</html>",
            UIHelper.VER_12_BOLD, UIHelper.LIGHT_GREY_COLOR);
    fileInformation.setVerticalAlignment(JLabel.TOP);

    JPanel fileLocationOptionContainer = new JPanel();
    fileLocationOptionContainer.setLayout(new BoxLayout(fileLocationOptionContainer, BoxLayout.PAGE_AXIS));
    fileLocationOptionContainer.setOpaque(false);

    // add component for selection of output to repository or output to folder...
    fileLocationOptionGroup = new OptionGroup<String>(OptionGroup.HORIZONTAL_ALIGNMENT, true);
    fileLocationOptionGroup.addOptionItem("BII repository", true);
    fileLocationOptionGroup.addOptionItem("Local file system");

    localDirectoryLocation = new FileSelectionUtil("select output directory", createFileChooser(),
            UIHelper.VER_11_BOLD, UIHelper.GREY_COLOR);
    localDirectoryLocation.setVisible(false);
    localDirectoryLocation.setPreferredSize(new Dimension(150, 20));

    fileLocationOptionGroup.addPropertyChangeListener("optionSelectionChange", new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
            localDirectoryLocation
                    .setVisible(fileLocationOptionGroup.getSelectedItem().equals("Local file system"));
            revalidate();
        }
    });

    fileLocationOptionContainer.add(UIHelper.wrapComponentInPanel(fileInformation));
    fileLocationOptionContainer.add(UIHelper.wrapComponentInPanel(fileLocationOptionGroup));
    fileLocationOptionContainer.add(Box.createVerticalStrut(5));
    fileLocationOptionContainer.add(UIHelper.wrapComponentInPanel(localDirectoryLocation));

    optionsContainer.add(fileLocationOptionContainer);

    JPanel dataFileExportOptionContainer = new JPanel();
    dataFileExportOptionContainer.setLayout(new BoxLayout(dataFileExportOptionContainer, BoxLayout.PAGE_AXIS));
    dataFileExportOptionContainer.setOpaque(false);

    JLabel dataFileExportInformation = UIHelper.createLabel("<html>export data files?</html>",
            UIHelper.VER_12_BOLD, UIHelper.LIGHT_GREY_COLOR);
    dataFileExportInformation.setVerticalAlignment(JLabel.TOP);

    dataFileExportOptionGroup = new OptionGroup<String>(OptionGroup.HORIZONTAL_ALIGNMENT, true);
    dataFileExportOptionGroup.addOptionItem("yes", true);
    dataFileExportOptionGroup.addOptionItem("no");

    dataFileExportOptionContainer.add(UIHelper.wrapComponentInPanel(dataFileExportInformation));
    dataFileExportOptionContainer.add(UIHelper.wrapComponentInPanel(dataFileExportOptionGroup));
    dataFileExportOptionContainer.add(Box.createVerticalStrut(25));

    optionsContainer.add(dataFileExportOptionContainer);

    optionsAndInformationPanel.add(Box.createVerticalStrut(5));
    optionsAndInformationPanel.add(optionsContainer);
    optionsAndInformationPanel.add(Box.createVerticalStrut(10));

    JLabel information = UIHelper.createLabel(
            "<html>please <i>select</i> the submissions to be exported...</html>", UIHelper.VER_12_BOLD,
            UIHelper.LIGHT_GREY_COLOR);
    information.setVerticalAlignment(JLabel.TOP);

    optionsAndInformationPanel.add(UIHelper.wrapComponentInPanel(information));
    optionsAndInformationPanel.add(Box.createVerticalStrut(5));

    availableSubmissionsContainer.add(optionsAndInformationPanel, BorderLayout.NORTH);

    retrieveAndProcessStudyInformation();

    JScrollPane treeScroller = new JScrollPane(studyAvailabilityTree, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    treeScroller.getViewport().setOpaque(false);
    treeScroller.setOpaque(false);
    treeScroller.setBorder(new EmptyBorder(1, 1, 1, 1));

    treeScroller.setPreferredSize(new Dimension(380, 250));

    availableSubmissionsContainer.add(treeScroller, BorderLayout.CENTER);
    add(availableSubmissionsContainer, BorderLayout.CENTER);
    add(createSouthPanel(), BorderLayout.SOUTH);
}

From source file:org.isatools.gui.datamanager.studyaccess.StudyAccessionGUI.java

private JPanel createStudySelectionPanel() {

    JPanel container = new JPanel();
    container.setLayout(new BoxLayout(container, BoxLayout.PAGE_AXIS));
    container.setOpaque(false);//from www.  j a  va 2  s  . c om

    JPanel studyAccessionSelector = new JPanel();
    studyAccessionSelector.setLayout(new BorderLayout());
    studyAccessionSelector.setOpaque(false);

    JLabel information = new JLabel(unloadStudyHeader);
    information.setHorizontalAlignment(SwingConstants.RIGHT);
    information.setVerticalAlignment(SwingConstants.TOP);

    studyAccessionSelector.add(information, BorderLayout.NORTH);

    retrieveAndProcessStudyInformation();

    JScrollPane treeScroller = new JScrollPane(studyAvailabilityTree, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    treeScroller.getViewport().setOpaque(false);
    treeScroller.setOpaque(false);
    treeScroller.setBorder(new EmptyBorder(1, 1, 1, 1));

    treeScroller.setPreferredSize(new Dimension(380, 210));

    studyAccessionSelector.add(treeScroller);

    container.add(studyAccessionSelector);

    // and need a convert button!
    JPanel buttonCont = new JPanel(new BorderLayout());
    buttonCont.setOpaque(false);

    final JLabel unload = new JLabel(this.unloadButton, JLabel.RIGHT);

    unload.addMouseListener(new MouseAdapter() {

        public void mouseEntered(MouseEvent mouseEvent) {
            unload.setIcon(unloadButtonOver);
        }

        public void mouseExited(MouseEvent mouseEvent) {
            unload.setIcon(StudyAccessionGUI.this.unloadButton);
        }

        public void mousePressed(MouseEvent mouseEvent) {
            Set<String> studiesToUnload = studyAvailabilityTree
                    .getCheckedStudies(studyAvailabilityTree.getRoot());
            log.info("going to unload: ");
            for (String acc : studiesToUnload) {
                log.info("study with acc " + acc);
            }
            doUnloading(studiesToUnload);
        }

    });
    buttonCont.add(unload, BorderLayout.EAST);

    buttonCont.add(createBackToMainMenuButton(), BorderLayout.WEST);

    container.add(buttonCont);

    return container;
}

From source file:org.isatools.isacreator.gui.DataEntryForm.java

/**
 * Adds the fields describing a section to a Container (e.g. JPanel, Box, etc.)
 *
 * @param containerToAddTo @see JPanel, @see Box, @see  Container
 * @param sectionToAddTo   - @see InvestigationFileSection as a reference for where the fields are being added
 * @param fieldValues      - Map of field name to values.
 * @param referenceObject  - A @see DataEntryReferenceObject which gives information about
 *//*from  w w w. ja  v  a 2s.  c om*/
public void addFieldsToPanel(Container containerToAddTo, InvestigationFileSection sectionToAddTo,
        OrderedMap<String, String> fieldValues, DataEntryReferenceObject referenceObject) {

    if (fieldDefinitions == null) {
        fieldDefinitions = new ListOrderedMap<String, JComponent>();
    }

    Set<String> ontologyFields = referenceObject.getOntologyTerms(sectionToAddTo);
    Set<String> fieldsToIgnore = referenceObject.getFieldsToIgnore();

    for (String fieldName : fieldValues.keySet()) {

        if (!fieldsToIgnore.contains(fieldName)) {
            FieldObject fieldDescriptor = referenceObject.getFieldDefinition(fieldName);

            if (!fieldDescriptor.isHidden()) {
                String tmpFieldName = fieldName;

                if (realNamesToAliases.containsKey(fieldName)) {
                    tmpFieldName = realNamesToAliases.get(fieldName);
                }

                JPanel fieldPanel = createFieldPanel(1, 2);
                JLabel fieldLabel = createLabel(tmpFieldName);

                JComponent textComponent;

                if (fieldDescriptor.getDatatype() == DataTypes.STRING
                        || fieldDescriptor.getDatatype() == DataTypes.ONTOLOGY_TERM
                        || fieldDescriptor.getDatatype() == DataTypes.DATE) {
                    textComponent = new RoundedJTextField(10);
                } else if (fieldDescriptor.getDatatype() == DataTypes.LONG_STRING) {
                    textComponent = new JTextArea();

                    ((JTextArea) textComponent).setSelectionColor(UIHelper.LIGHT_GREEN_COLOR);
                    ((JTextArea) textComponent).setSelectedTextColor(UIHelper.BG_COLOR);

                    ((JTextArea) textComponent).setWrapStyleWord(true);
                    ((JTextArea) textComponent).setLineWrap(true);
                    textComponent.setBackground(UIHelper.BG_COLOR);
                    textComponent.setBorder(UIHelper.GREEN_ROUNDED_BORDER);
                } else if (fieldDescriptor.getDatatype() == DataTypes.LIST) {
                    textComponent = new JComboBox(fieldDescriptor.getFieldList());
                } else {
                    textComponent = new RoundedJTextField(10);
                }

                if (textComponent instanceof JTextArea || textComponent instanceof JTextComponent) {
                    ((JTextComponent) textComponent)
                            .setText(fieldValues.get(fieldName).equals("") ? fieldDescriptor.getDefaultVal()
                                    : fieldValues.get(fieldName));
                }
                textComponent.setToolTipText(fieldDescriptor.getDescription());

                UIHelper.renderComponent(textComponent, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR,
                        false);

                fieldPanel.add(fieldLabel);

                if (textComponent instanceof JTextArea) {

                    JScrollPane invDescScroll = new JScrollPane(textComponent,
                            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
                    invDescScroll.setPreferredSize(new Dimension(200, 75));

                    invDescScroll.getViewport().setBackground(UIHelper.BG_COLOR);

                    ((JTextArea) textComponent).getDocument().addDocumentListener(new DocumentChangeListener());

                    IAppWidgetFactory.makeIAppScrollPane(invDescScroll);
                    fieldPanel.add(
                            UIHelper.createTextEditEnableJTextArea(invDescScroll, (JTextArea) textComponent));
                } else if (textComponent instanceof JTextComponent) {

                    if (fieldDescriptor.getDatatype() == DataTypes.ONTOLOGY_TERM
                            || ontologyFields.contains(fieldName)) {
                        fieldPanel.add(createOntologyDropDown(fieldName, (JTextComponent) textComponent, true,
                                false, fieldDescriptor.getRecommmendedOntologySource()));
                    } else if (fieldDescriptor.getDatatype() == DataTypes.DATE) {
                        fieldPanel.add(createDateDropDown((JTextComponent) textComponent));
                    } else if (fieldDescriptor.isAcceptsFileLocations()) {
                        fieldPanel.add(createFileField((JTextComponent) textComponent));
                    } else {
                        fieldPanel.add(textComponent);
                    }
                    ((JTextComponent) textComponent).getDocument()
                            .addDocumentListener(new DocumentChangeListener());
                } else {
                    fieldPanel.add(textComponent);
                }

                fieldDefinitions.put(tmpFieldName, textComponent);

                containerToAddTo.add(fieldPanel);
                containerToAddTo.add(Box.createVerticalStrut(5));
            }
        }
    }
}

From source file:org.isatools.isacreator.ontologyselectiontool.ViewTermDefinitionUI.java

private JPanel createOntologyInformationPane(final OntologyBranch term) {
    JPanel contentPane = new JPanel(new BorderLayout());
    contentPane.setBackground(Color.WHITE);
    contentPane.setBorder(new EmptyBorder(2, 2, 2, 2));

    JEditorPane ontologyInfoPane = createOntologyInformationDisplay(term);

    JScrollPane ontologyInfoScroller = new JScrollPane(ontologyInfoPane,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    ontologyInfoScroller.getViewport().setBackground(UIHelper.BG_COLOR);
    ontologyInfoScroller.setBorder(new EmptyBorder(2, 2, 2, 2));

    IAppWidgetFactory.makeIAppScrollPane(ontologyInfoScroller);

    contentPane.add(ontologyInfoScroller, BorderLayout.CENTER);

    JLabel viewOntologyInBrowser = new JLabel("View in resource.");
    viewOntologyInBrowser.addMouseListener(new CommonMouseAdapter() {
        @Override/*ww  w.ja va2 s  . com*/
        public void mouseExited(MouseEvent mouseEvent) {
            super.mouseExited(mouseEvent);
        }

        @Override
        public void mouseEntered(MouseEvent mouseEvent) {
            super.mouseEntered(mouseEvent);
        }

        @Override
        public void mousePressed(MouseEvent mouseEvent) {
            super.mousePressed(mouseEvent);
            try {
                String termSource = term.getComments().get("Source");
                System.out.println("Source: " + termSource);
                System.out.println("Accession: " + term.getBranchIdentifier());
                String serviceProvider = term.getComments().get("Service Provider");

                System.out.println("Service Provider: " + serviceProvider);
                String url = "";

                if (serviceProvider.equalsIgnoreCase("ols")) {
                    url = "http://www.ebi.ac.uk/ontology-lookup/?termId=" + termSource + ":"
                            + term.getComments().get("accession");
                } else if (serviceProvider.equalsIgnoreCase("bioportal")) {
                    url = "http://bioportal.bioontology.org/ontologies/"
                            + termSource.substring(termSource.lastIndexOf("/") + 1) + "?p=classes&conceptid="
                            + term.getBranchIdentifier();
                }

                System.out.println(url);
                Desktop.getDesktop().browse(new URI(url));
            } catch (Exception e) {
                System.err.println("Unable to open URL: " + e.getMessage());
            }
        }
    });

    UIHelper.renderComponent(viewOntologyInBrowser, UIHelper.VER_10_BOLD, new Color(28, 117, 188), false);
    contentPane.add(viewOntologyInBrowser, BorderLayout.SOUTH);

    return contentPane;
}

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 av a 2 s  .com
    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.isacreator.visualization.InvestigationInfoPanel.java

private JPanel prepareInvestigationInformation() {

    investigationInformation.removeAll();

    JEditorPane currentlyShowingInfo = new JEditorPane();
    currentlyShowingInfo.setContentType("text/html");
    currentlyShowingInfo.setEditable(false);
    currentlyShowingInfo.setBackground(UIHelper.BG_COLOR);

    JScrollPane infoScroller = new JScrollPane(currentlyShowingInfo, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    infoScroller.setBackground(UIHelper.BG_COLOR);
    infoScroller.getViewport().setBackground(UIHelper.BG_COLOR);
    infoScroller.setPreferredSize(new Dimension(width - 10, height - 50));
    infoScroller.setBorder(null);/*from  w ww  .java 2 s  . c o  m*/

    IAppWidgetFactory.makeIAppScrollPane(infoScroller);

    Map<String, String> data = getInvestigationDetails();

    String labelContent = "<html>" + "<head>" + "<style type=\"text/css\">" + "<!--" + ".bodyFont {"
            + "   font-family: Verdana;" + "   font-size: 9px;" + "   color: #006838;" + "}" + "-->"
            + "</style>" + "</head>" + "<body class=\"bodyFont\">";

    for (Object key : data.keySet()) {
        labelContent += ("<p><b>" + ((String) key).trim() + ": </b>");
        labelContent += (data.get(key) + "</font></p>");
    }

    labelContent += "</body></html>";

    currentlyShowingInfo.setText(labelContent);

    investigationInformation.add(infoScroller);

    return investigationInformation;
}