Java Code Examples for com.intellij.ui.JBSplitter#setSplitterProportionKey()

The following examples show how to use com.intellij.ui.JBSplitter#setSplitterProportionKey() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IMPanel.java    From SmartIM4IntelliJ with Apache License 2.0 6 votes vote down vote up
private void initUI() {
    DefaultActionGroup group = new DefaultActionGroup();
    group.add(new LoginAction(this));
    group.add(new HideContactAction(this));
    group.add(new DisconnectAction(this));
    createBroadcastAction(group);
    group.add(new SettingsAction(this));
    MockConsoleAction test = new MockConsoleAction(this);
    //group.add(test);

    ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("SmartQQ", group, false);
    // toolbar.getComponent().addFocusListener(createFocusListener());
    toolbar.setTargetComponent(this);
    setToolbar(toolbar.getComponent());

    left = createContactsUI();
    left.onLoadContacts(false);

    tabbedChat = new ClosableTabHost(this);

    splitter = new JBSplitter(false);
    splitter.setSplitterProportionKey("main.splitter.key");
    splitter.setFirstComponent(left.getPanel());
    splitter.setSecondComponent(tabbedChat);
    splitter.setProportion(0.3f);
    setContent(splitter);
}
 
Example 2
Source File: TextEditorWithPreview.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
@Override
public JComponent getComponent() {
  if (myComponent == null) {
    final JBSplitter splitter = new JBSplitter(false, 0.5f, 0.15f, 0.85f);
    splitter.setSplitterProportionKey(getSplitterProportionKey());
    splitter.setFirstComponent(myEditor.getComponent());
    splitter.setSecondComponent(myPreview.getComponent());

    myToolbarWrapper = new SplitEditorToolbar(splitter);
    myToolbarWrapper.addGutterToTrack(((EditorGutterComponentEx)(myEditor).getEditor().getGutter()));

    if (myPreview instanceof TextEditor) {
      myToolbarWrapper.addGutterToTrack(((EditorGutterComponentEx)((TextEditor)myPreview).getEditor().getGutter()));
    }

    if (myLayout == null) {
      String lastUsed = PropertiesComponent.getInstance().getValue(getLayoutPropertyName());
      myLayout = Layout.fromName(lastUsed, Layout.SHOW_EDITOR_AND_PREVIEW);
    }
    adjustEditorsVisibility();

    myComponent = JBUI.Panels.simplePanel(splitter).addToTop(myToolbarWrapper);
  }
  return myComponent;
}
 
Example 3
Source File: IMChatConsole.java    From SmartIM4IntelliJ with Apache License 2.0 5 votes vote down vote up
public void initUI() {
    top = new ChatHistoryPane();
    bottom = new ChatInputPane();
    historyWidget = top.getEditorPane();
    inputWidget = bottom.getTextPane();
    btnSend = bottom.getBtnSend();
    btnSend.setVisible(SmartIMSettings.getInstance().getState().SHOW_SEND);
    btnSend.addActionListener(new SendAction());
    inputWidget.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "Send");
    inputWidget.getActionMap().put("Send", btnSend.getAction());

    splitter = new JBSplitter(true);
    splitter.setSplitterProportionKey("chat.splitter.key");
    splitter.setFirstComponent(top.getPanel());
    splitter.setSecondComponent(bottom.getPanel());
    setContent(splitter);
    splitter.setPreferredSize(new Dimension(-1, 200));
    splitter.setProportion(0.85f);

    inputWidget.addKeyListener(new KeyAdapter() {
        @Override public void keyPressed(KeyEvent e) {
            super.keyPressed(e);
            if (SmartIMSettings.getInstance().getState().KEY_SEND.equals(SwingUtils.key2string(e))) {
                String input = inputWidget.getText();
                if (!input.isEmpty()) {
                    inputWidget.setText("");
                    send(input);
                }
                e.consume();
            }
        }
    });
    initToolBar();
    initHistoryWidget();
}
 
Example 4
Source File: CodeFragmentInputComponent.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void addComponent(JPanel contentPanel, JPanel resultPanel) {
  final JBSplitter splitter = new JBSplitter(true, 0.3f, 0.2f, 0.7f);
  splitter.setSplitterProportionKey(mySplitterProportionKey);
  contentPanel.add(splitter, BorderLayout.CENTER);
  splitter.setFirstComponent(myMainPanel);
  splitter.setSecondComponent(resultPanel);
}