⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 abstractcomplexsearchpanel.java

📁 编辑视频文件
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
        JPanel filler = new JPanel();        c.gridx = 0;        c.gridy = 1;        c.anchor = GridBagConstraints.NORTHWEST;        c.fill = GridBagConstraints.VERTICAL;        c.weighty = 10.0;        queryCont.add(filler, c);        //        c = new GridBagConstraints();        c.gridx = 0;        c.gridy = 1;        c.anchor = GridBagConstraints.NORTHWEST;        c.fill = GridBagConstraints.BOTH;        c.weightx = 1.0;        c.weighty = 1.0;        JScrollPane scrollPane = new JScrollPane(queryCont);        //scrollPane.setPreferredSize(new Dimension(100, 300));        toolAndQueryPanel.add(scrollPane, c);        //toolAndQueryPanel.add(toolBar, BorderLayout.NORTH);        //toolAndQueryPanel.add(queryPanel, BorderLayout.CENTER);        toolAndQueryPanel.setBorder(new EmptyBorder(0, 0, 0, 0));        bottomPanel.setLayout(new TriptychLayout());        matchCounter.setBorder(new CompoundBorder(new EmptyBorder(3, 3, 3, 3),                new LineBorder(Color.gray)));        progressViewer.setBorder(new CompoundBorder(                new EmptyBorder(3, 3, 3, 3), new LineBorder(Color.gray)));        startStopPanel = new StartStopPanel(startAction, stopAction, closeAction);        bottomPanel.add(TriptychLayout.LEFT, matchCounter);        bottomPanel.add(TriptychLayout.RIGHT, progressViewer);        bottomPanel.add(TriptychLayout.CENTER, startStopPanel);        matchCounter.setVisible(false);        progressViewer.setVisible(false);        setLayout(new GridBagLayout());        c = new GridBagConstraints();        JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,                toolAndQueryPanel, (JComponent) resultViewer);        splitPane.setResizeWeight(0.8);        c = new GridBagConstraints();        c.gridx = 0;        c.gridy = 0;        c.anchor = GridBagConstraints.NORTHWEST;        c.gridwidth = 1;        c.weightx = 1;        c.weighty = 1;        c.fill = GridBagConstraints.BOTH;        add(splitPane, c);        c = new GridBagConstraints();        c.gridx = 0;        c.gridy = 2;        c.anchor = GridBagConstraints.SOUTHWEST;        c.gridwidth = 1;        c.weightx = 1;        c.fill = GridBagConstraints.HORIZONTAL;        add(bottomPanel, c);        updateActions();    }    /**     * DOCUMENT ME!     */    protected abstract void read();    /**     * DOCUMENT ME!     */    protected abstract void save();    /**     * DOCUMENT ME!     */    protected void updateActions() {        super.updateActions();        boolean executing = (searchEngine != null) &&            searchEngine.isExecuting();        backAction.setEnabled(!executing && queryManager.hasPreviousQuery());        forwardAction.setEnabled(!executing && queryManager.hasNextQuery());        boolean positiveResult = !executing &&            (queryManager.getCurrentQuery() != null) &&            (queryManager.getCurrentQuery().getResult().getRealSize() > 0) &&            (queryManager.getCurrentQuery().getResult().getStatus() != ContentResult.MODIFIED);        saveAction.setEnabled(positiveResult &&            !((ContentQuery) queryManager.getCurrentQuery()).isRestricted());        exportAction.setEnabled(positiveResult);        zoomAction.setEnabled(positiveResult);        resultCounterLabel.setText((queryManager.getCurrentQueryNumber() > 0)            ? ("" + queryManager.getCurrentQueryNumber()) : "");    }    private void createActions() {        Icon searchIcon = null;        Icon stopIcon = null;        Icon newIcon = null;        Icon zoomIcon = null;        Icon saveIcon = null;        Icon readIcon = null;        Icon exportIcon = null;        Icon backIcon = null;        Icon forwardIcon = null;        try {            searchIcon = new ImageIcon(this.getClass().getResource("/toolbarButtonGraphics/media/Play16.gif"));            stopIcon = new ImageIcon(this.getClass().getResource("/toolbarButtonGraphics/media/Stop16.gif"));            newIcon = new ImageIcon(this.getClass().getResource("/toolbarButtonGraphics/general/New16.gif"));            zoomIcon = new ImageIcon(this.getClass().getResource("/toolbarButtonGraphics/general/Zoom16.gif"));            saveIcon = new ImageIcon(this.getClass().getResource("/toolbarButtonGraphics/general/SaveAs16.gif"));            readIcon = new ImageIcon(this.getClass().getResource("/toolbarButtonGraphics/general/Open16.gif"));            exportIcon = new ImageIcon(this.getClass().getResource("/toolbarButtonGraphics/general/Export16.gif"));            backIcon = new ImageIcon(this.getClass().getResource("/toolbarButtonGraphics/navigation/Back16.gif"));            forwardIcon = new ImageIcon(this.getClass().getResource("/toolbarButtonGraphics/navigation/Forward16.gif"));        } catch (Exception e) {            e.printStackTrace();        }        startAction.putValue(Action.SMALL_ICON, searchIcon);        stopAction.putValue(Action.SMALL_ICON, stopIcon);        exportAction.putValue(Action.SMALL_ICON, exportIcon);        newAction = new AbstractAction(SearchLocale.getString("Action.New"),                newIcon) {                    public void actionPerformed(ActionEvent e) {                        newQuery();                    }                };        newAction.putValue(Action.SHORT_DESCRIPTION,            SearchLocale.getString("Action.Tooltip.New"));        KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_N,                ActionEvent.CTRL_MASK);        newAction.putValue(Action.ACCELERATOR_KEY, ks);        saveAction = new AbstractAction(SearchLocale.getString("Action.Save"),                saveIcon) {                    public void actionPerformed(ActionEvent e) {                        save();                    }                };        saveAction.putValue(Action.SHORT_DESCRIPTION,            SearchLocale.getString("Action.Tooltip.Save"));        ks = KeyStroke.getKeyStroke(KeyEvent.VK_M, ActionEvent.CTRL_MASK);        saveAction.putValue(Action.ACCELERATOR_KEY, ks);        zoomAction = new AbstractAction(SearchLocale.getString("Action.Zoom"),                zoomIcon) {                    public void actionPerformed(ActionEvent e) {                        queryPanel.newRestrictedQuery((ContentResult) queryManager.getCurrentQuery()                                                                                  .getResult(),                            SearchLocale.getString("Search.Constraint.Matches") +                            " " + SearchLocale.getString("Search.FoundIn") +                            " " + SearchLocale.getString("Search.Result") +                            " " + queryManager.getCurrentQueryNumber());                        clearResult();                    }                };        zoomAction.putValue(Action.SHORT_DESCRIPTION,            SearchLocale.getString("Action.Tooltip.Zoom"));        ks = KeyStroke.getKeyStroke(KeyEvent.VK_R, ActionEvent.CTRL_MASK);        zoomAction.putValue(Action.ACCELERATOR_KEY, ks);        readAction = new AbstractAction(SearchLocale.getString("Action.Open"),                readIcon) {                    public void actionPerformed(ActionEvent e) {                        read();                        updateActions();                    }                };        readAction.putValue(Action.SHORT_DESCRIPTION,            SearchLocale.getString("Action.Tooltip.Open"));        ks = KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK);        readAction.putValue(Action.ACCELERATOR_KEY, ks);        closeAction = new AbstractAction(SearchLocale.getString("Action.Close")) {                    public void actionPerformed(ActionEvent e) {                        userQuit();                    }                };        ks = KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.CTRL_MASK);        closeAction.putValue(Action.ACCELERATOR_KEY, ks);        backAction = new AbstractAction(SearchLocale.getString("Action.Back"),                backIcon) {                    public void actionPerformed(ActionEvent e) {                        gotoQuery(queryManager.getCurrentQueryNumber() - 1);                    }                };        backAction.putValue(Action.SHORT_DESCRIPTION,            SearchLocale.getString("Action.Tooltip.Back"));        ks = KeyStroke.getKeyStroke(KeyEvent.VK_B, ActionEvent.CTRL_MASK);        backAction.putValue(Action.ACCELERATOR_KEY, ks);        forwardAction = new AbstractAction(SearchLocale.getString(                    "Action.Forward"), forwardIcon) {                    public void actionPerformed(ActionEvent e) {                        gotoQuery(queryManager.getCurrentQueryNumber() + 1);                    }                };        forwardAction.putValue(Action.SHORT_DESCRIPTION,            SearchLocale.getString("Action.Tooltip.Forward"));        ks = KeyStroke.getKeyStroke(KeyEvent.VK_F, ActionEvent.CTRL_MASK);        forwardAction.putValue(Action.ACCELERATOR_KEY, ks);        stopAction.setEnabled(false);    }    private void newQuery() {        queryPanel.reset();        clearResult();    }    /**     * Disconnect from the viewermanager and dispose the dialog.     */    protected void userQuit() {        stopSearch();        ((Window) getTopLevelAncestor()).dispose();    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -