Java Code Examples for sun.awt.AWTAccessor#getComponentAccessor()
The following examples show how to use
sun.awt.AWTAccessor#getComponentAccessor() .
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: XWindowPeer.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public void recursivelySetIcon(java.util.List<IconInfo> icons) { dumpIcons(winAttr.icons); setIconHints(icons); Window target = (Window)this.target; Window[] children = target.getOwnedWindows(); int cnt = children.length; final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); for (int i = 0; i < cnt; i++) { final ComponentPeer childPeer = acc.getPeer(children[i]); if (childPeer != null && childPeer instanceof XWindowPeer) { if (((XWindowPeer)childPeer).winAttr.iconsInherited) { ((XWindowPeer)childPeer).winAttr.icons = icons; ((XWindowPeer)childPeer).recursivelySetIcon(icons); } } } }
Example 2
Source File: XWindowPeer.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public void repositionSecurityWarning() { // NOTE: On KWin if the window/border snapping option is enabled, // the Java window may be swinging while it's being moved. // This doesn't make the application unusable though looks quite ugly. // Probobly we need to find some hint to assign to our Security // Warning window in order to exclude it from the snapping option. // We are not currently aware of existance of such a property. if (warningWindow != null) { // We can't use the coordinates stored in the XBaseWindow since // they are zeros for decorated frames. AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); int x = compAccessor.getX(target); int y = compAccessor.getY(target); int width = compAccessor.getWidth(target); int height = compAccessor.getHeight(target); warningWindow.reposition(x, y, width, height); } }
Example 3
Source File: XGlobalCursorManager.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
private Cursor getCapableCursor(Component comp) { AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); Component c = comp; while ((c != null) && !(c instanceof Window) && compAccessor.isEnabled(c) && compAccessor.isVisible(c) && compAccessor.isDisplayable(c)) { c = compAccessor.getParent(c); } if (c instanceof Window) { return (compAccessor.isEnabled(c) && compAccessor.isVisible(c) && compAccessor.isDisplayable(c) && compAccessor.isEnabled(comp)) ? compAccessor.getCursor(comp) : Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR); } else if (c == null) { return null; } return getCapableCursor(compAccessor.getParent(c)); }
Example 4
Source File: XWindowPeer.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public void repositionSecurityWarning() { // NOTE: On KWin if the window/border snapping option is enabled, // the Java window may be swinging while it's being moved. // This doesn't make the application unusable though looks quite ugly. // Probobly we need to find some hint to assign to our Security // Warning window in order to exclude it from the snapping option. // We are not currently aware of existance of such a property. if (warningWindow != null) { // We can't use the coordinates stored in the XBaseWindow since // they are zeros for decorated frames. AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); int x = compAccessor.getX(target); int y = compAccessor.getY(target); int width = compAccessor.getWidth(target); int height = compAccessor.getHeight(target); warningWindow.reposition(x, y, width, height); } }
Example 5
Source File: XGlobalCursorManager.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private Cursor getCapableCursor(Component comp) { AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); Component c = comp; while ((c != null) && !(c instanceof Window) && compAccessor.isEnabled(c) && compAccessor.isVisible(c) && compAccessor.isDisplayable(c)) { c = compAccessor.getParent(c); } if (c instanceof Window) { return (compAccessor.isEnabled(c) && compAccessor.isVisible(c) && compAccessor.isDisplayable(c) && compAccessor.isEnabled(comp)) ? compAccessor.getCursor(comp) : Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR); } else if (c == null) { return null; } return getCapableCursor(compAccessor.getParent(c)); }
Example 6
Source File: XWindowPeer.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public void repositionSecurityWarning() { // NOTE: On KWin if the window/border snapping option is enabled, // the Java window may be swinging while it's being moved. // This doesn't make the application unusable though looks quite ugly. // Probobly we need to find some hint to assign to our Security // Warning window in order to exclude it from the snapping option. // We are not currently aware of existance of such a property. if (warningWindow != null) { // We can't use the coordinates stored in the XBaseWindow since // they are zeros for decorated frames. AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); int x = compAccessor.getX(target); int y = compAccessor.getY(target); int width = compAccessor.getWidth(target); int height = compAccessor.getHeight(target); warningWindow.reposition(x, y, width, height); } }
Example 7
Source File: XDecoratedPeer.java From hottub with GNU General Public License v2.0 | 5 votes |
public Graphics getGraphics() { AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); return getGraphics(content.surfaceData, compAccessor.getForeground(target), compAccessor.getBackground(target), compAccessor.getFont(target)); }
Example 8
Source File: XTextFieldPeer.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
void initTextField() { setVisible(target.isVisible()); setBounds(x, y, width, height, SET_BOUNDS); AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); foreground = compAccessor.getForeground(target); if (foreground == null) foreground = SystemColor.textText; setForeground(foreground); background = compAccessor.getBackground(target); if (background == null) { if (((TextField)target).isEditable()) background = SystemColor.text; else background = SystemColor.control; } setBackground(background); if (!target.isBackgroundSet()) { // This is a way to set the background color of the TextArea // without calling setBackground - go through accessor compAccessor.setBackground(target, background); } if (!target.isForegroundSet()) { target.setForeground(SystemColor.textText); } setFont(font); }
Example 9
Source File: XDecoratedPeer.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public Graphics getGraphics() { AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); return getGraphics(content.surfaceData, compAccessor.getForeground(target), compAccessor.getBackground(target), compAccessor.getFont(target)); }
Example 10
Source File: XTextFieldPeer.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
void initTextField() { setVisible(target.isVisible()); setBounds(x, y, width, height, SET_BOUNDS); AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); foreground = compAccessor.getForeground(target); if (foreground == null) foreground = SystemColor.textText; setForeground(foreground); background = compAccessor.getBackground(target); if (background == null) { if (((TextField)target).isEditable()) background = SystemColor.text; else background = SystemColor.control; } setBackground(background); if (!target.isBackgroundSet()) { // This is a way to set the background color of the TextArea // without calling setBackground - go through accessor compAccessor.setBackground(target, background); } if (!target.isForegroundSet()) { target.setForeground(SystemColor.textText); } setFont(font); }
Example 11
Source File: XTextFieldPeer.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
void initTextField() { setVisible(target.isVisible()); setBounds(x, y, width, height, SET_BOUNDS); AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); foreground = compAccessor.getForeground(target); if (foreground == null) foreground = SystemColor.textText; setForeground(foreground); background = compAccessor.getBackground(target); if (background == null) { if (((TextField)target).isEditable()) background = SystemColor.text; else background = SystemColor.control; } setBackground(background); if (!target.isBackgroundSet()) { // This is a way to set the background color of the TextArea // without calling setBackground - go through accessor compAccessor.setBackground(target, background); } if (!target.isForegroundSet()) { target.setForeground(SystemColor.textText); } setFont(font); }
Example 12
Source File: XTextFieldPeer.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
void initTextField() { setVisible(target.isVisible()); setBounds(x, y, width, height, SET_BOUNDS); AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); foreground = compAccessor.getForeground(target); if (foreground == null) foreground = SystemColor.textText; setForeground(foreground); background = compAccessor.getBackground(target); if (background == null) { if (((TextField)target).isEditable()) background = SystemColor.text; else background = SystemColor.control; } setBackground(background); if (!target.isBackgroundSet()) { // This is a way to set the background color of the TextArea // without calling setBackground - go through accessor compAccessor.setBackground(target, background); } if (!target.isForegroundSet()) { target.setForeground(SystemColor.textText); } setFont(font); }
Example 13
Source File: XTextFieldPeer.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
void initTextField() { setVisible(target.isVisible()); setBounds(x, y, width, height, SET_BOUNDS); AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); foreground = compAccessor.getForeground(target); if (foreground == null) foreground = SystemColor.textText; setForeground(foreground); background = compAccessor.getBackground(target); if (background == null) { if (((TextField)target).isEditable()) background = SystemColor.text; else background = SystemColor.control; } setBackground(background); if (!target.isBackgroundSet()) { // This is a way to set the background color of the TextArea // without calling setBackground - go through accessor compAccessor.setBackground(target, background); } if (!target.isForegroundSet()) { target.setForeground(SystemColor.textText); } setFont(font); }
Example 14
Source File: XTextFieldPeer.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
void initTextField() { setVisible(target.isVisible()); setBounds(x, y, width, height, SET_BOUNDS); AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); foreground = compAccessor.getForeground(target); if (foreground == null) foreground = SystemColor.textText; setForeground(foreground); background = compAccessor.getBackground(target); if (background == null) { if (((TextField)target).isEditable()) background = SystemColor.text; else background = SystemColor.control; } setBackground(background); if (!target.isBackgroundSet()) { // This is a way to set the background color of the TextArea // without calling setBackground - go through accessor compAccessor.setBackground(target, background); } if (!target.isForegroundSet()) { target.setForeground(SystemColor.textText); } setFont(font); }
Example 15
Source File: GLXVolatileSurfaceManager.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * Create a FBO-based SurfaceData object (or init the backbuffer * of an existing window if this is a double buffered GraphicsConfig) */ protected SurfaceData initAcceleratedSurface() { SurfaceData sData; Component comp = vImg.getComponent(); final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); X11ComponentPeer peer = (comp != null) ? acc.getPeer(comp) : null; try { boolean createVSynced = false; boolean forceback = false; if (context instanceof Boolean) { forceback = ((Boolean)context).booleanValue(); if (forceback && peer instanceof BackBufferCapsProvider) { BackBufferCapsProvider provider = (BackBufferCapsProvider)peer; BufferCapabilities caps = provider.getBackBufferCaps(); if (caps instanceof ExtendedBufferCapabilities) { ExtendedBufferCapabilities ebc = (ExtendedBufferCapabilities)caps; if (ebc.getVSync() == VSYNC_ON && ebc.getFlipContents() == COPIED) { createVSynced = true; forceback = false; } } } } if (forceback) { // peer must be non-null in this case sData = GLXSurfaceData.createData(peer, vImg, FLIP_BACKBUFFER); } else { GLXGraphicsConfig gc = (GLXGraphicsConfig)vImg.getGraphicsConfig(); ColorModel cm = gc.getColorModel(vImg.getTransparency()); int type = vImg.getForcedAccelSurfaceType(); // if acceleration type is forced (type != UNDEFINED) then // use the forced type, otherwise choose FBOBJECT if (type == OGLSurfaceData.UNDEFINED) { type = OGLSurfaceData.FBOBJECT; } if (createVSynced) { sData = GLXSurfaceData.createData(peer, vImg, type); } else { sData = GLXSurfaceData.createData(gc, vImg.getWidth(), vImg.getHeight(), cm, vImg, type); } } } catch (NullPointerException ex) { sData = null; } catch (OutOfMemoryError er) { sData = null; } return sData; }
Example 16
Source File: XTextAreaPeer.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * Create a Text area. */ XTextAreaPeer(TextArea target) { super(target); // some initializations require that target be set even // though init(target) has not been called this.target = target; //ComponentAccessor.enableEvents(target,AWTEvent.MOUSE_WHEEL_EVENT_MASK); String text = target.getText(); jtext = new AWTTextArea(text, this); jtext.setWrapStyleWord(true); jtext.getDocument().addDocumentListener(jtext); XToolkit.specialPeerMap.put(jtext,this); textPane = new AWTTextPane(jtext,this, target.getParent()); setBounds(x, y, width, height, SET_BOUNDS); textPane.setVisible(true); textPane.validate(); AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); foreground = compAccessor.getForeground(target); if (foreground == null) { foreground = SystemColor.textText; } setForeground(foreground); background = compAccessor.getBackground(target); if (background == null) { if (target.isEditable()) background = SystemColor.text; else background = SystemColor.control; } setBackground(background); if (!target.isBackgroundSet()) { // This is a way to set the background color of the TextArea // without calling setBackground - go through accessor compAccessor.setBackground(target, background); } if (!target.isForegroundSet()) { target.setForeground(SystemColor.textText); } setFont(font); // set the text of this object to the text of its target setTextImpl(target.getText()); //?? should this be setText int start = target.getSelectionStart(); int end = target.getSelectionEnd(); // Fix for 5100200 // Restoring Motif behaviour // Since the end position of the selected text can be greater then the length of the text, // so we should set caret to max position of the text setCaretPosition(Math.min(end, text.length())); if (end > start) { // Should be called after setText() and setCaretPosition() select(start, end); } setEditable(target.isEditable()); setScrollBarVisibility(); // After this line we should not change the component's text firstChangeSkipped = true; }
Example 17
Source File: XTextAreaPeer.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * Create a Text area. */ XTextAreaPeer(TextArea target) { super(target); // some initializations require that target be set even // though init(target) has not been called this.target = target; //ComponentAccessor.enableEvents(target,AWTEvent.MOUSE_WHEEL_EVENT_MASK); String text = target.getText(); jtext = new AWTTextArea(text, this); jtext.setWrapStyleWord(true); jtext.getDocument().addDocumentListener(jtext); XToolkit.specialPeerMap.put(jtext,this); textPane = new AWTTextPane(jtext,this, target.getParent()); setBounds(x, y, width, height, SET_BOUNDS); textPane.setVisible(true); textPane.validate(); AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); foreground = compAccessor.getForeground(target); if (foreground == null) { foreground = SystemColor.textText; } setForeground(foreground); background = compAccessor.getBackground(target); if (background == null) { if (target.isEditable()) background = SystemColor.text; else background = SystemColor.control; } setBackground(background); if (!target.isBackgroundSet()) { // This is a way to set the background color of the TextArea // without calling setBackground - go through accessor compAccessor.setBackground(target, background); } if (!target.isForegroundSet()) { target.setForeground(SystemColor.textText); } setFont(font); // set the text of this object to the text of its target setTextImpl(target.getText()); //?? should this be setText int start = target.getSelectionStart(); int end = target.getSelectionEnd(); // Fix for 5100200 // Restoring Motif behaviour // Since the end position of the selected text can be greater then the length of the text, // so we should set caret to max position of the text setCaretPosition(Math.min(end, text.length())); if (end > start) { // Should be called after setText() and setCaretPosition() select(start, end); } setEditable(target.isEditable()); setScrollBarVisibility(); // After this line we should not change the component's text firstChangeSkipped = true; }
Example 18
Source File: XTextAreaPeer.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * Create a Text area. */ XTextAreaPeer(TextArea target) { super(target); // some initializations require that target be set even // though init(target) has not been called this.target = target; //ComponentAccessor.enableEvents(target,AWTEvent.MOUSE_WHEEL_EVENT_MASK); String text = target.getText(); jtext = new AWTTextArea(text, this); jtext.setWrapStyleWord(true); jtext.getDocument().addDocumentListener(jtext); XToolkit.specialPeerMap.put(jtext,this); textPane = new AWTTextPane(jtext,this, target.getParent()); setBounds(x, y, width, height, SET_BOUNDS); textPane.setVisible(true); textPane.validate(); AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); foreground = compAccessor.getForeground(target); if (foreground == null) { foreground = SystemColor.textText; } setForeground(foreground); background = compAccessor.getBackground(target); if (background == null) { if (target.isEditable()) background = SystemColor.text; else background = SystemColor.control; } setBackground(background); if (!target.isBackgroundSet()) { // This is a way to set the background color of the TextArea // without calling setBackground - go through accessor compAccessor.setBackground(target, background); } if (!target.isForegroundSet()) { target.setForeground(SystemColor.textText); } setFont(font); // set the text of this object to the text of its target setTextImpl(target.getText()); //?? should this be setText int start = target.getSelectionStart(); int end = target.getSelectionEnd(); // Fix for 5100200 // Restoring Motif behaviour // Since the end position of the selected text can be greater then the length of the text, // so we should set caret to max position of the text setCaretPosition(Math.min(end, text.length())); if (end > start) { // Should be called after setText() and setCaretPosition() select(start, end); } setEditable(target.isEditable()); setScrollBarVisibility(); // After this line we should not change the component's text firstChangeSkipped = true; }
Example 19
Source File: XTextAreaPeer.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * Create a Text area. */ XTextAreaPeer(TextArea target) { super(target); // some initializations require that target be set even // though init(target) has not been called this.target = target; //ComponentAccessor.enableEvents(target,AWTEvent.MOUSE_WHEEL_EVENT_MASK); String text = target.getText(); jtext = new AWTTextArea(text, this); jtext.setWrapStyleWord(true); jtext.getDocument().addDocumentListener(jtext); XToolkit.specialPeerMap.put(jtext,this); textPane = new AWTTextPane(jtext,this, target.getParent()); setBounds(x, y, width, height, SET_BOUNDS); textPane.setVisible(true); textPane.validate(); AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); foreground = compAccessor.getForeground(target); if (foreground == null) { foreground = SystemColor.textText; } setForeground(foreground); background = compAccessor.getBackground(target); if (background == null) { if (target.isEditable()) background = SystemColor.text; else background = SystemColor.control; } setBackground(background); if (!target.isBackgroundSet()) { // This is a way to set the background color of the TextArea // without calling setBackground - go through accessor compAccessor.setBackground(target, background); } if (!target.isForegroundSet()) { target.setForeground(SystemColor.textText); } setFont(font); // set the text of this object to the text of its target setTextImpl(target.getText()); //?? should this be setText int start = target.getSelectionStart(); int end = target.getSelectionEnd(); // Fix for 5100200 // Restoring Motif behaviour // Since the end position of the selected text can be greater then the length of the text, // so we should set caret to max position of the text setCaretPosition(Math.min(end, text.length())); if (end > start) { // Should be called after setText() and setCaretPosition() select(start, end); } setEditable(target.isEditable()); setScrollBarVisibility(); // After this line we should not change the component's text firstChangeSkipped = true; }
Example 20
Source File: XTextAreaPeer.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * Create a Text area. */ XTextAreaPeer(TextArea target) { super(target); // some initializations require that target be set even // though init(target) has not been called this.target = target; //ComponentAccessor.enableEvents(target,AWTEvent.MOUSE_WHEEL_EVENT_MASK); String text = target.getText(); jtext = new AWTTextArea(text, this); jtext.setWrapStyleWord(true); jtext.getDocument().addDocumentListener(jtext); XToolkit.specialPeerMap.put(jtext,this); textPane = new AWTTextPane(jtext,this, target.getParent()); setBounds(x, y, width, height, SET_BOUNDS); textPane.setVisible(true); textPane.validate(); AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor(); foreground = compAccessor.getForeground(target); if (foreground == null) { foreground = SystemColor.textText; } setForeground(foreground); background = compAccessor.getBackground(target); if (background == null) { if (target.isEditable()) background = SystemColor.text; else background = SystemColor.control; } setBackground(background); if (!target.isBackgroundSet()) { // This is a way to set the background color of the TextArea // without calling setBackground - go through accessor compAccessor.setBackground(target, background); } if (!target.isForegroundSet()) { target.setForeground(SystemColor.textText); } setFont(font); // set the text of this object to the text of its target setTextImpl(target.getText()); //?? should this be setText int start = target.getSelectionStart(); int end = target.getSelectionEnd(); // Fix for 5100200 // Restoring Motif behaviour // Since the end position of the selected text can be greater than the length of the text, // so we should set caret to max position of the text setCaretPosition(Math.min(end, text.length())); if (end > start) { // Should be called after setText() and setCaretPosition() select(start, end); } setEditable(target.isEditable()); setScrollBarVisibility(); // After this line we should not change the component's text firstChangeSkipped = true; compAccessor.setPeer(textPane, this); }