touch frame update
authorNiki Roo <niki@nikiroo.be>
Wed, 6 May 2020 21:56:29 +0000 (23:56 +0200)
committerNiki Roo <niki@nikiroo.be>
Wed, 6 May 2020 21:56:29 +0000 (23:56 +0200)
src/be/nikiroo/fanfix_swing/gui/TouchFrame.java

index 857305508b1c858b432c147e6c152e23152e06a4..95faeb2899ca8cfb069524dc00b51a91232137f6 100644 (file)
@@ -29,6 +29,8 @@ public class TouchFrame extends JFrame {
        private BooksPanel books;
 
        public TouchFrame() {
+               setLayout(new BorderLayout());
+               
                active = new ArrayList<JComponent>();
                
                root = new JPanel(new BorderLayout());
@@ -75,7 +77,7 @@ public class TouchFrame extends JFrame {
                        }
                });
 
-               this.add(root);
+               this.add(root, BorderLayout.CENTER);
                showBooks();
                setSize(355, 465);
        }
@@ -103,26 +105,32 @@ public class TouchFrame extends JFrame {
        }
        
        private void open(Story story) {
+               final JComponent[] comps = new JComponent[2];
+               
                // Integrate it with showViewer or something
                if (story.getMeta().isImageDocument()) {
                        ViewerImages viewer = new ViewerImages(story) {
                                @Override
                                protected JToolBar createToolBar() {
-                                       JToolBar toolbar = super.createToolBar();
-                                       active.add(toolbar);
-                                       TouchFrame.this.add(toolbar, BorderLayout.NORTH);
+                                       comps[0] = super.createToolBar();
                                        return null;
                                }
                                
                                @Override
                                protected void initGui() {
                                        super.initGui();
-                                       removeShows();
-                                       active.add(scroll);
-                                       root.add(scroll);
+                                       comps[1] = scroll;
                                }
                        };
                        
+                       removeShows();
+
+                       // TODO: toolbar not so nice + add EXIT button
+                       active.add(comps[0]);
+                       active.add(comps[1]);
+                       TouchFrame.this.add(comps[0], BorderLayout.NORTH);
+                       root.add(comps[1]);
+                       
                        revalidate();
                        repaint();