5

I have a problem with seesaw table. When I try to make up and show a simple table, it shows without column names.
What I did:

At first, I must say that I am using [seesaw "1.4.2"].
Then:

;; Clojure 1.4.0
(require '[seesaw.core :as ss])

(ss/native!)

(def main-window
     (-> (ss/frame
           :title "Main window")
       ss/pack!
       (ss/config! :minimum-size [320 :by 240])
       ss/show!))

(def display
     #(ss/config! main-window
                  :content %))

(display
     (ss/table
       :id :dumb-table
       :model [:columns
               [:one :another]
               :rows
               [["1" "2"]
                ["3" "4"]]]))

what I get
(source: leprosorium.com)

Table appears, but without column names, which, I guess, must be "one" and "another". What went wrong here?

It happens also if I use exactly the same code as in official wiki: https://github.com/daveray/seesaw/wiki/Tables

Update:

I forgot to mention, I'm using JDK 1.7u10, maybe it makes sense.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Display Name
  • 8,022
  • 3
  • 31
  • 66
  • 9
    Not sure how it is handled in `seesaw`, but `JTable` should be within `JScrollPane`. Otherwise, the header is not added and not visible. The header can be created manually though. Try using `table` with `scrollable` in `seasaw`. – tenorsax Dec 21 '12 at 23:21
  • 2
    @Aqua Yeah, this worked. I had to give additional arguments to `scrollable`: `(ss/scrollable table :column-header table)` where `table` is table itself. BTW, I still want to know, why in the tutorial everything works well as is. 8) – Display Name Dec 22 '12 at 01:30
  • I don't know why it worked once, but I must put the columns vector after `:column-header`, not the table. – Display Name Dec 24 '12 at 11:31

2 Answers2

2

I dont know how to use seesaw table. but in general you need to add JTable to JScrollPane. This is because JScrollPane makes column header available at the top even when you scroll the data. if you dont want to use JScrollPane then u need to add the column header manually to the container so they stay at the top. So try adding JScrollPane.

Let me know if i went wrong...:)

cJ_
  • 486
  • 1
  • 4
  • 19
-1

Well, I think you missed some thing, ( see reference )

(display
 (ss/table
   :id :dumb-table
   :model [:columns
           [{:key :one, :text "One~1"} 
             {:key :one, :text "The Other~2"}]
           :rows
           [["1" "2"]
            ["3" "4"]]]))
Shawn Zhang
  • 1,680
  • 1
  • 12
  • 21