コード例 #1
1
ファイル: Browser.java プロジェクト: tdanford/nrc-wildlife
  public BrowserFrame(Browser b) {
    super("Cavity Nesting DB Browser");
    browser = b;

    JPanel content = new JPanel(new BorderLayout());
    content.setOpaque(true);
    setContentPane(content);

    content.add(browser, BorderLayout.CENTER);

    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

    addWindowListener(
        new WindowAdapter() {
          public void windowClosed(WindowEvent e) {
            browser.closeBrowser();
          }
        });

    createJMenuBar();
    setJMenuBar(menubar);

    setVisible(true);
    pack();
  }
コード例 #2
0
  public DynamicTree() {
    super(new GridLayout(1, 0));
    rootNode = new JscTreeNode("Vitenfabrikken");
    treeModel = new DefaultTreeModel(rootNode);

    tree = new JTree(treeModel);
    tree.setEditable(false);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    tree.setShowsRootHandles(true);
    tree.addTreeSelectionListener(this);

    JPanel content = new JPanel(new BorderLayout(0, 0));

    JScrollPane scrollPane = new JScrollPane(tree);
    scrollPane.setSize(500, 300);
    scrollPane.setBorder(BorderFactory.createTitledBorder("Maskiner"));
    content.add(scrollPane);
    // add(scrollPane);

    currentSelectionField = new JTextField("Valgt: NONE");
    // currentSelectionField.setSize(500, 15);
    currentSelectionField.setMaximumSize(new Dimension(500, 15));
    content.add(currentSelectionField, BorderLayout.SOUTH);
    // add(currentSelectionField);
    // content.setPreferredSize(new Dimension(500, 315));

    add(content);
    setSize(500, 315);
  }
コード例 #3
0
  private void initGUI() {

    JPanel pCommand = new JPanel();

    pResult = new JPanel();
    nsSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, pCommand, pResult);

    pCommand.setLayout(new BorderLayout());
    pResult.setLayout(new BorderLayout());

    Font fFont = new Font("Dialog", Font.PLAIN, 12);

    txtCommand = new JTextArea(5, 40);

    txtCommand.setMargin(new Insets(5, 5, 5, 5));
    txtCommand.addKeyListener(this);

    txtCommandScroll = new JScrollPane(txtCommand);
    txtResult = new JTextArea(20, 40);

    txtResult.setMargin(new Insets(5, 5, 5, 5));

    txtResultScroll = new JScrollPane(txtResult);

    txtCommand.setFont(fFont);
    txtResult.setFont(new Font("Courier", Font.PLAIN, 12));
    /*
    // button replaced by toolbar
            butExecute = new JButton("Execute");

            butExecute.addActionListener(this);
            pCommand.add(butExecute, BorderLayout.EAST);
    */
    pCommand.add(txtCommandScroll, BorderLayout.CENTER);

    gResult = new GridSwing();
    gResultTable = new JTable(gResult);
    gScrollPane = new JScrollPane(gResultTable);

    // getContentPane().setLayout(new BorderLayout());
    pResult.add(gScrollPane, BorderLayout.CENTER);

    // Set up the tree
    rootNode = new DefaultMutableTreeNode("Connection");
    treeModel = new DefaultTreeModel(rootNode);
    tTree = new JTree(treeModel);
    tScrollPane = new JScrollPane(tTree);

    tScrollPane.setPreferredSize(new Dimension(120, 400));
    tScrollPane.setMinimumSize(new Dimension(70, 100));
    txtCommandScroll.setPreferredSize(new Dimension(360, 100));
    txtCommandScroll.setMinimumSize(new Dimension(180, 100));
    gScrollPane.setPreferredSize(new Dimension(460, 300));

    ewSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, tScrollPane, nsSplitPane);

    fMain.getContentPane().add(ewSplitPane, BorderLayout.CENTER);
    doLayout();
    fMain.pack();
  }
コード例 #4
0
ファイル: MainPanel.java プロジェクト: mhcrnl/java-swing-tips
 private JComponent makeTitledPanel(String title, JTree tree) {
   JPanel p = new JPanel(new BorderLayout());
   p.setBorder(BorderFactory.createTitledBorder(title));
   p.add(new JScrollPane(tree));
   tree.setRowHeight(0);
   return p;
 }
コード例 #5
0
  private void setupCentralPanel() {
    myCentralPanel.removeAll();
    if (myUsagePreviewPanel != null) {
      Disposer.dispose(myUsagePreviewPanel);
      myUsagePreviewPanel = null;
    }
    JScrollPane pane = ScrollPaneFactory.createScrollPane(myTree);

    if (UsageViewSettings.getInstance().IS_PREVIEW_USAGES) {
      Splitter splitter =
          new Splitter(false, UsageViewSettings.getInstance().PREVIEW_USAGES_SPLITTER_PROPORTIONS);
      pane.putClientProperty(UIUtil.KEEP_BORDER_SIDES, SideBorder.RIGHT);

      splitter.setFirstComponent(pane);
      myUsagePreviewPanel = new UsagePreviewPanel(myProject);
      myUsagePreviewPanel.setBorder(IdeBorderFactory.createBorder(SideBorder.LEFT));
      Disposer.register(this, myUsagePreviewPanel);
      splitter.setSecondComponent(myUsagePreviewPanel);
      myCentralPanel.add(splitter, BorderLayout.CENTER);
    } else {
      myCentralPanel.add(pane, BorderLayout.CENTER);
    }
    myCentralPanel.add(myButtonPanel, BorderLayout.SOUTH);

    myRootPanel.revalidate();
  }
コード例 #6
0
    public ReplicatedTreeView(ReplicatedTree tree, Object title) throws Exception {
      this.tree = tree;
      tree.addReplicatedTreeListener(this);

      addNotify();
      setTitle("ReplicatedTreeDemo: mbr=" + title);

      tree_model = new DefaultTreeModel(root);
      jtree = new JTree(tree_model);
      jtree.setDoubleBuffered(true);
      jtree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

      JScrollPane scroll_pane = new JScrollPane(jtree);

      populateTree();

      getContentPane().add(scroll_pane, BorderLayout.CENTER);
      addWindowListener(this);

      table_model.setColumnIdentifiers(new String[] {"Name", "Value"});
      table_model.addTableModelListener(this);

      setTableColumnWidths();

      tablePanel = new JPanel();
      tablePanel.setLayout(new BorderLayout());
      tablePanel.add(table.getTableHeader(), BorderLayout.NORTH);
      tablePanel.add(table, BorderLayout.CENTER);

      getContentPane().add(tablePanel, BorderLayout.SOUTH);

      jtree.addTreeSelectionListener(this); // REVISIT

      MouseListener ml =
          new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
              int selRow = jtree.getRowForLocation(e.getX(), e.getY());
              TreePath selPath = jtree.getPathForLocation(e.getX(), e.getY());
              if (selRow != -1) {
                selected_node = makeFQN(selPath.getPath());
                jtree.setSelectionPath(selPath);

                if (e.getModifiers() == java.awt.event.InputEvent.BUTTON3_MASK) {
                  operationsPopup.show(e.getComponent(), e.getX(), e.getY());
                }
              }
            }
          };

      jtree.addMouseListener(ml);

      createMenus();
      setLocation(50, 50);
      setSize(
          getInsets().left + getInsets().right + 485, getInsets().top + getInsets().bottom + 367);

      init();
      setVisible(true);
    }
コード例 #7
0
ファイル: InputFrame.java プロジェクト: raniaics/sip-creator
 private JPanel createRecordButtonPanel() {
   JPanel p = new JPanel(new BorderLayout());
   p.setBorder(BorderFactory.createTitledBorder("Filter"));
   p.add(filterBox, BorderLayout.WEST);
   p.add(filterField, BorderLayout.CENTER);
   p.add(createButtonPanel(), BorderLayout.SOUTH);
   return p;
 }
コード例 #8
0
 void addTextField(JPanel panel, String key, String label) {
   JLabel lab = new JLabel(label);
   lab.setAlignmentX(LEFT_ALIGNMENT);
   panel.add(lab);
   JTextField field = new JTextField();
   field.setText(sketch.configFile.get(key));
   field.setMaximumSize(new Dimension(Integer.MAX_VALUE, field.getPreferredSize().height));
   fields.put(key, field);
   panel.add(field);
 }
コード例 #9
0
  public JPanel makeFileTable() {
    JPanel right = new JPanel();
    right.setLayout(new BorderLayout());
    right.setOpaque(true);
    // right.setBackground( Color.white );

    JTreeTableAdmin treeTable = new JTreeTableAdmin(new FileSystemModelAdmin());
    right.add(new JScrollPane(treeTable), BorderLayout.CENTER);

    return right;
  }
コード例 #10
0
  @Override
  protected void init() {
    super.init();

    myPanel.setLayout(new GridBagLayout());
    initTables();

    myTreeTable = createOptionsTree(getSettings());
    myTreeTable.setBackground(UIUtil.getPanelBackground());
    myTreeTable.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
    JBScrollPane scrollPane =
        new JBScrollPane(myTreeTable) {
          @Override
          public Dimension getMinimumSize() {
            return super.getPreferredSize();
          }
        };
    myPanel.add(
        scrollPane,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            0,
            1,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 0),
            0,
            0));

    final JPanel previewPanel = createPreviewPanel();
    myPanel.add(
        previewPanel,
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            1,
            1,
            GridBagConstraints.CENTER,
            GridBagConstraints.BOTH,
            new Insets(0, 0, 0, 0),
            0,
            0));

    installPreviewPanel(previewPanel);
    addPanelToWatch(myPanel);

    isFirstUpdate = false;
    customizeSettings();
  }
コード例 #11
0
ファイル: TreeEditFame.java プロジェクト: noelvillaman/java
  public void makeButton() {
    JPanel panel = new JPanel();
    JButton addSiblingButton = new JButton("Add Sibling");
    addSiblingButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            DefaultMutableTreeNode selectedNode =
                (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
            if (selectedNode == null) return;
            DefaultMutableTreeNode parent = (DefaultMutableTreeNode) selectedNode.getParent();
            if (parent == null) return;
            DefaultMutableTreeNode newNode = new DefaultMutableTreeNode("New");
            int selectedIndex = parent.getIndex(selectedNode);
            model.insertNodeInto(newNode, parent, selectedIndex + 1);
            // now display new node

            TreeNode[] nodes = model.getPathToRoot(newNode);
            TreePath path = new TreePath(nodes);
            tree.scrollPathToVisible(path);
          }
        });
    panel.add(addSiblingButton);
    JButton addChildButton = new JButton("Add child");
    addChildButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            DefaultMutableTreeNode selectedNode =
                (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
            if (selectedNode == null) return;
            DefaultMutableTreeNode newNode = new DefaultMutableTreeNode("New");
            model.insertNodeInto(newNode, selectedNode, selectedNode.getChildCount());
            // now display new node

            TreeNode[] nodes = model.getPathToRoot(newNode);
            TreePath path = new TreePath(nodes);
            tree.scrollPathToVisible(path);
          }
        });
    panel.add(addChildButton);

    JButton deletedButton = new JButton("Delete");
    deletedButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            DefaultMutableTreeNode selectedNode =
                (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
            if (selectedNode != null && selectedNode.getParent() != null)
              model.removeNodeFromParent(selectedNode);
          }
        });
    panel.add(deletedButton);
    add(panel, BorderLayout.SOUTH);
  }
コード例 #12
0
 void addTextArea(JPanel panel, String key, String label) {
   JLabel lab = new JLabel(label);
   lab.setAlignmentX(LEFT_ALIGNMENT);
   panel.add(lab);
   JTextArea field = new JTextArea();
   field.setText(sketch.configFile.get(key));
   field.setLineWrap(true);
   field.setWrapStyleWord(true);
   fields.put(key, field);
   JScrollPane scroll = new JScrollPane(field);
   scroll.setAlignmentX(0.0f);
   panel.add(scroll);
 }
コード例 #13
0
    protected void layoutUIComponents(String strPath, boolean bDefaultFile) {
      JLabel label = null;

      // i18n
      // label = new JLabel( "File names can be constructed from a template. The LABEL field is " );
      label =
          new JLabel(
              Util.getAdmLabel(
                  "_admin_File_names_can_be_constructed_from_a_template._The_LABEL_field_is_"));
      label.setForeground(Color.black);
      // m_gbc.weightx = 0.5;
      showInstruction(m_gbl, m_gbc, 0, 0, 7, label);

      // i18n
      // label = new JLabel( "presented as the choice to the user in the \"Data save\" pop-up." );
      label =
          new JLabel(
              Util.getAdmLabel(
                  "_admin_presented_as_the_choice_to_the_user_in_the_Data_save_pop-up."));
      showInstruction(m_gbl, m_gbc, 0, 1, 7, label);
      showInstruction(m_gbl, m_gbc, 0, 2, 1, new JLabel(""));

      label = new JLabel(Util.getAdmLabel("_adm_LABEL"));
      label.setForeground(Color.black);
      m_gbc.gridx = 1;
      m_gbc.gridy = 2;
      m_gbc.ipadx = 10;
      m_gbl.setConstraints(label, m_gbc);
      m_pnlDisplay.add(label);

      label = new JLabel("     ");
      m_gbc.gridx = 2;
      m_gbc.gridy = 2;
      m_gbc.ipadx = 0; // reset to default
      m_gbc.gridwidth = 5;
      m_gbl.setConstraints(label, m_gbc);
      // add( label );

      showInstruction(m_gbl, m_gbc, 2, 2, 1, new JLabel(Util.getAdmLabel("_admin_TEMPLATE")));

      m_nRow = 3;
      m_bDefaultFile = bDefaultFile;
      m_objTxfValue.clearArrays();
      displayNewTxf(strPath);

      m_pnlDisplay.setBorder(
          new CompoundBorder(
              BorderFactory.createTitledBorder(Util.getAdmLabel("_admin_User_Directories")),
              BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    }
コード例 #14
0
  private void showHelp(String help[]) {

    txtCommand.setText(help[0]);

    bHelp = true;

    pResult.removeAll();
    pResult.add(txtResultScroll, BorderLayout.CENTER);
    pResult.doLayout();
    txtResult.setText(help[1]);
    pResult.repaint();
    txtCommand.requestFocus();
    txtCommand.setCaretPosition(help[0].length());
  }
コード例 #15
0
 private JPanel getNumericLevels(EnumLevelList ll) {
   JPanel levelPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
   levelPanel.setBackground(Color.white);
   String labelString =
       "[ "
           + ll.getMinAsString()
           + " to "
           + ll.getMaxAsString()
           + " ] Increment by "
           + ll.getIncrementAsString();
   JLabel levelLabel = new JLabel(labelString);
   levelLabel.setForeground(ARMY_GREEN);
   add(levelLabel);
   return levelPanel;
 }
コード例 #16
0
  InfinitestResultsPane() {
    setLayout(new BorderLayout());
    toolbar = createToolBar();
    animator = new ColorAnimator();
    progressBar = createProgressBar();
    tree = createTree();

    JPanel southComponent = new JPanel(new BorderLayout());
    if (UIManager.getSystemLookAndFeelClassName().equals("apple.laf.AquaLookAndFeel")) {
      southComponent.add(Box.createHorizontalStrut(RESIZE_WINDOW_HANDLE_WIDTH), BorderLayout.EAST);
    }
    southComponent.add(progressBar, BorderLayout.CENTER);
    southComponent.add(toolbar, BorderLayout.WEST);
    add(southComponent, BorderLayout.SOUTH);
    add(new JScrollPane(tree), BorderLayout.CENTER);
  }
コード例 #17
0
  @NotNull
  public JComponent createComponent() {
    myTree.updateUI();
    reInitWholePanelIfNeeded();

    updateSelectionFromTree();

    final JPanel panel =
        new JPanel(new BorderLayout()) {
          public Dimension getPreferredSize() {
            return getPanelPreferredSize();
          }
        };
    panel.add(myWholePanel, BorderLayout.CENTER);
    return panel;
  }
コード例 #18
0
 private JPanel getStringLevels(EnumLevelList ll) {
   JPanel levelPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
   levelPanel.setBackground(Color.white);
   levelPanel.setForeground(Color.black);
   Iterator i = ll.getLevelIterator();
   JLabel levelLabel = null;
   EnumLevel level = null;
   while (i != null && i.hasNext()) {
     level = (EnumLevel) i.next();
     levelLabel = new JLabel(level.toString() + "  | ");
     levelLabel.setForeground(ARMY_GREEN);
     levelPanel.add(levelLabel);
     // levelPanel.add(new JSeparator(SwingConstants.HORIZONTAL));
   }
   return levelPanel;
 }
コード例 #19
0
 private void showSpaces(GridBagLayout gbl, GridBagConstraints gbc, int gridx, int gridy) {
   JLabel spaces = new JLabel("     ");
   gbc.gridx = gridx;
   gbc.gridy = gridy;
   gbl.setConstraints(spaces, gbc);
   m_pnlDisplay.add(spaces);
 }
コード例 #20
0
  @Override
  protected JComponent createCenterPanel() {
    JPanel panel = new JPanel(new BorderLayout());

    // Toolbar

    DefaultActionGroup group = new DefaultActionGroup();

    fillToolbarActions(group);

    group.addSeparator();

    ExpandAllAction expandAllAction = new ExpandAllAction();
    expandAllAction.registerCustomShortcutSet(
        new CustomShortcutSet(
            KeymapManager.getInstance()
                .getActiveKeymap()
                .getShortcuts(IdeActions.ACTION_EXPAND_ALL)),
        myTree);
    group.add(expandAllAction);

    CollapseAllAction collapseAllAction = new CollapseAllAction();
    collapseAllAction.registerCustomShortcutSet(
        new CustomShortcutSet(
            KeymapManager.getInstance()
                .getActiveKeymap()
                .getShortcuts(IdeActions.ACTION_COLLAPSE_ALL)),
        myTree);
    group.add(collapseAllAction);

    panel.add(
        ActionManager.getInstance()
            .createActionToolbar(ActionPlaces.UNKNOWN, group, true)
            .getComponent(),
        BorderLayout.NORTH);

    // Tree
    expandFirst();
    defaultExpandTree();
    installSpeedSearch();

    JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTree);
    scrollPane.setPreferredSize(new Dimension(350, 450));
    panel.add(scrollPane, BorderLayout.CENTER);

    return panel;
  }
コード例 #21
0
    protected void layoutUIComponents(String strPath, boolean bDefaultFile) {
      // gbc.weightx = 0.5;

      showInstructions(m_gbl, m_gbc, 0, 0, 7, infoLabel1);
      showInstructions(m_gbl, m_gbc, 0, 1, 7, infoLabel2);
      showInstructions(m_gbl, m_gbc, 0, 2, 7, infoLabel3);
      /*showInstructions( gbl, gbc, 0, 3, 7, infoLabel4 );
      showInstructions( gbl, gbc, 0, 4, 7, infoLabel5 );*/
      showInstructions(m_gbl, m_gbc, 0, 5, 1, new JLabel(""));

      // i18n
      // label = new JLabel( "LABEL" );
      label = new JLabel(Util.getAdmLabel("_adm_LABEL"));
      label.setForeground(Color.black);
      m_gbc.gridx = 1;
      m_gbc.gridy = 5;
      // gbc.ipadx = 10;
      m_gbl.setConstraints(label, m_gbc);
      m_pnlDisplay.add(label);

      label = new JLabel("     ");
      m_gbc.gridx = 2;
      m_gbc.gridy = 5;
      m_gbc.ipadx = 0;
      m_gbc.gridwidth = 5;
      m_gbc.weightx = 0;
      m_gbl.setConstraints(label, m_gbc);
      // add( label );

      // i18n
      // showInstructions( m_gbl, m_gbc, 2, 5, 1, new JLabel( "DIRECTORY" ));
      showInstructions(m_gbl, m_gbc, 2, 5, 1, new JLabel(Util.getAdmLabel("_adm_DIRECTORY")));

      m_nRow = 5;

      m_bDefaultFile = bDefaultFile;
      m_objTxfValue.clearArrays();
      displayNewTxf(strPath);

      m_pnlDisplay.setBorder(
          new CompoundBorder(
              // i18n
              // BorderFactory.createTitledBorder( "  Parent Directories  "),
              BorderFactory.createTitledBorder(Util.getAdmLabel("_adm_Parent_Directories")),
              BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    }
コード例 #22
0
ファイル: HyperSearchResults.java プロジェクト: SELab/jEdit
 // {{{ addNotify() method
 @Override
 public void addNotify() {
   super.addNotify();
   EditBus.addToBus(this);
   multiStatus = jEdit.getBooleanProperty("hypersearch-results.multi");
   updateHighlightStatus();
   updateMultiStatus();
 } // }}}
コード例 #23
0
  @Override
  protected JComponent createSouthPanel() {
    JPanel panel = new JPanel(new GridBagLayout());

    customizeOptionsPanel();
    JPanel optionsPanel = new JPanel(new VerticalFlowLayout());
    for (final JComponent component : myOptionControls) {
      optionsPanel.add(component);
    }

    panel.add(
        optionsPanel,
        new GridBagConstraints(
            0,
            0,
            1,
            1,
            1,
            0,
            GridBagConstraints.WEST,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 5),
            0,
            0));

    if (myElements == null || myElements.length == 0) {
      setOKActionEnabled(false);
    }
    panel.add(
        super.createSouthPanel(),
        new GridBagConstraints(
            1,
            0,
            1,
            1,
            0,
            0,
            GridBagConstraints.SOUTH,
            GridBagConstraints.NONE,
            new Insets(0, 0, 0, 0),
            0,
            0));
    return panel;
  }
コード例 #24
0
    @NotNull
    @Override
    public Component getTableCellRendererComponent(
        @NotNull JTable table,
        Object value,
        boolean isSelected,
        boolean hasFocus,
        int row,
        int column) {
      myTable = table;
      myRow = row;
      myColumn = column;
      boolean isEnabled = true;
      final DefaultMutableTreeNode node =
          (DefaultMutableTreeNode)
              ((TreeTable) table).getTree().getPathForRow(row).getLastPathComponent();
      Option key = null;
      if (node instanceof MyTreeNode) {
        isEnabled = ((MyTreeNode) node).isEnabled();
        key = ((MyTreeNode) node).getKey();
      }
      if (!table.isEnabled()) {
        isEnabled = false;
      }

      Color background = table.getBackground();
      if (value instanceof Boolean) {
        myCheckBox.setSelected(((Boolean) value).booleanValue());
        myCheckBox.setBackground(background);
        myCheckBox.setEnabled(isEnabled);
        return myCheckBox;
      } else if (value instanceof String) {
        /*
        myComboBox.removeAllItems();
        myComboBox.addItem(value);
        */
        myComboBox.setText((String) value);
        myComboBox.setBackground(background);
        myComboBox.setEnabled(isEnabled);
        return myComboBox;
      } else if (value instanceof Integer) {
        if (key instanceof IntOption && ((IntOption) key).isDefaultValue(value)) {
          myIntLabel.setText(((IntOption) key).getDefaultValueText());
        } else {
          myIntLabel.setText(value.toString());
        }
        return myIntLabel;
      }

      myCheckBox.putClientProperty("JComponent.sizeVariant", "small");
      myComboBox.putClientProperty("JComponent.sizeVariant", "small");

      myEmptyLabel.setBackground(background);
      return myEmptyLabel;
    }
コード例 #25
0
 private void initToolbar() {
   if (isNewProjectSettings()) return;
   DefaultActionGroup group = createToolbarActionGroup();
   if (group != null) {
     final JComponent component =
         ActionManager.getInstance()
             .createActionToolbar(ActionPlaces.UNKNOWN, group, true)
             .getComponent();
     myNorthPanel.add(component, BorderLayout.NORTH);
   }
 }
コード例 #26
0
 private void showComp(
     GridBagLayout gbl,
     GridBagConstraints gbc,
     int gridx,
     int gridy,
     int gridwidth,
     JComponent comp) {
   gbc.gridx = gridx;
   gbc.gridy = gridy;
   gbl.setConstraints(comp, gbc);
   m_pnlDisplay.add(comp);
 }
コード例 #27
0
  private void updateResult() {

    if (iResult == 0) {

      // in case 'help' has removed the grid
      if (bHelp) {
        pResult.removeAll();
        pResult.add(gScrollPane, BorderLayout.CENTER);
        pResult.doLayout();
        gResult.fireTableChanged(null);
        pResult.repaint();

        bHelp = false;
      }
    } else {
      showResultInText();
    }

    txtCommand.selectAll();
    txtCommand.requestFocus();
  }
コード例 #28
0
  public ContentEntryTreeEditor(
      Project project, List<ModuleSourceRootEditHandler<?>> editHandlers) {
    myProject = project;
    myEditHandlers = editHandlers;
    myTree = new Tree();
    myTree.setRootVisible(true);
    myTree.setShowsRootHandles(true);

    myEditingActionsGroup = new DefaultActionGroup();

    TreeUtil.installActions(myTree);
    new TreeSpeedSearch(myTree);

    myTreePanel = new MyPanel(new BorderLayout());
    final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTree);
    myTreePanel.add(
        new ToolbarPanel(scrollPane, myEditingActionsGroup, TOOLBAR_PLACE), BorderLayout.CENTER);

    myTreePanel.setVisible(false);
    myDescriptor = FileChooserDescriptorFactory.createMultipleFoldersDescriptor();
    myDescriptor.setShowFileSystemRoots(false);
  }
コード例 #29
0
 private void showInstruction(
     GridBagLayout gbl,
     GridBagConstraints gbc,
     int gridx,
     int gridy,
     int gridwidth,
     JLabel instruction) {
   gbc.gridwidth = gridwidth;
   gbc.gridx = gridx;
   gbc.gridy = gridy;
   gbl.setConstraints(instruction, gbc);
   instruction.setForeground(Color.black);
   m_pnlDisplay.add(instruction);
 }
コード例 #30
0
  private void init() {
    JPanel quickSearchPanel = new JPanel(new FlowLayout(FlowLayout.LEADING));

    final TreeModel treeModel = explorer.getTreeModel();
    final QuickTreeFilterField field =
        new QuickTreeFilterField(treeModel) {
          protected FilterableTreeModel createDisplayTreeModel(TreeModel treeModel) {
            return new FilterableTreeModel(treeModel) {
              @Override
              protected void configureListModelWrapper(ListModelWrapper wrapper, Object node) {

                if (node instanceof DefaultMutableTreeNode) {
                  // ImageFileExplorer.LazyNode inode = (ImageFileExplorer.LazyNode) node;
                  DefaultMutableTreeNode inode = (DefaultMutableTreeNode) node;
                  boolean expanded = explorer.getJTree().isExpanded(new TreePath(inode.getPath()));
                  if (inode.isLeaf() || expanded) {
                    super.configureListModelWrapper(wrapper, node);
                  }
                }
              }
            };
          }
        };

    field.setSearchingDelay(200);
    quickSearchPanel.add(field);

    JPanel treePanel = new JPanel(new BorderLayout(2, 2));

    field.setTree(explorer.getJTree());
    SearchableUtils.installSearchable(field.getTree());

    JTree tree = field.getTree();
    tree.setModel(field.getDisplayTreeModel());
    DataTipManager.get().register(tree);

    treePanel.add(explorer.getComponent());

    mainPanel.add(treePanel);
    mainPanel.add(quickSearchPanel, BorderLayout.BEFORE_FIRST_LINE);

    EventBus.subscribeStrongly(
        DataSourceStatusEvent.class,
        new EventSubscriber<DataSourceStatusEvent>() {
          @Override
          public void onEvent(DataSourceStatusEvent event) {
            explorer.getJTree().repaint();
          }
        });

    mainPanel.putClientProperty(IActionProvider.KEY, this);
  }