changeset 2:19b163992f3b

Added scroll pane to simple search tab
author Fox
date Fri, 01 Apr 2022 01:32:38 +0200
parents 3922b33bb764
children 6e29262ee18c
files src/junotu/TabSimpleSearch.java
diffstat 1 files changed, 19 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/junotu/TabSimpleSearch.java	Fri Apr 01 01:10:24 2022 +0200
+++ b/src/junotu/TabSimpleSearch.java	Fri Apr 01 01:32:38 2022 +0200
@@ -7,6 +7,7 @@
 
 import java.awt.BorderLayout;
 
+import javax.swing.Box;
 import javax.swing.JButton;
 import javax.swing.JTextField;
 import javax.swing.JScrollPane;
@@ -17,16 +18,31 @@
 	this.setLayout( new BorderLayout() );
 
 	JPanel top = new JPanel( new BorderLayout() );
-	JTextField field = new JTextField("Type here..");
-	JButton submit = new JButton("Search");
+	JTextField field = new JTextField();
+	JButton create = new JButton("+");
+	Box results = Box.createVerticalBox();
+	JScrollPane scroll = new JScrollPane( results );
 
 	field.setFont( new Font( "Monospaced", Font.PLAIN, 16 ) );
+	create.setFont( new Font( "Monospaced", Font.BOLD, 16 ) );
+
+	scroll.getVerticalScrollBar().setUnitIncrement(128);
 
 	field.setPreferredSize( new Dimension(32, 32) );
 	
 	this.add( top, BorderLayout.NORTH );
 	top.add( field, BorderLayout.CENTER );
-	top.add( submit, BorderLayout.EAST );
+	top.add( create, BorderLayout.EAST );
+
+	this.add( scroll, BorderLayout.CENTER );
+	for( int i = 0; i < 100; i++ ) {
+	    JButton button = new JButton( "Placeholder #"+Integer.toString(i+1) );
+	    button.setPreferredSize( new Dimension( 128, 128 ) );
+	    button.setMaximumSize( new Dimension( 1000000, 128 ) );
+	    results.add( button );
+	}
+
+	scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
 	
     }
 }