KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > edu > umd > cs > findbugs > gui2 > SplitLayout


1 /*
2  * FindBugs - Find Bugs in Java programs
3  * Copyright (C) 2006, University of Maryland
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19
20 package edu.umd.cs.findbugs.gui2;
21
22 import java.awt.BorderLayout JavaDoc;
23 import java.awt.event.KeyEvent JavaDoc;
24
25 import javax.swing.JLabel JavaDoc;
26 import javax.swing.JMenu JavaDoc;
27 import javax.swing.JPanel JavaDoc;
28 import javax.swing.JSplitPane JavaDoc;
29 import javax.swing.JTabbedPane JavaDoc;
30 import javax.swing.UIManager JavaDoc;
31
32 /**
33  * @author pugh
34  */

35 public class SplitLayout implements FindBugsLayoutManager {
36
37     final MainFrame frame;
38     JLabel JavaDoc sourceTitle;
39     
40     /**
41      * @param frame
42      */

43     public SplitLayout(MainFrame frame) {
44         this.frame = frame;
45     }
46
47     /* (non-Javadoc)
48      * @see edu.umd.cs.findbugs.gui2.FindBugsLayoutManager#createWindowMenu()
49      */

50     public JMenu JavaDoc createWindowMenu() {
51         return null;
52     }
53
54     /* (non-Javadoc)
55      * @see edu.umd.cs.findbugs.gui2.FindBugsLayoutManager#initialize()
56      */

57     public void initialize() {
58
59         JSplitPane JavaDoc topLeft = new JSplitPane JavaDoc(JSplitPane.VERTICAL_SPLIT,
60                 frame.bugListPanel(), frame.createCommentsInputPanel());
61         topLeft.setOneTouchExpandable(true);
62         topLeft.setDividerLocation(250);
63         
64         JPanel JavaDoc sourcePanel = new JPanel JavaDoc();
65         sourcePanel.setLayout(new BorderLayout JavaDoc());
66         sourceTitle = new JLabel JavaDoc();
67         sourceTitle.setText(edu.umd.cs.findbugs.L10N.getLocalString("txt.source_listing", "<source listing>"));
68         sourcePanel.add(sourceTitle, BorderLayout.NORTH);
69         sourcePanel.add(frame.createSourceCodePanel(), BorderLayout.CENTER);
70         sourcePanel.add(frame.createSourceSearchPanel(), BorderLayout.SOUTH);
71         JSplitPane JavaDoc top = new JSplitPane JavaDoc(JSplitPane.HORIZONTAL_SPLIT,
72                 topLeft, sourcePanel
73                 );
74         top.setOneTouchExpandable(true);
75         //topLeft.setDividerLocation(); //default behaviour seems ok
76

77         JSplitPane JavaDoc main = new JSplitPane JavaDoc(JSplitPane.VERTICAL_SPLIT,
78                 top, frame.summaryTab());
79         main.setOneTouchExpandable(true);
80         main.setDividerLocation(400);
81
82         frame.setLayout(new BorderLayout JavaDoc());
83         frame.add(main, BorderLayout.CENTER);
84         frame.add(frame.statusBar(), BorderLayout.SOUTH);
85
86     }
87
88     /* (non-Javadoc)
89      * @see edu.umd.cs.findbugs.gui2.FindBugsLayoutManager#makeCommentsVisible()
90      */

91     public void makeCommentsVisible() {
92
93     }
94
95     /* (non-Javadoc)
96      * @see edu.umd.cs.findbugs.gui2.FindBugsLayoutManager#makeSourceVisible()
97      */

98     public void makeSourceVisible() {
99
100     }
101
102     /* (non-Javadoc)
103      * @see edu.umd.cs.findbugs.gui2.FindBugsLayoutManager#saveState()
104      */

105     public void saveState() {
106         // TODO Auto-generated method stub
107

108     }
109
110     /* (non-Javadoc)
111      * @see edu.umd.cs.findbugs.gui2.FindBugsLayoutManager#setSourceTitle(java.lang.String)
112      */

113     public void setSourceTitle(String JavaDoc title) {
114         sourceTitle.setText(title);
115     }
116     
117 }
118
Popular Tags