List of usage examples for javax.swing JScrollPane getViewport
public JViewport getViewport()
JViewport
. From source file:org.o3project.optsdn.don.frame.NeFrame.java
/** * Create a pane that displays Information Model ID list. * //ww w . ja v a2s .c o m * @param portList Ports * @return The pane that displays Information Model ID list */ private JScrollPane createInformationModelIdListPane(List<Port> portList) { Collections.sort(portList, new PortComparator()); Object[] columnNames = INFORMATION_MODEL_ID_COLNAME_LIST.toArray(); DefaultTableModel tableModel = new DefaultTableModel(columnNames, 0); for (Port port : portList) { Port[] column = { port, port }; tableModel.addRow(column); } JTable informationModeldTable = new JTable(tableModel); informationModeldTable.getTableHeader().setBackground(Color.WHITE); DefaultTableCellRenderer renderer = new InformationModelIdRenderer(); renderer.setHorizontalAlignment(SwingConstants.CENTER); informationModeldTable.setDefaultRenderer(Object.class, renderer); JScrollPane informationModelIdPane = new JScrollPane(); informationModelIdPane.getViewport().setView(informationModeldTable); informationModelIdPane .setPreferredSize(new Dimension(informationModelIdPane.getPreferredSize().width, TABLE_HEIGHT)); return informationModelIdPane; }
From source file:org.openconcerto.erp.core.finance.accounting.ui.EtatJournauxPanel.java
public void loadAsynchronous() { // On recupere les differents journaux SQLTable journalTable = base.getTable("JOURNAL"); List<SQLRow> liste = SQLBackgroundTableCache.getInstance().getCacheForTable(journalTable).getRows(); for (int k = 0; k < liste.size(); k++) { SQLRow row = liste.get(k);/*from w w w . java 2s . com*/ fireIsLoading(true); final Journal jrnlTmp = new Journal(row.getID(), row.getString("NOM"), row.getString("CODE")); new SwingWorker<JPanel, Object>() { @Override protected JPanel doInBackground() throws Exception { final JPanel initJournalPanel = initJournalPanel(jrnlTmp); return initJournalPanel; } @Override protected void done() { JPanel initJournalPanel; try { initJournalPanel = get(); initJournalPanel.setOpaque(false); JScrollPane scroll = new JScrollPane(initJournalPanel); scroll.setBorder(null); scroll.setOpaque(false); scroll.getViewport().setOpaque(false); EtatJournauxPanel.this.tabbedJournaux.addTab(jrnlTmp.getNom(), scroll); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ExecutionException e) { // TODO Auto-generated catch block e.printStackTrace(); } fireIsLoading(false); super.done(); } }.execute(); } }
From source file:org.openconcerto.erp.core.finance.accounting.ui.GrandLivrePanel.java
public void loadAsynchronous() { // On recupere les differentes classes List<ClasseCompte> liste = ClasseCompte.getClasseCompte(); if (liste.size() != 0) { for (int k = 0; k < liste.size(); k++) { final ClasseCompte ccTmp = liste.get(k); fireLoading(true);//from ww w.jav a 2 s .c o m new SwingWorker<JPanel, Object>() { @Override protected JPanel doInBackground() throws Exception { // TODO Auto-generated method stub return initClassePanel(ccTmp); } @Override protected void done() { JPanel initClassePanel; try { initClassePanel = get(); initClassePanel.setOpaque(false); final JScrollPane scrollPane = new JScrollPane(initClassePanel); scrollPane.setOpaque(false); scrollPane.setBorder(null); scrollPane.getViewport().setOpaque(false); // On crer les comptes de chaque classe GrandLivrePanel.this.tabbedClasse.addTab(ccTmp.getNom(), scrollPane); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ExecutionException e) { // TODO Auto-generated catch block e.printStackTrace(); } fireLoading(false); super.done(); } }.execute(); } } }
From source file:org.openmicroscopy.shoola.agents.dataBrowser.browser.BrowserModel.java
/** * Implemented as specified by the {@link Browser} interface. * @see Browser#scrollToNode(ImageDisplay) */// w w w . j a v a 2 s . c o m public void scrollToNode(ImageDisplay node) { if (node == null) return; JScrollPane pane = rootDisplay.getDeskDecorator(); Rectangle bounds = node.getBounds(); Rectangle viewRect = pane.getViewport().getViewRect(); if (viewRect.contains(bounds)) return; JScrollBar hBar = pane.getHorizontalScrollBar(); if (hBar.isVisible()) { int x = bounds.x; int max = hBar.getMaximum(); if (x > max) x = max; hBar.setValue(x); } JScrollBar vBar = pane.getVerticalScrollBar(); if (vBar.isVisible()) { int y = bounds.y; int max = vBar.getMaximum(); if (y > max) y = max; vBar.setValue(y); } }
From source file:org.pgptool.gui.ui.tools.UiUtils.java
private static JScrollPane getScrollableMessage(String msg) { JTextArea textArea = new JTextArea(msg); textArea.setLineWrap(true);/*from w w w .j av a 2s .c om*/ textArea.setWrapStyleWord(true); textArea.setEditable(false); textArea.setMargin(new Insets(5, 5, 5, 5)); textArea.setFont(new JTextField().getFont()); // dirty fix to use better font JScrollPane scrollPane = new JScrollPane(); scrollPane.setPreferredSize(new Dimension(700, 150)); scrollPane.getViewport().setView(textArea); return scrollPane; }
From source file:org.pmedv.blackboard.EditorUtils.java
/** * Gets the current selected and active editor * /* ww w . j a va 2 s. c om*/ * @param <T> * * @return */ public static BoardEditor getCurrentActiveEditor() { final ApplicationContext ctx = AppContext.getContext(); final ApplicationWindowAdvisor advisor = ctx.getBean(ApplicationWindowAdvisor.class); View view = (View) advisor.getCurrentEditorArea().getSelectedWindow(); if (view != null) { if (!(view.getComponent() instanceof JScrollPane)) return null; JScrollPane pane = (JScrollPane) view.getComponent(); if (!(pane.getViewport().getComponent(0) instanceof CenterPanel)) return null; CenterPanel panel = (CenterPanel) pane.getViewport().getComponent(0); BoardEditor editor = panel.getBoardEditor(); return editor; } return null; }
From source file:org.pmedv.blackboard.EditorUtils.java
/** * Gets a list of all open {@link BoardEditor} views for a specified docking * window. This method runs recursively and usually needs a given * {@link RootWindow}//from www. j ava2 s . c o m * * @param editors a list of {@link BoardEditor} objects, might be empty on * first call. * @param win */ private static void getOpenEditors(ArrayList<BoardEditor> editors, DockingWindow win) { for (int i = 0; i < win.getChildWindowCount(); i++) { if (win.getChildWindow(i) instanceof View) { final View view = (View) win.getChildWindow(i); if (view != null) { if (!(view.getComponent() instanceof JScrollPane)) return; JScrollPane pane = (JScrollPane) view.getComponent(); if (!(pane.getViewport().getComponent(0) instanceof CenterPanel)) return; CenterPanel panel = (CenterPanel) pane.getViewport().getComponent(0); BoardEditor editor = panel.getBoardEditor(); editors.add(editor); } } else getOpenEditors(editors, win.getChildWindow(i)); } }
From source file:org.revager.tools.GUITools.java
/** * Sets the given table into scroll a pane. * //from w ww. j a v a 2 s. c o m * @param table * the table * * @return the scroll pane */ public static JScrollPane setIntoScrollPane(JTable table) { JScrollPane scrollPn = new JScrollPane(table); scrollPn.getViewport().setBackground(Color.WHITE); return scrollPn; }
From source file:org.sikuli.ide.SikuliIDE.java
public EditorPane getCurrentCodePane() { if (tabPane.getSelectedIndex() == -1) { return null; }// www . j a va 2 s .com JScrollPane scrPane = (JScrollPane) tabPane.getSelectedComponent(); EditorPane pane = (EditorPane) scrPane.getViewport().getView(); return pane; }
From source file:org.sikuli.ide.SikuliIDE.java
public EditorPane getPaneAtIndex(int index) { JScrollPane scrPane = (JScrollPane) tabPane.getComponentAt(index); EditorPane codePane = (EditorPane) scrPane.getViewport().getView(); return codePane; }