Documente Academic
Documente Profesional
Documente Cultură
JFrame{
public MyFrame(){
// in our bottom panel we want the text area and the input components
scrollPane = new JScrollPane(); // this scrollPane is used to make
the text area scrollable
textArea = new JTextArea(); // this text area will be put inside
the scrollPane
// now lets define the default size of our window and its layout:
setPreferredSize(new Dimension(1370, 730)); // let's open the
window with a default size of 400x400 pixels
// the contentPane is the container that holds all our components
getContentPane().setLayout(new GridLayout()); // the default
GridLayout is like a grid with 1 column and 1 row,
// we only add one element to the window itself
getContentPane().add(splitPane); // due to the
GridLayout, our splitPane will now fill the whole window
// our topPanel doesn't need anymore for this example. Whatever you
want it to contain, you can add it here
topPanel.add(inputPanel1);
inputPanel1.setMaximumSize(new Dimension(Integer.MAX_VALUE, 150));
// we set the max height to 75 and the max width to (almost) unlimited
inputPanel1.setLayout(new BoxLayout(inputPanel, BoxLayout.X_AXIS));
topPanel.add(inputPanel2);
inputPanel2.setMaximumSize(new Dimension(Integer.MAX_VALUE, 150));
// we set the max height to 75 and the max width to (almost) unlimited
inputPanel2.setLayout(new BoxLayout(inputPanel, BoxLayout.X_AXIS));
srch= new JLabel("Search");
inputPanel.add(srch);
bottomPanel.setLayout(new BoxLayout(bottomPanel,
BoxLayout.Y_AXIS)); // BoxLayout.Y_AXIS will arrange the content vertically
}
}