List of usage examples for javax.swing JViewport setBackground
@BeanProperty(preferred = true, visualUpdate = true, description = "The background color of the component.") public void setBackground(Color bg)
From source file:org.isatools.isacreator.gui.formelements.SubForm.java
public JScrollPane getFrozenTable(DefaultTableModel model, int width, int height) { // number of initial records equal to the number of columns in the model - the first column which contains field names! frozenTable = new JScrollPane(); IAppWidgetFactory.makeIAppScrollPane(frozenTable); lockedTable = new ExtendedJTable(model, rowEditor); lockedTable.getTableHeader().setReorderingAllowed(false); setTableProperties(lockedTable, true); scrollTable = new ExtendedJTable(model, rowEditor); setTableProperties(scrollTable, false); scrollTable.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); scrollTable.getTableHeader().setResizingAllowed(true); try {//w ww . jav a 2 s . c o m lockedTable.setDefaultRenderer(Class.forName("java.lang.Object"), DEFAULT_LOCKED_TABLE_RENDERER); scrollTable.setDefaultRenderer(Class.forName("java.lang.Object"), DEFAULT_SCROLL_TABLE_RENDERER); } catch (ClassNotFoundException e) { // ignore } scrollTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); scrollTable.getSelectionModel().addListSelectionListener(this); scrollTable.getColumnModel().getSelectionModel().addListSelectionListener(this); scrollTable.addFocusListener(this); scrollTable.setBackground(UIHelper.BG_COLOR); UIHelper.renderComponent(scrollTable.getTableHeader(), UIHelper.VER_12_PLAIN, UIHelper.BG_COLOR, new Color(141, 198, 63, 40)); excelAdaptor = new ExcelAdaptor(scrollTable, false); frozenTable.setViewportView(scrollTable); frozenTable.setBorder(em); setupTableTabBehaviour(); JTableHeader lockedHeader = lockedTable.getTableHeader(); setHeaderProperties(lockedTable, lockedTableHeaderRenderer); lockedHeader.setReorderingAllowed(false); frozenTable.setCorner(JScrollPane.UPPER_LEFT_CORNER, lockedHeader); setHeaderProperties(scrollTable, scrollTableHeaderRenderer); JViewport viewport = new JViewport(); viewport.setBackground(UIHelper.BG_COLOR); viewport.setView(lockedTable); frozenTable.setRowHeader(viewport); updateTables(); frozenTable.setPreferredSize(new Dimension(width, height)); frozenTable.getViewport().setBackground(UIHelper.BG_COLOR); frozenTable.getHorizontalScrollBar().setBackground(UIHelper.BG_COLOR); return frozenTable; }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.GeneralPaneUI.java
/** Builds and lays out the components. */ private void buildGUI() { setLayout(new BorderLayout(0, 0)); container.add(propertiesTaskPane);/*w ww. j a va2 s . c o m*/ container.add(annotationTaskPane); pane = new JScrollPane(); JViewport viewport = pane.getViewport(); viewport.add(container); viewport.setBackground(UIUtilities.BACKGROUND_COLOR); add(toolbar, BorderLayout.NORTH); add(pane, BorderLayout.CENTER); }