import java.awt.*; class book_layout implements LayoutManager { private int minWidth = 0, minHeight = 0; private int preferredWidth = 0, preferredHeight = 0; book fl; public book_layout (book fl){ super(); this.fl = fl; } public void addLayoutComponent(String name, Component comp) { } public void removeLayoutComponent(Component comp) { } private Dimension setsizes (int left, int top, boolean use_cur_dim){ //if (!fl.was_modified()) return; int n = fl.countComponents(); int bkwidth = 0; int bkheight = 0; FontMetrics met = fl.getGraphics().getFontMetrics(); int padswidth = 0; for (int i=0; i bkwidth) bkwidth = d.width; if (d.height > bkheight) bkheight = d.height; int padwidth = met.stringWidth(fl.pads[i].title) + 20; fl.pads[i].start = padswidth; fl.pads[i].below = false; padswidth += padwidth; fl.pads[i].stop = padswidth; } int bottom_pads = 0; if (padswidth > bkwidth){ for (int i=0; i bkwidth){ // Move those pads to the bottom bottom_pads = 20; int off = fl.pads[i].start; for (; i 0 || diffy > 0){ int n = fl.countComponents(); for (int i=0; i b_offsety){ return locatepad(e.x,true); } } return false; } public void paint (Graphics g){ Dimension d = size(); int y0 = offsety - 2; int y1 = y0 + 1; int lasty = b_offsety + 1; int lastx = d.width-2; g.setColor (Color.white); //g.drawLine (1,y0,3,y0); //g.drawLine (pads[nbpage-1].stop-3,y0,lastx,y0); //g.drawLine (pads[nbpage-1].stop-3,y1,lastx-1,y1); g.drawLine (1,y0,lastx,y0); g.drawLine (2,y1,lastx-1,y1); g.drawLine (1,y0,1,lasty); g.drawLine (2,y1,2,lasty); // Bottom shadow g.setColor (Color.black); g.drawLine (1,lasty,lastx,lasty); int lasty_1 = lasty - 1; g.drawLine (2,lasty_1,lastx,lasty_1); // Right shadow g.drawLine (lastx,lasty,lastx,y0+2); int lastx_1 = lastx - 1; g.drawLine (lastx_1,lasty,lastx_1,y0+2); for (int i=0; i