package ru.skipy.test.ide.idea6; import javax.swing.*; import java.awt.*; import javax.swing.border.*; public class DirectoryDialog extends JFrame { private JComboBox chooseDriveComboBox; private JButton okButton; private JButton cancelButton; private JTree chooseDirectoryTree; private JButton projectRootButton; private JButton createNewButton; private JPanel mainPanel; public DirectoryDialog() { super("DirectoryDialog - IntelliJ IDEA 6.0"); setContentPane(mainPanel); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(400, 300); setLocationRelativeTo(null); } public static void main(String[] args) { DirectoryDialog dd = new DirectoryDialog(); dd.setVisible(true); } { // GUI initializer generated by IntelliJ IDEA GUI Designer // >>> IMPORTANT!! <<< // DO NOT EDIT OR ADD ANY CODE HERE! $$$setupUI$$$(); } /** * Method generated by IntelliJ IDEA GUI Designer * >>> IMPORTANT!! <<< * DO NOT edit this method OR call it in your code! * * @noinspection HardCodedStringLiteral */ private void $$$setupUI$$$() { mainPanel = new JPanel(); mainPanel.setLayout(new GridBagLayout()); mainPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5), null)); chooseDriveComboBox = new JComboBox(); final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel(); defaultComboBoxModel1.addElement("C:\\"); defaultComboBoxModel1.addElement("D:\\"); defaultComboBoxModel1.addElement("E:\\"); chooseDriveComboBox.setModel(defaultComboBoxModel1); GridBagConstraints gbc; gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 1; gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.HORIZONTAL; mainPanel.add(chooseDriveComboBox, gbc); final JLabel label1 = new JLabel(); label1.setText("Choose Drive"); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.weightx = 1.0; gbc.anchor = GridBagConstraints.SOUTHWEST; mainPanel.add(label1, gbc); okButton = new JButton(); okButton.setText("Ok"); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 1; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 0, 0); mainPanel.add(okButton, gbc); final JLabel label2 = new JLabel(); label2.setText("Choose Directory"); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 2; gbc.anchor = GridBagConstraints.SOUTHWEST; mainPanel.add(label2, gbc); cancelButton = new JButton(); cancelButton.setText("Cancel"); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 2; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 10, 0); mainPanel.add(cancelButton, gbc); final JScrollPane scrollPane1 = new JScrollPane(); gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 3; gbc.gridheight = 2; gbc.weightx = 1.0; gbc.weighty = 1.0; gbc.fill = GridBagConstraints.BOTH; mainPanel.add(scrollPane1, gbc); chooseDirectoryTree = new JTree(); scrollPane1.setViewportView(chooseDirectoryTree); projectRootButton = new JButton(); projectRootButton.setText("Project Root..."); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 4; gbc.weighty = 1.0; gbc.anchor = GridBagConstraints.NORTH; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 0, 0); mainPanel.add(projectRootButton, gbc); createNewButton = new JButton(); createNewButton.setText("Create New..."); gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = 3; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(0, 5, 10, 0); mainPanel.add(createNewButton, gbc); label1.setLabelFor(chooseDriveComboBox); label2.setLabelFor(scrollPane1); } public JComponent $$$getRootComponent$$$() { return mainPanel; } private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner non-commercial license mainPanel = new JPanel(); chooseDriveComboBox = new JComboBox(); JLabel label1 = new JLabel(); okButton = new JButton(); JLabel label2 = new JLabel(); cancelButton = new JButton(); JScrollPane scrollPane1 = new JScrollPane(); chooseDirectoryTree = new JTree(); projectRootButton = new JButton(); createNewButton = new JButton(); //======== mainPanel ======== { mainPanel.setBorder(new TitledBorder(new EmptyBorder(5, 5, 5, 5), "")); mainPanel.setLayout(new GridBagLayout()); //---- chooseDriveComboBox ---- chooseDriveComboBox.setModel(new DefaultComboBoxModel(new String[] { "C:\\", "D:\\", "E:\\" })); mainPanel.add(chooseDriveComboBox, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); //---- label1 ---- label1.setText("Choose Drive"); label1.setLabelFor(chooseDriveComboBox); mainPanel.add(label1, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); //---- okButton ---- okButton.setText("Ok"); mainPanel.add(okButton, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 0), 0, 0)); //---- label2 ---- label2.setText("Choose Directory"); label2.setLabelFor(scrollPane1); mainPanel.add(label2, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); //---- cancelButton ---- cancelButton.setText("Cancel"); mainPanel.add(cancelButton, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 10, 0), 0, 0)); //======== scrollPane1 ======== { scrollPane1.setViewportView(chooseDirectoryTree); } mainPanel.add(scrollPane1, new GridBagConstraints(0, 3, 1, 2, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); //---- projectRootButton ---- projectRootButton.setText("Project Root..."); mainPanel.add(projectRootButton, new GridBagConstraints(1, 4, 1, 1, 0.0, 1.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 0), 0, 0)); //---- createNewButton ---- createNewButton.setText("Create New..."); mainPanel.add(createNewButton, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 10, 0), 0, 0)); } // JFormDesigner - End of component initialization //GEN-END:initComponents } // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables // Generated using JFormDesigner non-commercial license private JPanel mainPanel; private JComboBox chooseDriveComboBox; private JButton okButton; private JButton cancelButton; private JTree chooseDirectoryTree; private JButton projectRootButton; private JButton createNewButton; // JFormDesigner - End of variables declaration //GEN-END:variables }