changeset 38:2fab4ac14aaf

TabColumns: Some visual progress
author Fox
date Thu, 20 Oct 2022 17:14:27 +0200
parents de1ba9325973
children 27f2a22399d1
files src/junotu/TabColumns.java
diffstat 1 files changed, 15 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/junotu/TabColumns.java	Wed Oct 19 12:38:56 2022 +0200
+++ b/src/junotu/TabColumns.java	Thu Oct 20 17:14:27 2022 +0200
@@ -20,6 +20,7 @@
 import javax.swing.Box;
 
 import java.awt.BorderLayout;
+import javax.swing.BoxLayout;
 
 import javax.swing.JButton;
 import javax.swing.JLabel;
@@ -41,18 +42,27 @@
 	JLabel title;
 	JTextField titleEdit;
 	Box cards;
+	JButton addCard;
 
 	public ColumnWidget()
 	{
-	    this.setLayout( new BorderLayout() );
+	    /* TODO: Maybe gridbag layout will do the trick. */
+	    this.setLayout( new BoxLayout(this, BoxLayout.Y_AXIS) );
 	    
 	    title = new JLabel("");
 	    cards = Box.createVerticalBox();
+	    addCard = new JButton("+");
 
 	    title.setFont( new Font( "Monospaced", Font.PLAIN, 16 ) );
+	    addCard.setFont( new Font( "Monospaced", Font.BOLD, 32 ) );
 
-	    //this.add( title, BorderLayout.NORTH );
-	    this.add( cards, BorderLayout.CENTER );
+	    cards.add( addCard );
+	    this.add( cards );
+	    this.add( Box.createVerticalGlue() );
+
+	    addCard.setPreferredSize( new Dimension( 1000000, 64 ) );
+	    addCard.setMaximumSize( new Dimension( 1000000, 64 ) );
+	    addCard.setAlignmentX( JButton.CENTER_ALIGNMENT );
 
 	    this.setPreferredSize( new Dimension( 256+16, 384 ) );
 	    this.setMaximumSize( new Dimension( 256+16, 1000000 ) );
@@ -82,7 +92,7 @@
 	public void insertCard( Card card, int at )
 	{
 	    if( at == -1 ) {
-		at = cards.getComponentCount();
+		at = cards.getComponentCount()-1;
 	    }
 	    ColumnCardWidget cardWidget = new ColumnCardWidget( card );
 	    /* TODO: Check if works properly. */
@@ -155,7 +165,7 @@
 	    ColumnWidget column = new ColumnWidget();
 	    column.titleSet("New column");
 
-	    for( int j = 0; j < i; j++ ) {
+	    for( int j = 0; j < i*3; j++ ) {
 		column.insertCard( testCard, -1 );
 	    }