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;
}
}
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);
}
}
}
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);
}
}
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());
}
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));
}
}
}
Aggregations