Java Code Examples for javax.swing.JScrollPane#getSize()

The following examples show how to use javax.swing.JScrollPane#getSize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimpleInfoBox.java    From SPIM_Registration with GNU General Public License v2.0 6 votes vote down vote up
public SimpleInfoBox( final String title, final String text )
{
	frame = new JFrame( title );

	final JTextArea textarea = new JTextArea( text );

	final JPanel panel = new JPanel();
	panel.add( textarea, BorderLayout.CENTER );
	final JScrollPane pane = new JScrollPane( panel );
	frame.add( pane, BorderLayout.CENTER );

	frame.pack();

	final Dimension d = pane.getSize();
	d.setSize( d.width + 20, d.height + 10 );
	pane.setSize( d );
	pane.setPreferredSize( d );
	frame.setPreferredSize( d );

	frame.pack();
	frame.setVisible( true );
}
 
Example 2
Source File: AnnotateScreenCapture.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private Component getAnnotationPanel() {
    JScrollPane scrollPane = new JScrollPane(new AnnotationPanel(imagePanel, !edit), JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    Dimension dimension = scrollPane.getSize();
    dimension.width = 250;
    scrollPane.setPreferredSize(dimension);
    return scrollPane;
}