コード例 #1
0
 /**
  * Creates a menu item.
  *
  * @param index The index associated to the item.
  * @return See above.
  */
 private JCheckBoxMenuItem createMenuItem(int index) {
   JCheckBoxMenuItem item = new JCheckBoxMenuItem(NAMES[index]);
   Font f = item.getFont();
   item.setFont(f.deriveFont(f.getStyle(), f.getSize() - 2));
   item.setSelected(filter == index);
   item.addActionListener(this);
   item.setActionCommand("" + index);
   return item;
 }
コード例 #2
0
ファイル: Calculator.java プロジェクト: CurtainTears/Mygit
  public Calculator() {
    super("科学计算器"); // 设置标题栏

    df = new DecimalFormat("#.####"); // 保留四位小数

    this.setLayout(new BorderLayout(10, 5));
    panel1 = new JPanel(new GridLayout(1, 3, 10, 10));
    panel2 = new JPanel(new GridLayout(5, 6, 5, 5)); // 5行6列
    panel3 = new JPanel(new GridLayout(5, 1, 5, 5));
    panel4 = new JPanel(new BorderLayout(5, 5));

    /** 菜单栏 */
    myBar = new JMenuBar();
    menu1 = new JMenu("编辑(E)");
    menu2 = new JMenu("查看(V)");
    menu3 = new JMenu("帮助(H)");

    menu1.setFont(new Font("宋体", Font.PLAIN, 12));
    menu2.setFont(new Font("宋体", Font.PLAIN, 12));
    menu3.setFont(new Font("宋体", Font.PLAIN, 12));

    /** 编辑栏 */
    editItem1 = new JMenuItem("复制(C) Ctrl+C");
    editItem2 = new JMenuItem("粘贴(P) Ctrl+V");

    editItem1.setFont(new Font("宋体", Font.PLAIN, 12));
    editItem2.setFont(new Font("宋体", Font.PLAIN, 12));

    /** 查看栏 */
    seeItem1 = new JRadioButtonMenuItem("科学型(T)");
    seeItem2 = new JRadioButtonMenuItem("标准型(S)");
    seeItem3 = new JCheckBoxMenuItem("数字分组(I)");
    seeItem1.setFont(new Font("宋体", Font.PLAIN, 12));
    seeItem2.setFont(new Font("宋体", Font.PLAIN, 12));
    seeItem3.setFont(new Font("宋体", Font.PLAIN, 12));

    /** 帮助栏 */
    help1 = new JMenuItem("帮助主题(H)");
    help2 = new JMenuItem("关于计算器(A)");

    help1.setFont(new Font("宋体", Font.PLAIN, 12));
    help2.setFont(new Font("宋体", Font.PLAIN, 12));
    new ButtonGroup();
    menu1.add(editItem1);
    menu1.add(editItem2);
    menu2.add(seeItem1);
    menu2.add(seeItem2);
    menu2.addSeparator(); // 添加一条分割线
    menu2.add(seeItem3);

    menu3.add(help1);
    menu3.addSeparator(); // 添加一条分割线
    menu3.add(help2);

    myBar.add(menu1);
    myBar.add(menu2);
    myBar.add(menu3);

    this.setJMenuBar(myBar);

    numActionListener = new Num(); // 实现数字监听

    /** 文本域,即为计算器的屏幕显示区域 */
    tf = new JTextField();
    tf.setEditable(false); // 文本区域不可编辑
    tf.setBackground(Color.white); // 文本区域的背景色
    tf.setHorizontalAlignment(JTextField.RIGHT); // 文字右对齐
    tf.setText("0");
    tf.setBorder(BorderFactory.createLoweredBevelBorder());
    init(); // 对计算器进行初始化
  }
コード例 #3
0
ファイル: Check.java プロジェクト: charlesa101/insubstantial
  public Check() {
    super(
        "Substance test with very very very very very very very very very very very very very very long title");

    final ClassLoader cl = Thread.currentThread().getContextClassLoader();
    if (UIManager.getLookAndFeel() instanceof SubstanceLookAndFeel) {
      setIconImage(
          SubstanceLogo.getLogoImage(
              SubstanceLookAndFeel.getCurrentSkin(this.getRootPane())
                  .getColorScheme(
                      DecorationAreaType.PRIMARY_TITLE_PANE,
                      ColorSchemeAssociationKind.FILL,
                      ComponentState.ENABLED)));
    }
    SubstanceLookAndFeel.registerSkinChangeListener(
        new SkinChangeListener() {
          @Override
          public void skinChanged() {
            SwingUtilities.invokeLater(
                new Runnable() {
                  @Override
                  public void run() {
                    setIconImage(
                        SubstanceLogo.getLogoImage(
                            SubstanceLookAndFeel.getCurrentSkin(Check.this.getRootPane())
                                .getColorScheme(
                                    DecorationAreaType.PRIMARY_TITLE_PANE,
                                    ColorSchemeAssociationKind.FILL,
                                    ComponentState.ENABLED)));
                  }
                });
          }
        });

    setLayout(new BorderLayout());

    jtp = new JTabbedPane();
    try {
      mainTabPreviewPainter = new MyMainTabPreviewPainter();
      jtp.putClientProperty(LafWidget.TABBED_PANE_PREVIEW_PAINTER, mainTabPreviewPainter);
    } catch (Throwable e) {
    }
    jtp.getModel().addChangeListener(new TabSwitchListener());

    final JXPanel jxPanel = new JXPanel(new BorderLayout());
    toolbar = getToolbar("", 22, true);
    jxPanel.add(toolbar, BorderLayout.NORTH);

    JXStatusBar statusBar = getStatusBar(jxPanel, jtp);
    this.add(statusBar, BorderLayout.SOUTH);

    taskPaneContainer =
        new JXTaskPaneContainer() {
          @Override
          public boolean getScrollableTracksViewportWidth() {
            return false;
          }
        };
    taskPaneContainer.setScrollableTracksViewportHeight(false);
    taskPaneContainer.setScrollableTracksViewportWidth(false);

    mainTaskPane = new JXTaskPane();
    mainTaskPane.setLayout(new BorderLayout());
    JPanel mainControlPanel =
        ControlPanelFactory.getMainControlPanel(this, jtp, mainTabPreviewPainter, toolbar);
    // mainControlPanel.setOpaque(false);
    mainTaskPane.add(mainControlPanel, BorderLayout.CENTER);
    mainTaskPane.setTitle("General settings");
    mainTaskPane.setIcon(getIcon("JFrameColor16"));
    mainTaskPane.setCollapsed(true);
    taskPaneContainer.add(mainTaskPane);

    JPanel dialogControlPanel = ControlPanelFactory.getDialogControlPanel(this);
    JXTaskPane dialogTaskPane = new JXTaskPane();
    dialogTaskPane.setLayout(new BorderLayout());
    dialogTaskPane.add(dialogControlPanel, BorderLayout.CENTER);
    dialogTaskPane.setTitle("Frames & Dialogs");
    dialogTaskPane.setIcon(getIcon("JDialogColor16"));
    dialogTaskPane.setCollapsed(true);
    // dialogTaskPane.setOpaque(false);
    taskPaneContainer.add(dialogTaskPane);

    currentSpecificTaskPane = null;

    final JScrollPane scrollPane =
        new JScrollPane(
            taskPaneContainer,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    SubstanceLookAndFeel.setDecorationType(scrollPane, DecorationAreaType.GENERAL);
    // scrollPane.setOpaque(false);
    // scrollPane.getViewport().setOpaque(false);

    JPanel mainPanel = new JPanel();
    mainPanel.add(scrollPane);
    mainPanel.add(jtp);
    mainPanel.setLayout(
        new LayoutManager() {
          @Override
          public void addLayoutComponent(String name, Component comp) {}

          @Override
          public Dimension minimumLayoutSize(Container parent) {
            Dimension min1 = scrollPane.getMinimumSize();
            Dimension min2 = jtp.getMinimumSize();
            return new Dimension(min1.width + min2.width, min1.height + min2.height);
          }

          @Override
          public void layoutContainer(Container parent) {
            // give 30% width to task pane container and
            // 70% width to the tabbed pane with controls.
            int width = parent.getWidth();
            int height = parent.getHeight();
            scrollPane.setBounds(0, 0, (int) (0.3 * width), height);
            jtp.setBounds((int) (0.3 * width), 0, width - (int) (0.3 * width), height);
          }

          @Override
          public Dimension preferredLayoutSize(Container parent) {
            Dimension pref1 = scrollPane.getPreferredSize();
            Dimension pref2 = jtp.getPreferredSize();
            return new Dimension(pref1.width + pref2.width, pref1.height + pref2.height);
          }

          @Override
          public void removeLayoutComponent(Component comp) {}
        });
    jxPanel.add(mainPanel, BorderLayout.CENTER);

    this.add(jxPanel, BorderLayout.CENTER);

    setPreferredSize(new Dimension(400, 400));
    this.setSize(getPreferredSize());
    setMinimumSize(getPreferredSize());

    ButtonsPanel buttonsPanel = new ButtonsPanel();
    jtp.addTab("Buttons", getIcon("JButtonColor16"), buttonsPanel);
    getRootPane().setDefaultButton(buttonsPanel.defaultButton);

    jtp.addTab("Combo box", getIcon("JComboBoxColor16"), new CombosPanel());

    jtp.addTab("Scroll pane", getIcon("JScrollPaneColor16"), new ScrollPanel());

    TabCloseCallback closeCallback =
        new TabCloseCallback() {
          @Override
          public TabCloseKind onAreaClick(
              JTabbedPane tabbedPane, int tabIndex, MouseEvent mouseEvent) {
            if (mouseEvent.getButton() != MouseEvent.BUTTON3) return TabCloseKind.NONE;
            if (mouseEvent.isShiftDown()) {
              return TabCloseKind.ALL;
            }
            return TabCloseKind.THIS;
          }

          @Override
          public TabCloseKind onCloseButtonClick(
              JTabbedPane tabbedPane, int tabIndex, MouseEvent mouseEvent) {
            if (mouseEvent.isAltDown()) {
              return TabCloseKind.ALL_BUT_THIS;
            }
            if (mouseEvent.isShiftDown()) {
              return TabCloseKind.ALL;
            }
            return TabCloseKind.THIS;
          }

          @Override
          public String getAreaTooltip(JTabbedPane tabbedPane, int tabIndex) {
            return null;
          }

          @Override
          public String getCloseButtonTooltip(JTabbedPane tabbedPane, int tabIndex) {
            StringBuffer result = new StringBuffer();
            result.append("<html><body>");
            result.append("Mouse click closes <b>" + tabbedPane.getTitleAt(tabIndex) + "</b> tab");
            result.append(
                "<br><b>Alt</b>-Mouse click closes all tabs but <b>"
                    + tabbedPane.getTitleAt(tabIndex)
                    + "</b> tab");
            result.append("<br><b>Shift</b>-Mouse click closes all tabs");
            result.append("</body></html>");
            return result.toString();
          }
        };

    try {
      TabPanel tp = new TabPanel();
      tp.jtp.putClientProperty(SubstanceLookAndFeel.TABBED_PANE_CLOSE_CALLBACK, closeCallback);
      jtp.addTab("Tabs", getIcon("JTabbedPaneColor16"), tp);
    } catch (NoClassDefFoundError ncdfe) {
    }

    jtp.addTab("Split", new SplitPanel());

    jtp.addTab("Desktop", getIcon("JDesktopPaneColor16"), new DesktopPanel());

    jtp.addTab("Text fields", getIcon("JTextPaneColor16"), new TextFieldsPanel());

    jtp.addTab("Table", getIcon("JTableColor16"), new TablePanel());

    try {
      jtp.addTab("List", getIcon("JListColor16"), new ListPanel());
    } catch (NoClassDefFoundError ncdfe) {
    }

    jtp.addTab("Slider", getIcon("JSliderColor16"), new SliderPanel());

    jtp.addTab("Progress bar", getIcon("JProgressBarColor16"), new ProgressBarPanel());

    jtp.addTab("Spinner", getIcon("JSpinnerColor16"), new SpinnerPanel());

    jtp.addTab("Tree", getIcon("JTreeColor16"), new TreePanel());

    jtp.addTab("File tree", getIcon("JTreeColor16"), new FileTreePanel());

    jtp.addTab("Cards", new CardPanel());

    JPanel verticalButtonPanel = new JPanel();
    verticalButtonPanel.setLayout(new GridLayout(1, 3));
    verticalButtonPanel.add(new JButton("Vert button 1"));
    verticalButtonPanel.add(new JButton("Vert button 2"));
    JPanel smallVerticalButtonPanel = new JPanel();
    smallVerticalButtonPanel.setLayout(new GridLayout(4, 4));
    for (int row = 0; row < 4; row++) {
      for (int col = 0; col < 4; col++) {
        JButton vertButton = new JButton("vert");
        vertButton.setToolTipText("Vertical button " + row + ":" + col);
        smallVerticalButtonPanel.add(vertButton);
      }
    }
    verticalButtonPanel.add(smallVerticalButtonPanel);
    jtp.addTab("V-Buttons", verticalButtonPanel);

    jtp.addTab("Colored", new ColoredControlsPanel());

    jtp.addTab("Colorized", new ColorizedControlsPanel());

    jtp.addTab("Cells", new CellsPanel());

    jtp.addTab("Sizes", new SizesPanel());

    jtp.addTab("H-Align", new HAlignmentPanel());

    jtp.addTab("V-Align", new VAlignmentPanel());

    // sample menu bar
    JMenuBar jmb = new JMenuBar();
    if (UIManager.getLookAndFeel() instanceof SubstanceLookAndFeel) {
      jmb.add(SampleMenuFactory.getSkinMenu());
      jmb.add(SampleMenuFactory.getTransformMenu());
    }
    JMenu coloredMenu = new JMenu("Colors");
    coloredMenu.setMnemonic('0');
    JMenuItem coloredMI = new JMenuItem("Italic red");
    coloredMI.setFont(coloredMI.getFont().deriveFont(Font.ITALIC));
    coloredMI.setForeground(Color.red);
    coloredMenu.add(coloredMI);
    JRadioButtonMenuItem coloredRBMI = new JRadioButtonMenuItem("Bold green");
    coloredRBMI.setFont(coloredRBMI.getFont().deriveFont(Font.BOLD));
    coloredRBMI.setForeground(Color.green);
    coloredMenu.add(coloredRBMI);
    JCheckBoxMenuItem coloredCBMI = new JCheckBoxMenuItem("Big blue");
    coloredCBMI.setFont(coloredCBMI.getFont().deriveFont(32f));
    coloredCBMI.setForeground(Color.blue);
    coloredMenu.add(coloredCBMI);
    JMenu coloredM = new JMenu("Always big magenta");
    coloredM.setForeground(Color.magenta);
    coloredM.setFont(coloredM.getFont().deriveFont(24f));
    coloredMenu.add(coloredM);
    jmb.add(coloredMenu);

    JMenu testMenu = SampleMenuFactory.getTestMenu();
    jmb.add(testMenu);

    JMenu jm4 = new JMenu("Disabled");
    jm4.add(new JMenuItem("dummy4"));
    jm4.setMnemonic('4');
    jmb.add(jm4);
    jm4.setEnabled(false);

    // LAF changing
    jmb.add(SampleMenuFactory.getLookAndFeelMenu(this));
    setJMenuBar(jmb);

    TabCloseCallback closeCallbackMain =
        new TabCloseCallback() {
          @Override
          public TabCloseKind onAreaClick(
              JTabbedPane tabbedPane, int tabIndex, MouseEvent mouseEvent) {
            if (mouseEvent.getButton() != MouseEvent.BUTTON2) return TabCloseKind.NONE;
            if (mouseEvent.isShiftDown()) {
              return TabCloseKind.ALL;
            }
            return TabCloseKind.THIS;
          }

          @Override
          public TabCloseKind onCloseButtonClick(
              JTabbedPane tabbedPane, int tabIndex, MouseEvent mouseEvent) {
            if (mouseEvent.isAltDown()) {
              return TabCloseKind.ALL_BUT_THIS;
            }
            if (mouseEvent.isShiftDown()) {
              return TabCloseKind.ALL;
            }
            return TabCloseKind.THIS;
          }

          @Override
          public String getAreaTooltip(JTabbedPane tabbedPane, int tabIndex) {
            return null;
          }

          @Override
          public String getCloseButtonTooltip(JTabbedPane tabbedPane, int tabIndex) {
            StringBuffer result = new StringBuffer();
            result.append("<html><body>");
            result.append("Mouse click closes <b>" + tabbedPane.getTitleAt(tabIndex) + "</b> tab");
            result.append(
                "<br><b>Alt</b>-Mouse click closes all tabs but <b>"
                    + tabbedPane.getTitleAt(tabIndex)
                    + "</b> tab");
            result.append("<br><b>Shift</b>-Mouse click closes all tabs");
            result.append("</body></html>");
            return result.toString();
          }
        };

    jtp.putClientProperty(SubstanceLookAndFeel.TABBED_PANE_CLOSE_CALLBACK, closeCallbackMain);
    SubstanceLookAndFeel.registerTabCloseChangeListener(
        new TabCloseListener() {
          @Override
          public void tabClosed(JTabbedPane tabbedPane, Component tabComponent) {
            out("Closed tab");
          }

          @Override
          public void tabClosing(JTabbedPane tabbedPane, Component tabComponent) {
            out("Closing tab");
          }
        });

    SubstanceLookAndFeel.registerTabCloseChangeListener(
        jtp,
        new VetoableTabCloseListener() {
          @Override
          public void tabClosed(JTabbedPane tabbedPane, Component tabComponent) {
            out("Closed tab - specific");
          }

          @Override
          public void tabClosing(JTabbedPane tabbedPane, Component tabComponent) {
            out("Closing tab - specific");
          }

          @Override
          public boolean vetoTabClosing(JTabbedPane tabbedPane, Component tabComponent) {
            int userCloseAnswer =
                JOptionPane.showConfirmDialog(
                    Check.this,
                    "Are you sure you want to close '"
                        + tabbedPane.getTitleAt(tabbedPane.indexOfComponent(tabComponent))
                        + "' tab?",
                    "Confirm dialog",
                    JOptionPane.YES_NO_OPTION);
            return (userCloseAnswer == JOptionPane.NO_OPTION);
          }
        });

    SubstanceLookAndFeel.registerTabCloseChangeListener(
        jtp,
        new VetoableMultipleTabCloseListener() {
          @Override
          public void tabsClosed(JTabbedPane tabbedPane, Set<Component> tabComponents) {
            out("Closed " + tabComponents.size() + " tabs - specific");
          }

          @Override
          public void tabsClosing(JTabbedPane tabbedPane, Set<Component> tabComponents) {
            out("Closing " + tabComponents.size() + " tabs - specific");
          }

          @Override
          public boolean vetoTabsClosing(JTabbedPane tabbedPane, Set<Component> tabComponents) {
            int userCloseAnswer =
                JOptionPane.showConfirmDialog(
                    Check.this,
                    "Are you sure you want to close " + tabComponents.size() + " tabs?",
                    "Confirm dialog",
                    JOptionPane.YES_NO_OPTION);
            return (userCloseAnswer == JOptionPane.NO_OPTION);
          }
        });

    addComponentListener(
        new ComponentAdapter() {
          @Override
          public void componentResized(ComponentEvent e) {
            System.out.println("Size " + getSize());
          }
        });
  }
コード例 #4
0
  public SpeedyGraderInterface() {
    super("SpeedyGrader");

    this.setSize(1000, 500);

    BufferedImage icon = null;
    try {
      icon = ImageIO.read(new File("img" + File.separator + "speedygrader-icon.png"));
    } catch (IOException e) {
      try {
        icon =
            ImageIO.read(SpeedyGraderInterface.class.getResourceAsStream("/speedygrader-icon.png"));
      } catch (IOException e2) {
        e2.printStackTrace();
      }
    }

    this.setIconImage(icon);

    textFont = new Font("Consolas", 0, 16);

    menuBar = new JMenuBar();

    JMenu fileMenu = new JMenu("  File  ");
    fileMenu.setMnemonic(KeyEvent.VK_F);

    openItem = new JMenuItem("Select Folder");
    openItem.setToolTipText("The folder that contains the source files.");
    openItem.addActionListener(this);
    openItem.setFont(textFont);
    openItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK));

    inputItem = new JMenuItem("Set Input");
    inputItem.addActionListener(this);
    inputItem.setFont(textFont);
    inputItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_I, ActionEvent.CTRL_MASK));

    saveItem = new JMenuItem("Save All and Run");
    saveItem.addActionListener(this);
    saveItem.setFont(textFont);
    saveItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK));

    fileMenu.add(openItem);
    fileMenu.add(inputItem);
    fileMenu.add(saveItem);

    JMenu optionsMenu = new JMenu(" Options ");
    optionsMenu.setMnemonic(KeyEvent.VK_O);

    refreshItem = new JMenuItem("Refresh Folder");
    refreshItem.setFont(textFont);
    refreshItem.addActionListener(this);
    refreshItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, ActionEvent.CTRL_MASK));
    optionsMenu.add(refreshItem);

    timeoutPrograms = new JCheckBoxMenuItem("Timeout Programs");
    timeoutPrograms.setSelected(true);
    timeoutPrograms.setFont(textFont);
    timeoutPrograms.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, ActionEvent.CTRL_MASK));
    optionsMenu.add(timeoutPrograms);

    editorSplitToggle = new JCheckBoxMenuItem("Split editor/console vertically");
    editorSplitToggle.setSelected(true);
    editorSplitToggle.setFont(textFont);
    editorSplitToggle.setAccelerator(
        KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK | ActionEvent.ALT_MASK));
    editorSplitToggle.addActionListener(this);
    optionsMenu.add(editorSplitToggle);

    JMenu helpMenu = new JMenu("  Help  ");
    helpMenu.setMnemonic(KeyEvent.VK_H);

    aboutItem = new JMenuItem("About");
    aboutItem.setFont(textFont);
    aboutItem.addActionListener(this);
    aboutItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, ActionEvent.CTRL_MASK));
    helpMenu.add(aboutItem);

    githubItem = new JMenuItem("Open Github");
    githubItem.setFont(textFont);
    githubItem.addActionListener(this);
    githubItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_G, ActionEvent.CTRL_MASK));
    helpMenu.add(githubItem);

    upgradeItem = new JMenuItem("Check for Update");
    upgradeItem.setFont(textFont);
    upgradeItem.addActionListener(this);
    upgradeItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_U, ActionEvent.CTRL_MASK));
    helpMenu.add(upgradeItem);

    installItem = new JMenuItem("Install Instructions");
    installItem.setFont(textFont);
    installItem.addActionListener(this);
    installItem.setAccelerator(
        KeyStroke.getKeyStroke(KeyEvent.VK_I, ActionEvent.CTRL_MASK | ActionEvent.ALT_MASK));
    helpMenu.add(installItem);

    menuBar.add(fileMenu);
    menuBar.add(optionsMenu);
    menuBar.add(helpMenu);

    this.setJMenuBar(menuBar);

    filesList = new JList<SourceFile>();

    filesList.setSelectionMode(JList.VERTICAL);
    filesList.setLayoutOrientation(JList.VERTICAL);
    filesList.setVisibleRowCount(-1);
    filesList.addListSelectionListener(this);
    filesList.setFont(textFont);

    filesListModel = new DefaultListModel<SourceFile>();

    filesList.setModel(filesListModel);

    tabbedPane = new JTabbedPane(JTabbedPane.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);

    editorPanels = new ArrayList<EditorPanel>();

    consoleTextArea = new JTextArea();
    consoleTextArea.setEditable(false);
    consoleTextArea.setFont(textFont);

    splitEditorPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    splitEditorPane.add(tabbedPane);
    splitEditorPane.add(new JScrollPane(consoleTextArea));
    splitEditorPane.setDividerLocation(.8);

    splitMainPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    splitMainPane.add(new JScrollPane(filesList));
    splitMainPane.add(splitEditorPane);
    splitMainPane.setDividerLocation(.2);

    this.setDefaultCloseOperation(EXIT_ON_CLOSE);
    this.setLocationRelativeTo(null);
    this.add(splitMainPane);
    this.setVisible(true);
  }