/** * Creates an empty (no viewport view) <code>JScrollPane</code> * where both horizontal and vertical scrollbars appear when needed. */ public BaseScrollPane() { super(); initialize(); }
/** * Initializes the scrollpane. */ protected void initialize() { setScrollBarUnitIncrement(UNIT_INCREMENT); setScrollBarBlockIncrement(BLOCK_INCREMENT); setWheelScrollingEnabled(true); }
/** * Sets the wordwrap state. * * @param value true if to turn wordwrap on */ public void setWordWrap(boolean value) { m_WordWrap = value; if (!m_WordWrap) { m_ScrollPane.setViewportView(m_PanelWrapper); m_PanelWrapper.add(m_TextPane, BorderLayout.CENTER); } else { m_ScrollPane.setViewportView(m_TextPane); } }
/** * Sets the block increments of both bars. * * @param inc the increment to use * @see #BLOCK_INCREMENT */ public void setScrollBarBlockIncrement(int inc) { getVerticalScrollBar().setBlockIncrement(inc); getHorizontalScrollBar().setBlockIncrement(inc); } }
panelFonts.add(new BaseScrollPane(m_ListFontName), BorderLayout.CENTER); scrollPane = new BaseScrollPane(m_ListFontSize); scrollPane.setPreferredSize(new Dimension(50, 0)); panelSize.add(scrollPane); m_TextSample.setWrapStyleWord(true); m_TextSample.setEditable(false); add(new BaseScrollPane(m_TextSample), BorderLayout.CENTER);
/** * For initializing the GUI. */ @Override protected void initGUI() { super.initGUI(); setLayout(new BorderLayout()); m_PanelWrapper = new JPanel(new BorderLayout()); m_ScrollPane = new BaseScrollPane(m_PanelWrapper); add(m_ScrollPane, BorderLayout.CENTER); m_TextPane = new BaseTextPane(); m_PanelWrapper.add(m_TextPane, BorderLayout.CENTER); }
/** * Sets the unit increments of both bars. * * @param inc the increment to use * @see #UNIT_INCREMENT */ public void setScrollBarUnitIncrement(int inc) { getVerticalScrollBar().setUnitIncrement(inc); getHorizontalScrollBar().setUnitIncrement(inc); }
comp = new BaseScrollPane(comp); else if (comp instanceof JTextPane) comp = new BaseScrollPane(comp);
/** * Creates a <code>BaseScrollPane</code> that displays the * contents of the specified * component, where both horizontal and vertical scrollbars appear * whenever the component's contents are larger than the view. * * @param view the component to display in the scrollpane's viewport */ public BaseScrollPane(Component view) { super(view); initialize(); }
/** * For initializing the GUI. */ @Override protected void initGUI() { JPanel panel; super.initGUI(); setLayout(new BorderLayout()); m_PanelProperties = new ParameterPanel(); add(new BaseScrollPane(m_PanelProperties), BorderLayout.CENTER); m_PanelButtons = new JPanel(new BorderLayout()); add(m_PanelButtons, BorderLayout.SOUTH); panel = new JPanel(new FlowLayout(FlowLayout.LEFT)); m_PanelButtons.add(panel, BorderLayout.WEST); m_ButtonLoad = new JButton(GUIHelper.getIcon("open.gif")); m_ButtonLoad.addActionListener((ActionEvent e) -> loadProperties()); panel.add(m_ButtonLoad); m_ButtonSave = new JButton(GUIHelper.getIcon("save.gif")); m_ButtonSave.addActionListener((ActionEvent e) -> saveProperties()); panel.add(m_ButtonSave); }
/** * Creates an empty (no viewport view) <code>BaseScrollPane</code> * with specified * scrollbar policies. The available policy settings are listed at * {@link #setVerticalScrollBarPolicy} and * {@link #setHorizontalScrollBarPolicy}. * * @param vsbPolicy an integer that specifies the vertical scrollbar policy * @param hsbPolicy an integer that specifies the horizontal scrollbar policy */ public BaseScrollPane(int vsbPolicy, int hsbPolicy) { super(vsbPolicy, hsbPolicy); initialize(); }
/** * Creates a <code>BaseScrollPane</code> that displays the view * component in a viewport * whose view position can be controlled with a pair of scrollbars. * The scrollbar policies specify when the scrollbars are displayed, * For example, if <code>vsbPolicy</code> is * <code>VERTICAL_SCROLLBAR_AS_NEEDED</code> * then the vertical scrollbar only appears if the view doesn't fit * vertically. The available policy settings are listed at * {@link #setVerticalScrollBarPolicy} and * {@link #setHorizontalScrollBarPolicy}. * * @param view the component to display in the scrollpanes viewport * @param vsbPolicy an integer that specifies the vertical * scrollbar policy * @param hsbPolicy an integer that specifies the horizontal * scrollbar policy */ public BaseScrollPane(Component view, int vsbPolicy, int hsbPolicy) { super(view, vsbPolicy, hsbPolicy); initialize(); }