Java Code Examples for java.awt.Window#isActive()
The following examples show how to use
java.awt.Window#isActive() .
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: JBRCustomDecorations.java From FlatLaf with Apache License 2.0 | 5 votes |
@Override public void paintBorder( Component c, Graphics g, int x, int y, int width, int height ) { Window window = SwingUtilities.windowForComponent( c ); boolean active = (window != null) ? window.isActive() : false; g.setColor( active ? activeColor : (FlatLaf.isLafDark() ? inactiveDarkColor : inactiveLightColor) ); HiDPIUtils.paintAtScale1x( (Graphics2D) g, x, y, width, height, this::paintImpl ); }
Example 2
Source File: SlideBarContainer.java From netbeans with Apache License 2.0 | 5 votes |
@Override protected void updateActive(boolean active) { // #48588 - when in SDI, slidein needs to front the editor frame. if(active) { Window window = SwingUtilities.getWindowAncestor(panel); if(window != null && !window.isActive() && WindowManagerImpl.getInstance().getEditorAreaState() == Constants.EDITOR_AREA_SEPARATED) { window.toFront(); } } }
Example 3
Source File: MetalBorders.java From JDKSourceCode1.8 with MIT License | 4 votes |
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { Color background; Color highlight; Color shadow; Window window = SwingUtilities.getWindowAncestor(c); if (window != null && window.isActive()) { background = getActiveBackground(); highlight = getActiveHighlight(); shadow = getActiveShadow(); } else { background = getInactiveBackground(); highlight = getInactiveHighlight(); shadow = getInactiveShadow(); } g.setColor(background); // Draw outermost lines g.drawLine( x + 1, y + 0, x + w-2, y + 0); g.drawLine( x + 0, y + 1, x + 0, y + h - 2); g.drawLine( x + w - 1, y + 1, x + w - 1, y + h - 2); g.drawLine( x + 1, y + h - 1, x + w - 2, y + h - 1); // Draw the bulk of the border for (int i = 1; i < 5; i++) { g.drawRect(x+i,y+i,w-(i*2)-1, h-(i*2)-1); } if ((window instanceof Dialog) && ((Dialog) window).isResizable()) { g.setColor(highlight); // Draw the Long highlight lines g.drawLine( corner+1, 3, w-corner, 3); g.drawLine( 3, corner+1, 3, h-corner); g.drawLine( w-2, corner+1, w-2, h-corner); g.drawLine( corner+1, h-2, w-corner, h-2); g.setColor(shadow); // Draw the Long shadow lines g.drawLine( corner, 2, w-corner-1, 2); g.drawLine( 2, corner, 2, h-corner-1); g.drawLine( w-3, corner, w-3, h-corner-1); g.drawLine( corner, h-3, w-corner-1, h-3); } }
Example 4
Source File: MetalBorders.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { Color background; Color highlight; Color shadow; Window window = SwingUtilities.getWindowAncestor(c); if (window != null && window.isActive()) { background = MetalLookAndFeel.getPrimaryControlDarkShadow(); highlight = MetalLookAndFeel.getPrimaryControlShadow(); shadow = MetalLookAndFeel.getPrimaryControlInfo(); } else { background = MetalLookAndFeel.getControlDarkShadow(); highlight = MetalLookAndFeel.getControlShadow(); shadow = MetalLookAndFeel.getControlInfo(); } g.setColor(background); // Draw outermost lines g.drawLine( x+1, y+0, x+w-2, y+0); g.drawLine( x+0, y+1, x+0, y +h-2); g.drawLine( x+w-1, y+1, x+w-1, y+h-2); g.drawLine( x+1, y+h-1, x+w-2, y+h-1); // Draw the bulk of the border for (int i = 1; i < 5; i++) { g.drawRect(x+i,y+i,w-(i*2)-1, h-(i*2)-1); } if ((window instanceof Frame) && ((Frame) window).isResizable()) { g.setColor(highlight); // Draw the Long highlight lines g.drawLine( corner+1, 3, w-corner, 3); g.drawLine( 3, corner+1, 3, h-corner); g.drawLine( w-2, corner+1, w-2, h-corner); g.drawLine( corner+1, h-2, w-corner, h-2); g.setColor(shadow); // Draw the Long shadow lines g.drawLine( corner, 2, w-corner-1, 2); g.drawLine( 2, corner, 2, h-corner-1); g.drawLine( w-3, corner, w-3, h-corner-1); g.drawLine( corner, h-3, w-corner-1, h-3); } }
Example 5
Source File: MetalBorders.java From Bytecoder with Apache License 2.0 | 4 votes |
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { Color background; Color highlight; Color shadow; Window window = SwingUtilities.getWindowAncestor(c); if (window != null && window.isActive()) { background = getActiveBackground(); highlight = getActiveHighlight(); shadow = getActiveShadow(); } else { background = getInactiveBackground(); highlight = getInactiveHighlight(); shadow = getInactiveShadow(); } g.setColor(background); // Draw outermost lines g.drawLine( x + 1, y + 0, x + w-2, y + 0); g.drawLine( x + 0, y + 1, x + 0, y + h - 2); g.drawLine( x + w - 1, y + 1, x + w - 1, y + h - 2); g.drawLine( x + 1, y + h - 1, x + w - 2, y + h - 1); // Draw the bulk of the border for (int i = 1; i < 5; i++) { g.drawRect(x+i,y+i,w-(i*2)-1, h-(i*2)-1); } if ((window instanceof Dialog) && ((Dialog) window).isResizable()) { g.setColor(highlight); // Draw the Long highlight lines g.drawLine( corner+1, 3, w-corner, 3); g.drawLine( 3, corner+1, 3, h-corner); g.drawLine( w-2, corner+1, w-2, h-corner); g.drawLine( corner+1, h-2, w-corner, h-2); g.setColor(shadow); // Draw the Long shadow lines g.drawLine( corner, 2, w-corner-1, 2); g.drawLine( 2, corner, 2, h-corner-1); g.drawLine( w-3, corner, w-3, h-corner-1); g.drawLine( corner, h-3, w-corner-1, h-3); } }
Example 6
Source File: MetalBorders.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { Color background; Color highlight; Color shadow; Window window = SwingUtilities.getWindowAncestor(c); if (window != null && window.isActive()) { background = MetalLookAndFeel.getPrimaryControlDarkShadow(); highlight = MetalLookAndFeel.getPrimaryControlShadow(); shadow = MetalLookAndFeel.getPrimaryControlInfo(); } else { background = MetalLookAndFeel.getControlDarkShadow(); highlight = MetalLookAndFeel.getControlShadow(); shadow = MetalLookAndFeel.getControlInfo(); } g.setColor(background); // Draw outermost lines g.drawLine( x+1, y+0, x+w-2, y+0); g.drawLine( x+0, y+1, x+0, y +h-2); g.drawLine( x+w-1, y+1, x+w-1, y+h-2); g.drawLine( x+1, y+h-1, x+w-2, y+h-1); // Draw the bulk of the border for (int i = 1; i < 5; i++) { g.drawRect(x+i,y+i,w-(i*2)-1, h-(i*2)-1); } if ((window instanceof Frame) && ((Frame) window).isResizable()) { g.setColor(highlight); // Draw the Long highlight lines g.drawLine( corner+1, 3, w-corner, 3); g.drawLine( 3, corner+1, 3, h-corner); g.drawLine( w-2, corner+1, w-2, h-corner); g.drawLine( corner+1, h-2, w-corner, h-2); g.setColor(shadow); // Draw the Long shadow lines g.drawLine( corner, 2, w-corner-1, 2); g.drawLine( 2, corner, 2, h-corner-1); g.drawLine( w-3, corner, w-3, h-corner-1); g.drawLine( corner, h-3, w-corner-1, h-3); } }
Example 7
Source File: MetalBorders.java From Java8CN with Apache License 2.0 | 4 votes |
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { Color background; Color highlight; Color shadow; Window window = SwingUtilities.getWindowAncestor(c); if (window != null && window.isActive()) { background = getActiveBackground(); highlight = getActiveHighlight(); shadow = getActiveShadow(); } else { background = getInactiveBackground(); highlight = getInactiveHighlight(); shadow = getInactiveShadow(); } g.setColor(background); // Draw outermost lines g.drawLine( x + 1, y + 0, x + w-2, y + 0); g.drawLine( x + 0, y + 1, x + 0, y + h - 2); g.drawLine( x + w - 1, y + 1, x + w - 1, y + h - 2); g.drawLine( x + 1, y + h - 1, x + w - 2, y + h - 1); // Draw the bulk of the border for (int i = 1; i < 5; i++) { g.drawRect(x+i,y+i,w-(i*2)-1, h-(i*2)-1); } if ((window instanceof Dialog) && ((Dialog) window).isResizable()) { g.setColor(highlight); // Draw the Long highlight lines g.drawLine( corner+1, 3, w-corner, 3); g.drawLine( 3, corner+1, 3, h-corner); g.drawLine( w-2, corner+1, w-2, h-corner); g.drawLine( corner+1, h-2, w-corner, h-2); g.setColor(shadow); // Draw the Long shadow lines g.drawLine( corner, 2, w-corner-1, 2); g.drawLine( 2, corner, 2, h-corner-1); g.drawLine( w-3, corner, w-3, h-corner-1); g.drawLine( corner, h-3, w-corner-1, h-3); } }
Example 8
Source File: MetalBorders.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { Color background; Color highlight; Color shadow; Window window = SwingUtilities.getWindowAncestor(c); if (window != null && window.isActive()) { background = MetalLookAndFeel.getPrimaryControlDarkShadow(); highlight = MetalLookAndFeel.getPrimaryControlShadow(); shadow = MetalLookAndFeel.getPrimaryControlInfo(); } else { background = MetalLookAndFeel.getControlDarkShadow(); highlight = MetalLookAndFeel.getControlShadow(); shadow = MetalLookAndFeel.getControlInfo(); } g.setColor(background); // Draw outermost lines g.drawLine( x+1, y+0, x+w-2, y+0); g.drawLine( x+0, y+1, x+0, y +h-2); g.drawLine( x+w-1, y+1, x+w-1, y+h-2); g.drawLine( x+1, y+h-1, x+w-2, y+h-1); // Draw the bulk of the border for (int i = 1; i < 5; i++) { g.drawRect(x+i,y+i,w-(i*2)-1, h-(i*2)-1); } if ((window instanceof Frame) && ((Frame) window).isResizable()) { g.setColor(highlight); // Draw the Long highlight lines g.drawLine( corner+1, 3, w-corner, 3); g.drawLine( 3, corner+1, 3, h-corner); g.drawLine( w-2, corner+1, w-2, h-corner); g.drawLine( corner+1, h-2, w-corner, h-2); g.setColor(shadow); // Draw the Long shadow lines g.drawLine( corner, 2, w-corner-1, 2); g.drawLine( 2, corner, 2, h-corner-1); g.drawLine( w-3, corner, w-3, h-corner-1); g.drawLine( corner, h-3, w-corner-1, h-3); } }
Example 9
Source File: MetalBorders.java From hottub with GNU General Public License v2.0 | 4 votes |
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { Color background; Color highlight; Color shadow; Window window = SwingUtilities.getWindowAncestor(c); if (window != null && window.isActive()) { background = MetalLookAndFeel.getPrimaryControlDarkShadow(); highlight = MetalLookAndFeel.getPrimaryControlShadow(); shadow = MetalLookAndFeel.getPrimaryControlInfo(); } else { background = MetalLookAndFeel.getControlDarkShadow(); highlight = MetalLookAndFeel.getControlShadow(); shadow = MetalLookAndFeel.getControlInfo(); } g.setColor(background); // Draw outermost lines g.drawLine( x+1, y+0, x+w-2, y+0); g.drawLine( x+0, y+1, x+0, y +h-2); g.drawLine( x+w-1, y+1, x+w-1, y+h-2); g.drawLine( x+1, y+h-1, x+w-2, y+h-1); // Draw the bulk of the border for (int i = 1; i < 5; i++) { g.drawRect(x+i,y+i,w-(i*2)-1, h-(i*2)-1); } if ((window instanceof Frame) && ((Frame) window).isResizable()) { g.setColor(highlight); // Draw the Long highlight lines g.drawLine( corner+1, 3, w-corner, 3); g.drawLine( 3, corner+1, 3, h-corner); g.drawLine( w-2, corner+1, w-2, h-corner); g.drawLine( corner+1, h-2, w-corner, h-2); g.setColor(shadow); // Draw the Long shadow lines g.drawLine( corner, 2, w-corner-1, 2); g.drawLine( 2, corner, 2, h-corner-1); g.drawLine( w-3, corner, w-3, h-corner-1); g.drawLine( corner, h-3, w-corner-1, h-3); } }
Example 10
Source File: MetalBorders.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { Color background; Color highlight; Color shadow; Window window = SwingUtilities.getWindowAncestor(c); if (window != null && window.isActive()) { background = getActiveBackground(); highlight = getActiveHighlight(); shadow = getActiveShadow(); } else { background = getInactiveBackground(); highlight = getInactiveHighlight(); shadow = getInactiveShadow(); } g.setColor(background); // Draw outermost lines g.drawLine( x + 1, y + 0, x + w-2, y + 0); g.drawLine( x + 0, y + 1, x + 0, y + h - 2); g.drawLine( x + w - 1, y + 1, x + w - 1, y + h - 2); g.drawLine( x + 1, y + h - 1, x + w - 2, y + h - 1); // Draw the bulk of the border for (int i = 1; i < 5; i++) { g.drawRect(x+i,y+i,w-(i*2)-1, h-(i*2)-1); } if ((window instanceof Dialog) && ((Dialog) window).isResizable()) { g.setColor(highlight); // Draw the Long highlight lines g.drawLine( corner+1, 3, w-corner, 3); g.drawLine( 3, corner+1, 3, h-corner); g.drawLine( w-2, corner+1, w-2, h-corner); g.drawLine( corner+1, h-2, w-corner, h-2); g.setColor(shadow); // Draw the Long shadow lines g.drawLine( corner, 2, w-corner-1, 2); g.drawLine( 2, corner, 2, h-corner-1); g.drawLine( w-3, corner, w-3, h-corner-1); g.drawLine( corner, h-3, w-corner-1, h-3); } }
Example 11
Source File: MetalBorders.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { Color background; Color highlight; Color shadow; Window window = SwingUtilities.getWindowAncestor(c); if (window != null && window.isActive()) { background = MetalLookAndFeel.getPrimaryControlDarkShadow(); highlight = MetalLookAndFeel.getPrimaryControlShadow(); shadow = MetalLookAndFeel.getPrimaryControlInfo(); } else { background = MetalLookAndFeel.getControlDarkShadow(); highlight = MetalLookAndFeel.getControlShadow(); shadow = MetalLookAndFeel.getControlInfo(); } g.setColor(background); // Draw outermost lines g.drawLine( x+1, y+0, x+w-2, y+0); g.drawLine( x+0, y+1, x+0, y +h-2); g.drawLine( x+w-1, y+1, x+w-1, y+h-2); g.drawLine( x+1, y+h-1, x+w-2, y+h-1); // Draw the bulk of the border for (int i = 1; i < 5; i++) { g.drawRect(x+i,y+i,w-(i*2)-1, h-(i*2)-1); } if ((window instanceof Frame) && ((Frame) window).isResizable()) { g.setColor(highlight); // Draw the Long highlight lines g.drawLine( corner+1, 3, w-corner, 3); g.drawLine( 3, corner+1, 3, h-corner); g.drawLine( w-2, corner+1, w-2, h-corner); g.drawLine( corner+1, h-2, w-corner, h-2); g.setColor(shadow); // Draw the Long shadow lines g.drawLine( corner, 2, w-corner-1, 2); g.drawLine( 2, corner, 2, h-corner-1); g.drawLine( w-3, corner, w-3, h-corner-1); g.drawLine( corner, h-3, w-corner-1, h-3); } }
Example 12
Source File: BETitlePane.java From beautyeye with Apache License 2.0 | 4 votes |
/** * Renders the TitlePane. * * @param g the g */ public void paintComponent(Graphics g) { // As state isn't bound, we need a convenience place to check // if it has changed. Changing the state typically changes the if (getFrame() != null) { setState(getFrame().getExtendedState()); } JRootPane rootPane = getRootPane(); Window window = getWindow(); boolean leftToRight = (window == null) ? rootPane .getComponentOrientation().isLeftToRight() : window .getComponentOrientation().isLeftToRight(); boolean isSelected = (window == null) ? true : window.isActive(); int width = getWidth(); int height = getHeight(); Color background; Color foreground; Color darkShadow; if (isSelected) { background = activeBackground; foreground = activeForeground; darkShadow = activeShadow; } else { background = inactiveBackground; foreground = inactiveForeground; darkShadow = inactiveShadow; // bumps = inactiveBumps; } //----------------------------------------------- 标题背景 paintTitlePane(g,0,0,width,height,isSelected); //----------------------------------------------- 标题文字和图片 int xOffset = leftToRight ? 5 : width - 5; if (getWindowDecorationStyle() == JRootPane.FRAME||getWindowDecorationStyle() ==JRootPane.PLAIN_DIALOG) { xOffset += leftToRight ? IMAGE_WIDTH + 5 : -IMAGE_WIDTH - 5; } String theTitle = getTitle(); if (theTitle != null) { FontMetrics fm = MySwingUtilities2.getFontMetrics(rootPane, g); int yOffset = ((height - fm.getHeight()) / 2) + fm.getAscent(); Rectangle rect = new Rectangle(0, 0, 0, 0); if (iconifyButton != null && iconifyButton.getParent() != null) { rect = iconifyButton.getBounds(); } int titleW; if (leftToRight) { if (rect.x == 0) { rect.x = window.getWidth() - window.getInsets().right - 2; } titleW = rect.x - xOffset - 4; theTitle = MySwingUtilities2.clipStringIfNecessary(rootPane, fm, theTitle, titleW); } else { titleW = xOffset - rect.x - rect.width - 4; theTitle = MySwingUtilities2.clipStringIfNecessary(rootPane, fm, theTitle, titleW); xOffset -= MySwingUtilities2.stringWidth(rootPane, fm, theTitle); } int titleLength = MySwingUtilities2.stringWidth(rootPane, fm,theTitle); g.setColor(foreground); MySwingUtilities2.drawString(rootPane, g, theTitle, xOffset, yOffset); xOffset += leftToRight ? titleLength + 5 : -5; } }
Example 13
Source File: MetalBorders.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { Color background; Color highlight; Color shadow; Window window = SwingUtilities.getWindowAncestor(c); if (window != null && window.isActive()) { background = MetalLookAndFeel.getPrimaryControlDarkShadow(); highlight = MetalLookAndFeel.getPrimaryControlShadow(); shadow = MetalLookAndFeel.getPrimaryControlInfo(); } else { background = MetalLookAndFeel.getControlDarkShadow(); highlight = MetalLookAndFeel.getControlShadow(); shadow = MetalLookAndFeel.getControlInfo(); } g.setColor(background); // Draw outermost lines g.drawLine( x+1, y+0, x+w-2, y+0); g.drawLine( x+0, y+1, x+0, y +h-2); g.drawLine( x+w-1, y+1, x+w-1, y+h-2); g.drawLine( x+1, y+h-1, x+w-2, y+h-1); // Draw the bulk of the border for (int i = 1; i < 5; i++) { g.drawRect(x+i,y+i,w-(i*2)-1, h-(i*2)-1); } if ((window instanceof Frame) && ((Frame) window).isResizable()) { g.setColor(highlight); // Draw the Long highlight lines g.drawLine( corner+1, 3, w-corner, 3); g.drawLine( 3, corner+1, 3, h-corner); g.drawLine( w-2, corner+1, w-2, h-corner); g.drawLine( corner+1, h-2, w-corner, h-2); g.setColor(shadow); // Draw the Long shadow lines g.drawLine( corner, 2, w-corner-1, 2); g.drawLine( 2, corner, 2, h-corner-1); g.drawLine( w-3, corner, w-3, h-corner-1); g.drawLine( corner, h-3, w-corner-1, h-3); } }
Example 14
Source File: MetalBorders.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { Color background; Color highlight; Color shadow; Window window = SwingUtilities.getWindowAncestor(c); if (window != null && window.isActive()) { background = MetalLookAndFeel.getPrimaryControlDarkShadow(); highlight = MetalLookAndFeel.getPrimaryControlShadow(); shadow = MetalLookAndFeel.getPrimaryControlInfo(); } else { background = MetalLookAndFeel.getControlDarkShadow(); highlight = MetalLookAndFeel.getControlShadow(); shadow = MetalLookAndFeel.getControlInfo(); } g.setColor(background); // Draw outermost lines g.drawLine( x+1, y+0, x+w-2, y+0); g.drawLine( x+0, y+1, x+0, y +h-2); g.drawLine( x+w-1, y+1, x+w-1, y+h-2); g.drawLine( x+1, y+h-1, x+w-2, y+h-1); // Draw the bulk of the border for (int i = 1; i < 5; i++) { g.drawRect(x+i,y+i,w-(i*2)-1, h-(i*2)-1); } if ((window instanceof Frame) && ((Frame) window).isResizable()) { g.setColor(highlight); // Draw the Long highlight lines g.drawLine( corner+1, 3, w-corner, 3); g.drawLine( 3, corner+1, 3, h-corner); g.drawLine( w-2, corner+1, w-2, h-corner); g.drawLine( corner+1, h-2, w-corner, h-2); g.setColor(shadow); // Draw the Long shadow lines g.drawLine( corner, 2, w-corner-1, 2); g.drawLine( 2, corner, 2, h-corner-1); g.drawLine( w-3, corner, w-3, h-corner-1); g.drawLine( corner, h-3, w-corner-1, h-3); } }
Example 15
Source File: MetalBorders.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { Color background; Color highlight; Color shadow; Window window = SwingUtilities.getWindowAncestor(c); if (window != null && window.isActive()) { background = MetalLookAndFeel.getPrimaryControlDarkShadow(); highlight = MetalLookAndFeel.getPrimaryControlShadow(); shadow = MetalLookAndFeel.getPrimaryControlInfo(); } else { background = MetalLookAndFeel.getControlDarkShadow(); highlight = MetalLookAndFeel.getControlShadow(); shadow = MetalLookAndFeel.getControlInfo(); } g.setColor(background); // Draw outermost lines g.drawLine( x+1, y+0, x+w-2, y+0); g.drawLine( x+0, y+1, x+0, y +h-2); g.drawLine( x+w-1, y+1, x+w-1, y+h-2); g.drawLine( x+1, y+h-1, x+w-2, y+h-1); // Draw the bulk of the border for (int i = 1; i < 5; i++) { g.drawRect(x+i,y+i,w-(i*2)-1, h-(i*2)-1); } if ((window instanceof Frame) && ((Frame) window).isResizable()) { g.setColor(highlight); // Draw the Long highlight lines g.drawLine( corner+1, 3, w-corner, 3); g.drawLine( 3, corner+1, 3, h-corner); g.drawLine( w-2, corner+1, w-2, h-corner); g.drawLine( corner+1, h-2, w-corner, h-2); g.setColor(shadow); // Draw the Long shadow lines g.drawLine( corner, 2, w-corner-1, 2); g.drawLine( 2, corner, 2, h-corner-1); g.drawLine( w-3, corner, w-3, h-corner-1); g.drawLine( corner, h-3, w-corner-1, h-3); } }
Example 16
Source File: MetalBorders.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { Color background; Color highlight; Color shadow; Window window = SwingUtilities.getWindowAncestor(c); if (window != null && window.isActive()) { background = getActiveBackground(); highlight = getActiveHighlight(); shadow = getActiveShadow(); } else { background = getInactiveBackground(); highlight = getInactiveHighlight(); shadow = getInactiveShadow(); } g.setColor(background); // Draw outermost lines g.drawLine( x + 1, y + 0, x + w-2, y + 0); g.drawLine( x + 0, y + 1, x + 0, y + h - 2); g.drawLine( x + w - 1, y + 1, x + w - 1, y + h - 2); g.drawLine( x + 1, y + h - 1, x + w - 2, y + h - 1); // Draw the bulk of the border for (int i = 1; i < 5; i++) { g.drawRect(x+i,y+i,w-(i*2)-1, h-(i*2)-1); } if ((window instanceof Dialog) && ((Dialog) window).isResizable()) { g.setColor(highlight); // Draw the Long highlight lines g.drawLine( corner+1, 3, w-corner, 3); g.drawLine( 3, corner+1, 3, h-corner); g.drawLine( w-2, corner+1, w-2, h-corner); g.drawLine( corner+1, h-2, w-corner, h-2); g.setColor(shadow); // Draw the Long shadow lines g.drawLine( corner, 2, w-corner-1, 2); g.drawLine( 2, corner, 2, h-corner-1); g.drawLine( w-3, corner, w-3, h-corner-1); g.drawLine( corner, h-3, w-corner-1, h-3); } }
Example 17
Source File: MetalBorders.java From hottub with GNU General Public License v2.0 | 4 votes |
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { Color background; Color highlight; Color shadow; Window window = SwingUtilities.getWindowAncestor(c); if (window != null && window.isActive()) { background = getActiveBackground(); highlight = getActiveHighlight(); shadow = getActiveShadow(); } else { background = getInactiveBackground(); highlight = getInactiveHighlight(); shadow = getInactiveShadow(); } g.setColor(background); // Draw outermost lines g.drawLine( x + 1, y + 0, x + w-2, y + 0); g.drawLine( x + 0, y + 1, x + 0, y + h - 2); g.drawLine( x + w - 1, y + 1, x + w - 1, y + h - 2); g.drawLine( x + 1, y + h - 1, x + w - 2, y + h - 1); // Draw the bulk of the border for (int i = 1; i < 5; i++) { g.drawRect(x+i,y+i,w-(i*2)-1, h-(i*2)-1); } if ((window instanceof Dialog) && ((Dialog) window).isResizable()) { g.setColor(highlight); // Draw the Long highlight lines g.drawLine( corner+1, 3, w-corner, 3); g.drawLine( 3, corner+1, 3, h-corner); g.drawLine( w-2, corner+1, w-2, h-corner); g.drawLine( corner+1, h-2, w-corner, h-2); g.setColor(shadow); // Draw the Long shadow lines g.drawLine( corner, 2, w-corner-1, 2); g.drawLine( 2, corner, 2, h-corner-1); g.drawLine( w-3, corner, w-3, h-corner-1); g.drawLine( corner, h-3, w-corner-1, h-3); } }
Example 18
Source File: MetalBorders.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { Color background; Color highlight; Color shadow; Window window = SwingUtilities.getWindowAncestor(c); if (window != null && window.isActive()) { background = getActiveBackground(); highlight = getActiveHighlight(); shadow = getActiveShadow(); } else { background = getInactiveBackground(); highlight = getInactiveHighlight(); shadow = getInactiveShadow(); } g.setColor(background); // Draw outermost lines g.drawLine( x + 1, y + 0, x + w-2, y + 0); g.drawLine( x + 0, y + 1, x + 0, y + h - 2); g.drawLine( x + w - 1, y + 1, x + w - 1, y + h - 2); g.drawLine( x + 1, y + h - 1, x + w - 2, y + h - 1); // Draw the bulk of the border for (int i = 1; i < 5; i++) { g.drawRect(x+i,y+i,w-(i*2)-1, h-(i*2)-1); } if ((window instanceof Dialog) && ((Dialog) window).isResizable()) { g.setColor(highlight); // Draw the Long highlight lines g.drawLine( corner+1, 3, w-corner, 3); g.drawLine( 3, corner+1, 3, h-corner); g.drawLine( w-2, corner+1, w-2, h-corner); g.drawLine( corner+1, h-2, w-corner, h-2); g.setColor(shadow); // Draw the Long shadow lines g.drawLine( corner, 2, w-corner-1, 2); g.drawLine( 2, corner, 2, h-corner-1); g.drawLine( w-3, corner, w-3, h-corner-1); g.drawLine( corner, h-3, w-corner-1, h-3); } }
Example 19
Source File: MetalBorders.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { Color background; Color highlight; Color shadow; Window window = SwingUtilities.getWindowAncestor(c); if (window != null && window.isActive()) { background = getActiveBackground(); highlight = getActiveHighlight(); shadow = getActiveShadow(); } else { background = getInactiveBackground(); highlight = getInactiveHighlight(); shadow = getInactiveShadow(); } g.setColor(background); // Draw outermost lines g.drawLine( x + 1, y + 0, x + w-2, y + 0); g.drawLine( x + 0, y + 1, x + 0, y + h - 2); g.drawLine( x + w - 1, y + 1, x + w - 1, y + h - 2); g.drawLine( x + 1, y + h - 1, x + w - 2, y + h - 1); // Draw the bulk of the border for (int i = 1; i < 5; i++) { g.drawRect(x+i,y+i,w-(i*2)-1, h-(i*2)-1); } if ((window instanceof Dialog) && ((Dialog) window).isResizable()) { g.setColor(highlight); // Draw the Long highlight lines g.drawLine( corner+1, 3, w-corner, 3); g.drawLine( 3, corner+1, 3, h-corner); g.drawLine( w-2, corner+1, w-2, h-corner); g.drawLine( corner+1, h-2, w-corner, h-2); g.setColor(shadow); // Draw the Long shadow lines g.drawLine( corner, 2, w-corner-1, 2); g.drawLine( 2, corner, 2, h-corner-1); g.drawLine( w-3, corner, w-3, h-corner-1); g.drawLine( corner, h-3, w-corner-1, h-3); } }
Example 20
Source File: MetalBorders.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { Color background; Color highlight; Color shadow; Window window = SwingUtilities.getWindowAncestor(c); if (window != null && window.isActive()) { background = getActiveBackground(); highlight = getActiveHighlight(); shadow = getActiveShadow(); } else { background = getInactiveBackground(); highlight = getInactiveHighlight(); shadow = getInactiveShadow(); } g.setColor(background); // Draw outermost lines g.drawLine( x + 1, y + 0, x + w-2, y + 0); g.drawLine( x + 0, y + 1, x + 0, y + h - 2); g.drawLine( x + w - 1, y + 1, x + w - 1, y + h - 2); g.drawLine( x + 1, y + h - 1, x + w - 2, y + h - 1); // Draw the bulk of the border for (int i = 1; i < 5; i++) { g.drawRect(x+i,y+i,w-(i*2)-1, h-(i*2)-1); } if ((window instanceof Dialog) && ((Dialog) window).isResizable()) { g.setColor(highlight); // Draw the Long highlight lines g.drawLine( corner+1, 3, w-corner, 3); g.drawLine( 3, corner+1, 3, h-corner); g.drawLine( w-2, corner+1, w-2, h-corner); g.drawLine( corner+1, h-2, w-corner, h-2); g.setColor(shadow); // Draw the Long shadow lines g.drawLine( corner, 2, w-corner-1, 2); g.drawLine( 2, corner, 2, h-corner-1); g.drawLine( w-3, corner, w-3, h-corner-1); g.drawLine( corner, h-3, w-corner-1, h-3); } }