Search in sources :

Example 6 with JViewport

use of javax.swing.JViewport in project jdk8u_jdk by JetBrains.

the class bug7170310 method check.

private static void check() {
    try {
        JViewport vp = null;
        for (Component c : tabbedPane.getComponents()) {
            if (c instanceof JViewport) {
                vp = (JViewport) c;
                break;
            }
        }
        JComponent v = (JComponent) vp.getView();
        Rectangle vr = vp.getViewRect();
        Dimension vs = v.getSize();
        // The tab view must be scrolled to the end so that the last tab is visible
        if (vs.width != (vr.x + vr.width)) {
            throw new RuntimeException("tabScroller.tabPanel view is positioned incorrectly: " + vs.width + " vs " + (vr.x + vr.width));
        }
    } catch (Exception e) {
        exception = e;
    }
}
Also used : JViewport(javax.swing.JViewport) JComponent(javax.swing.JComponent) Rectangle(java.awt.Rectangle) Dimension(java.awt.Dimension) JComponent(javax.swing.JComponent) Component(java.awt.Component)

Example 7 with JViewport

use of javax.swing.JViewport in project pcgen by PCGen.

the class JDynamicTable method unconfigureEnclosingScrollPane.

@Override
protected void unconfigureEnclosingScrollPane() {
    super.unconfigureEnclosingScrollPane();
    Container p = getParent();
    if (p instanceof JViewport) {
        Container gp = p.getParent();
        if (gp instanceof JScrollPane) {
            JScrollPane scrollPane = (JScrollPane) gp;
            // Make certain we are the viewPort's view and not, for
            // example, the rowHeaderView of the scrollPane -
            // an implementor of fixed columns might do this.
            JViewport viewport = scrollPane.getViewport();
            if (viewport == null || viewport.getView() != this) {
                return;
            }
            scrollPane.setCorner(ScrollPaneConstants.UPPER_RIGHT_CORNER, null);
        }
    }
}
Also used : JScrollPane(javax.swing.JScrollPane) Container(java.awt.Container) JViewport(javax.swing.JViewport)

Example 8 with JViewport

use of javax.swing.JViewport in project pcgen by PCGen.

the class NotesView method refreshTreeNodes.

//Gui methods
private void refreshTreeNodes() {
    Object obj = notesTree.getLastSelectedPathComponent();
    if (obj instanceof NotesTreeNode) {
        NotesTreeNode node = (NotesTreeNode) obj;
        editor = node.getTextPane();
        root.checkCache();
        // TODO: Uh-oh -- never call gc manually without strong reason
        //			Runtime.getRuntime().gc();
        JViewport vp = new JViewport();
        vp.setView(editor);
        jScrollPane2.setViewport(vp);
        editAreaDT = new DropTarget(editor, new DropEditorListener());
        editor.addCaretListener(this::editorCaretUpdate);
        editor.addKeyListener(new java.awt.event.KeyListener() {

            @Override
            public void keyTyped(KeyEvent e) {
                editorKeyTyped(e);
            }

            @Override
            public void keyPressed(KeyEvent e) {
            // TODO:  Method does nothing?
            }

            @Override
            public void keyReleased(KeyEvent e) {
            // TODO:  Method does nothing?
            }
        });
        editor.getStyledDocument().addUndoableEditListener(this::editorUndoableEditHappened);
        if (node.isLeaf()) {
            deleteButton.setEnabled(true);
        } else {
            deleteButton.setEnabled(false);
        }
        if (node == root) {
            exportButton.setEnabled(false);
        } else {
            exportButton.setEnabled(true);
        }
        if (node.isDirty()) {
            revertButton.setEnabled(true);
        } else {
            revertButton.setEnabled(false);
        }
        initFileBar(node.getFiles());
        saveButton.setEnabled(true);
        newButton.setEnabled(true);
    } else if (obj == null) {
        deleteButton.setEnabled(false);
        saveButton.setEnabled(false);
        revertButton.setEnabled(false);
        newButton.setEnabled(false);
    }
}
Also used : KeyEvent(java.awt.event.KeyEvent) JViewport(javax.swing.JViewport) DropTarget(java.awt.dnd.DropTarget)

Example 9 with JViewport

use of javax.swing.JViewport in project zaproxy by zaproxy.

the class ViewMenu method updateState.

public void updateState(HttpPanelSyntaxHighlightTextArea httpPanelTextArea) {
    antiAliasingOption.setSelected(httpPanelTextArea.getAntiAliasingEnabled());
    boolean selected = false;
    boolean enabled = false;
    Component c = httpPanelTextArea.getParent();
    if (c instanceof JViewport) {
        c = c.getParent();
        if (c instanceof RTextScrollPane) {
            enabled = true;
            final RTextScrollPane scrollPane = (RTextScrollPane) c;
            selected = scrollPane.getLineNumbersEnabled();
        }
    }
    lineNumbersOption.setVisible(enabled);
    lineNumbersOption.setSelected(selected);
    wordWrapOption.setSelected(httpPanelTextArea.getLineWrap());
    highlightCurrentLineOption.setSelected(httpPanelTextArea.getHighlightCurrentLine());
    fadeCurrentHighlightLineOption.setSelected(httpPanelTextArea.getFadeCurrentLineHighlight());
    showWhitespacesOption.setSelected(httpPanelTextArea.isWhitespaceVisible());
    showNewlinesOption.setSelected(httpPanelTextArea.getEOLMarkersVisible());
    markOccurrencesOption.setSelected(httpPanelTextArea.getMarkOccurrences());
    roundedSelectionEdgesOption.setSelected(httpPanelTextArea.getRoundedSelectionEdges());
    bracketMatchingOption.setSelected(httpPanelTextArea.isBracketMatchingEnabled());
    animatedBracketMatchingOption.setSelected(httpPanelTextArea.getAnimateBracketMatching());
}
Also used : JViewport(javax.swing.JViewport) Component(java.awt.Component) JTextComponent(javax.swing.text.JTextComponent) RTextScrollPane(org.fife.ui.rtextarea.RTextScrollPane)

Example 10 with JViewport

use of javax.swing.JViewport in project adempiere by adempiere.

the class POSTable method growScrollbars.

/**
	 * 
	 * @return void
	 */
public void growScrollbars() {
    // fatter scroll bars
    Container p = getParent();
    if (p instanceof JViewport) {
        Container gp = p.getParent();
        if (gp instanceof JScrollPane) {
            JScrollPane scrollPane = (JScrollPane) gp;
            scrollPane.getVerticalScrollBar().setPreferredSize(new Dimension(SCROLLBAR_WIDTH, SCROLLBAR_HEIGHT));
            scrollPane.getHorizontalScrollBar().setPreferredSize(new Dimension(SCROLLBAR_WIDTH, SCROLLBAR_HEIGHT));
        }
    }
}
Also used : JScrollPane(javax.swing.JScrollPane) Container(java.awt.Container) JViewport(javax.swing.JViewport) Dimension(java.awt.Dimension)

Aggregations

JViewport (javax.swing.JViewport)33 JScrollPane (javax.swing.JScrollPane)12 Component (java.awt.Component)9 Container (java.awt.Container)8 Dimension (java.awt.Dimension)7 Point (java.awt.Point)5 Rectangle (java.awt.Rectangle)5 RTextScrollPane (org.fife.ui.rtextarea.RTextScrollPane)3 Graphics (java.awt.Graphics)2 BufferedImage (java.awt.image.BufferedImage)2 JButton (javax.swing.JButton)2 JCheckBox (javax.swing.JCheckBox)2 JCheckBoxMenuItem (javax.swing.JCheckBoxMenuItem)2 JColorChooser (javax.swing.JColorChooser)2 JComponent (javax.swing.JComponent)2 JDesktopPane (javax.swing.JDesktopPane)2 JScrollBar (javax.swing.JScrollBar)2 JTabbedPane (javax.swing.JTabbedPane)2 JTable (javax.swing.JTable)2 ChangeListener (javax.swing.event.ChangeListener)2