package ru.skipy.test.ide.jbuilder; import java.awt.BorderLayout; import javax.swing.JFrame; import java.awt.GridBagLayout; import javax.swing.JLabel; import java.awt.*; import javax.swing.JComboBox; import javax.swing.JButton; import javax.swing.JScrollPane; import javax.swing.JTree; import javax.swing.JPanel; import javax.swing.BorderFactory; import javax.swing.border.Border; /** * Title: * * Description: * * Copyright: Copyright (c) 2006 * * Company: * * @author not attributable * @version 1.0 */ public class DirectoryDialog extends JFrame { JPanel cp = new JPanel(); GridBagLayout gridBagLayout = new GridBagLayout(); Border border1 = BorderFactory.createEmptyBorder(5, 5, 5, 5); JLabel lblChooseDir = new JLabel(); JButton btnOk = new JButton(); JButton btnCancel = new JButton(); JButton btnCreate = new JButton(); JScrollPane sp = new JScrollPane(); JLabel lblChooseDrive = new JLabel(); JComboBox cbxDrive = new JComboBox(); JButton btnRoot = new JButton(); JTree diskTree = new JTree(); BorderLayout borderLayout = new BorderLayout(); public DirectoryDialog() { try { jbInit(); } catch (Exception exception) { exception.printStackTrace(); } setSize(400,300); } private void jbInit() throws Exception { getContentPane().setLayout(borderLayout); cp.setLayout(gridBagLayout); cp.setBorder(border1); btnOk.setText("Ok"); btnCancel.setText("Cancel"); btnCreate.setText("Create New..."); lblChooseDrive.setText("Choose drive"); btnRoot.setText("Project Root..."); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setTitle("DirectoryDialog - JBuilder 2005 Foundation"); sp.getViewport().add(diskTree); cp.add(lblChooseDrive, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0 , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); cp.add(cbxDrive, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0 , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); cp.add(lblChooseDir, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0 , GridBagConstraints.SOUTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); cp.add(sp, new GridBagConstraints(0, 3, 1, 2, 1.0, 1.0 , GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); cp.add(btnOk, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0 , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 0), 0, 0)); cp.add(btnCancel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0 , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 10, 0), 0, 0)); cp.add(btnRoot, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0 , GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 0), 0, 0)); this.getContentPane().add(cp, java.awt.BorderLayout.CENTER); cp.add(btnCreate, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0 , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 10, 0), 0, 0)); lblChooseDir.setText("Choose Directory"); } public static void main(String[] args) { DirectoryDialog directorydialog = new DirectoryDialog(); directorydialog.setVisible(true); } }