this.scrollPane.setLayout(new ScrollPaneLayout() { @Override public void layoutContainer(Container parent) {
public void actionPerformed(ActionEvent e) { HistoryLogPane.setLayout(new ScrollPaneLayout());//<<< history = (JPanel)HistoryLogPane.getViewport().getView();//<<< javax.swing.JScrollPane HistoryLogPane = new javax.swing.JScrollPane(); HistoryLogPane.setLayout(new ScrollPaneLayout()); // edit @kiheru HistoryLogPane.setBackground(Color.WHITE); HistoryLogPane.setBorder(BorderFactory.createEmptyBorder()); HistoryLogPane.setLocation(0, 0); HistoryLogPane.add(history); HistoryLogPane.setSize(new Dimension(history.getSize())); history.setPreferredSize(history.getSize());//and we tried: history.setPreferredSize(history.getPreferredSize()); history.revalidate();//<<< System.out.println("SIZE: " + HistoryLogPane.getSize()); HistoryLocationPanel.removeAll(); HistoryLocationPanel.add(HistoryLogPane); HistoryLocationPanel.repaint(); HistoryLogPane.repaint(); }
/** * Construct the panel * @param message The message to display * @param title Title to display above message-content */ public MessageDisplayContentPanel(Message message, String title){ final JLabel messageLabel = new JLabel(title); final JTextArea messageTextContent = new JTextArea(); if(message != null){ messageTextContent.setText(message.getMessageText()); } this.setLayout(new BorderLayout(5, 5)); this.setBorder(new EmptyBorder(10, 10, 10, 10) ); messageTextContent.setEditable(false); messageTextContent.setBackground(Color.WHITE); messageTextContent.setLineWrap(true); messageTextContent.setWrapStyleWord(true); messageTextContent.setCaretPosition(0); final JScrollPane scrollPane = new JScrollPane(messageTextContent); scrollPane.setLayout(new ScrollPaneLayout()); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); this.add(messageLabel, BorderLayout.NORTH); this.add(scrollPane, BorderLayout.CENTER); }
@Override protected void installDefaults(JScrollPane scrollpane) { ScrollPaneLayout oldLayout = (ScrollPaneLayout) scrollpane.getLayout(); super.installDefaults(scrollpane); scrollpane.setLayout(new MyAdjustedLayout(oldLayout)); }
private void uninstallFromScrollPane() { if (theScrollPane == null) { return; } if (thePopupMenu.isVisible()) { thePopupMenu.setVisible(false); } setCornerInScrollPane(null); // theScrollPane.removePropertyChangeListener(COMPONENT_ORIENTATION, theComponentOrientationListener); theScrollPane.getViewport().removeContainerListener(theViewPortViewListener); theScrollPane.setLayout(theFormerLayoutManager); theScrollPane = null; }
private void installOnScrollPane(final JScrollPane aScrollPane) { if (theScrollPane != null) { uninstallFromScrollPane(); } theScrollPane = aScrollPane; theFormerLayoutManager = theScrollPane.getLayout(); theScrollPane.setLayout(new TweakedScrollPaneLayout()); // theScrollPane.addPropertyChangeListener(COMPONENT_ORIENTATION, theComponentOrientationListener); theScrollPane.getViewport().addContainerListener(theViewPortViewListener); setCornerInScrollPane(theButton); final Component comp = theScrollPane.getViewport().getView(); theComponent = (comp instanceof JComponent) ? (JComponent) comp : null; }
void uninstallFromScrollPane() { if (theScrollPane == null) return; if (thePopupMenu.isVisible()) thePopupMenu.setVisible(false); theScrollPane.setCorner(JScrollPane.LOWER_TRAILING_CORNER, null); theScrollPane.removePropertyChangeListener(COMPONENT_ORIENTATION, propertyChangeListener); theScrollPane.getViewport().removeContainerListener( theViewPortViewListener); theScrollPane.setLayout(theFormerLayoutManager); theScrollPane.firePropertyChange("layoutManager", true, false); theScrollPane = null; }
/** initialize view */ private void initializeView() { // adjustment of controlling view Component comp = controllingView.getViewport().getView(); controllingView.setViewportView(comp); if (UIManager.getColor ("Table.background") != null) { // NOI18N getViewport().setBackground(UIManager.getColor("Table.background")); // NOI18N } // both views share one vertical scrollbar setVerticalScrollBar(controllingView.getVerticalScrollBar()); ScrollPaneLayout spl = new EnablingScrollPaneLayout(controllingView); setLayout(spl); spl.syncWithScrollPane(this); spl = new EnablingScrollPaneLayout(this); controllingView.setLayout(spl); spl.syncWithScrollPane(controllingView); table.setBorder(null); // table like header header = new JTable().getTableHeader().getDefaultRenderer() .getTableCellRendererComponent(null, " ", false, false, 0, 0); // NOI18N MouseInputListener mouseHandler = new MouseDragHandler(); header.addMouseListener(mouseHandler); header.addMouseMotionListener(mouseHandler); }
/** initialize view */ private void initializeView() { // adjustment of controlling view Component comp = controllingView.getViewport().getView(); controllingView.setViewportView(comp); if (UIManager.getColor("Table.background") != null) { // NOI18N getViewport().setBackground(UIManager.getColor("Table.background")); // NOI18N } // both views share one vertical scrollbar setVerticalScrollBar(controllingView.getVerticalScrollBar()); ScrollPaneLayout spl = new EnablingScrollPaneLayout(controllingView); setLayout(spl); spl.syncWithScrollPane(this); spl = new EnablingScrollPaneLayout(this); controllingView.setLayout(spl); spl.syncWithScrollPane(controllingView); table.setBorder(null); // table like header header = new JTable().getTableHeader().getDefaultRenderer().getTableCellRendererComponent( null, " ", false, false, 0, 0 ); // NOI18N MouseInputListener mouseHandler = new MouseDragHandler(); header.addMouseListener(mouseHandler); header.addMouseMotionListener(mouseHandler); }
/** initialize view */ private void initializeView() { // adjustment of controlling view Component comp = controllingView.getViewport().getView(); controllingView.setViewportView(comp); if (UIManager.getColor ("Table.background") != null) { // NOI18N getViewport().setBackground(UIManager.getColor("Table.background")); // NOI18N } // both views share one vertical scrollbar setVerticalScrollBar(controllingView.getVerticalScrollBar()); ScrollPaneLayout spl = new EnablingScrollPaneLayout(controllingView); setLayout(spl); spl.syncWithScrollPane(this); spl = new EnablingScrollPaneLayout(this); controllingView.setLayout(spl); spl.syncWithScrollPane(controllingView); table.setBorder(null); // table like header header = new JTable().getTableHeader().getDefaultRenderer() .getTableCellRendererComponent(null, " ", false, false, 0, 0); // NOI18N MouseInputListener mouseHandler = new MouseDragHandler(); header.addMouseListener(mouseHandler); header.addMouseMotionListener(mouseHandler); }
@Override protected void installDefaults(final JScrollPane scrollpane) { super.installDefaults(scrollpane); if (SubstanceCoreUtilities.toDrawWatermark(scrollpane) && (SubstanceLookAndFeel.getCurrentSkin(scrollpane) .getWatermark() != null)) { scrollpane.setOpaque(false); scrollpane.getViewport().setOpaque(false); } scrollpane.setLayout(new AdjustedLayout((ScrollPaneLayout) scrollpane .getLayout())); SwingUtilities.invokeLater(new Runnable() { public void run() { // System.out.println("Installing"); installTableHeaderCornerFiller(scrollpane); } }); }
@Override protected void installDefaults(final JScrollPane scrollpane) { super.installDefaults(scrollpane); if (SubstanceCoreUtilities.toDrawWatermark(scrollpane) && (SubstanceLookAndFeel.getCurrentSkin(scrollpane) .getWatermark() != null)) { scrollpane.setOpaque(false); scrollpane.getViewport().setOpaque(false); } scrollpane.setLayout(new AdjustedLayout((ScrollPaneLayout) scrollpane .getLayout())); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { // System.out.println("Installing"); installTableHeaderCornerFiller(scrollpane); } }); }
protected void installDefaults(JScrollPane scrollpane) { LookAndFeel.installBorder(scrollpane, "ScrollPane.border"); LookAndFeel.installColorsAndFont(scrollpane, "ScrollPane.background", "ScrollPane.foreground", "ScrollPane.font"); Border vpBorder = scrollpane.getViewportBorder(); if ((vpBorder == null) ||( vpBorder instanceof UIResource)) { vpBorder = UIManager.getBorder("ScrollPane.viewportBorder"); scrollpane.setViewportBorder(vpBorder); } scrollpane.setLayout(new TonicScrollPaneLayout()); scrollpane.setCorner(JScrollPane.UPPER_RIGHT_CORNER, new UpperRightCorner()); }
@Override protected void uninstallDefaults(JScrollPane c) { Component upperRight = c.getCorner(JScrollPane.UPPER_RIGHT_CORNER); if (upperRight instanceof UIResource) { c.setCorner(JScrollPane.UPPER_RIGHT_CORNER, null); } Component upperLeft = c.getCorner(JScrollPane.UPPER_LEFT_CORNER); if (upperLeft instanceof UIResource) { c.setCorner(JScrollPane.UPPER_LEFT_CORNER, null); } LayoutManager lm = scrollpane.getLayout(); if (lm instanceof AdjustedLayout) { c.setLayout(((AdjustedLayout) lm).delegate); } super.uninstallDefaults(c); }
@Override protected void uninstallDefaults(JScrollPane c) { Component upperRight = c.getCorner(JScrollPane.UPPER_RIGHT_CORNER); if (upperRight instanceof UIResource) { c.setCorner(JScrollPane.UPPER_RIGHT_CORNER, null); } Component upperLeft = c.getCorner(JScrollPane.UPPER_LEFT_CORNER); if (upperLeft instanceof UIResource) { c.setCorner(JScrollPane.UPPER_LEFT_CORNER, null); } LayoutManager lm = scrollpane.getLayout(); if (lm instanceof AdjustedLayout) { c.setLayout(((AdjustedLayout) lm).delegate); } super.uninstallDefaults(c); }
initComponents(); scrollPane.setLayout(new PlacardScrollPaneLayout()); scrollPane.setBorder(new EmptyBorder(0, 0, 0, 0));
initComponents(); scrollPane.setLayout(new PlacardScrollPaneLayout()); scrollPane.setBorder(new EmptyBorder(0,0,0,0));
void installOnScrollPane(JScrollPane aScrollPane) { if (theScrollPane != null) uninstallFromScrollPane(); theScrollPane = aScrollPane; theFormerLayoutManager = theScrollPane.getLayout(); theScrollPane.setLayout(new TweakedScrollPaneLayout()); theScrollPane.firePropertyChange("layoutManager", false, true); theScrollPane.addPropertyChangeListener(COMPONENT_ORIENTATION, propertyChangeListener); theScrollPane.getViewport().addContainerListener( theViewPortViewListener); theScrollPane.setCorner(JScrollPane.LOWER_TRAILING_CORNER, theButton); Component comp = theScrollPane.getViewport().getView(); theComponent = (comp instanceof JComponent) ? (JComponent) comp : null; this.theButton.setIcon(LafWidgetRepository.getRepository() .getLafSupport().getSearchIcon( UIManager.getInt("ScrollBar.width") - 3, theScrollPane.getComponentOrientation())); theScrollPane.doLayout(); }