當前位置: 首頁>>代碼示例>>Java>>正文


Java WindowUtils類代碼示例

本文整理匯總了Java中com.explodingpixels.widgets.WindowUtils的典型用法代碼示例。如果您正苦於以下問題:Java WindowUtils類的具體用法?Java WindowUtils怎麽用?Java WindowUtils使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


WindowUtils類屬於com.explodingpixels.widgets包,在下文中一共展示了WindowUtils類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: UnifiedToolBar

import com.explodingpixels.widgets.WindowUtils; //導入依賴的package包/類
/**
 * Creates a {@code UnifiedToolBar}.
 * 	 
 * @param forceSameWidth
 *            whether the two ends should have the same width to keep the center balanced.
 */
public UnifiedToolBar(boolean forceSameWidth) {
	
	fUnifiedToolBar = new TriAreaComponent(4, forceSameWidth);
	
	// TODO remove below call when Apple fixes bug in Java that doesn't
	// correctly paint the
	// TODO textured window.
	fixUnifiedToolBarOnMacIfNeccessary(fUnifiedToolBar);
	fUnifiedToolBar.getComponent().setBorder(
			Borders.createEmptyBorder("3dlu, 4dlu, 3dlu, 4dlu"));
	installUnifiedToolBarBorder(fUnifiedToolBar.getComponent());
	WindowUtils
			.installJComponentRepainterOnWindowFocusChanged(fUnifiedToolBar
					.getComponent());
}
 
開發者ID:mathieulegoc,項目名稱:SmartTokens,代碼行數:22,代碼來源:UnifiedToolBar.java

示例2: getBackgroundPainter

import com.explodingpixels.widgets.WindowUtils; //導入依賴的package包/類
private MacWidgetsPainter<Component> getBackgroundPainter() {
    MacWidgetsPainter<Component> retVal;

    boolean windowHasFocus = WindowUtils.isParentWindowFocused(fTable);
    boolean isColumnSelected = isColumnBeingPaintedSelected();
    boolean isColumnPressed = isColumnBeingPaintedPressed();

    // TODO cleanup this logic.
    if (!fTable.isEnabled()) {
        retVal = MacPainterFactory.createIAppUnpressedUnselectedHeaderPainter();
    } else if (windowHasFocus && isColumnPressed && isColumnSelected) {
        retVal = MacPainterFactory.createIAppPressedSelectedHeaderPainter();
    } else if (windowHasFocus && isColumnPressed) {
        retVal = MacPainterFactory.createIAppPressedUnselectedHeaderPainter();
    } else if (windowHasFocus && isColumnSelected) {
        retVal = MacPainterFactory.createIAppUnpressedSelectedHeaderPainter();
    } else {
        retVal = MacPainterFactory.createIAppUnpressedUnselectedHeaderPainter();
    }
    return retVal;
}
 
開發者ID:mathieulegoc,項目名稱:SmartTokens,代碼行數:22,代碼來源:ITunesTableHeaderRenderer.java

示例3: BottomBar

import com.explodingpixels.widgets.WindowUtils; //導入依賴的package包/類
/**
 * Creates a {@code BottomBar} of the given size.
 *
 * @param size the height of the {@code BottomBar}.
 */
public BottomBar(BottomBarSize size) {

	createAndInstallBackgroundPainter();
	createAndInstallBorder();

	fBottomBar.forceOuterAreasToHaveTheSameWidth();

	// TODO use the actual border insets instead of the hard-coded value 2.
	// calculate the height of the bottom bar. this includes adding two pixels to incorporate
	// the height of the line border.
	int height = size.getHeight() + 2;
	fBottomBar.getComponent().setPreferredSize(new Dimension(-1, height));

	// install a listener that will repaint this component when the parent window's focus state
	// changes.
	WindowUtils.installJComponentRepainterOnWindowFocusChanged(fBottomBar.getComponent());
}
 
開發者ID:mathieulegoc,項目名稱:SmartTokens,代碼行數:23,代碼來源:BottomBar.java

示例4: paint

import com.explodingpixels.widgets.WindowUtils; //導入依賴的package包/類
public void paint(Graphics g) 
{
	boolean containedInActiveWindow = WindowUtils.isParentWindowFocused(this);

	Color color = containedInActiveWindow
	? colorScheme.getActiveBackgroundColor() : colorScheme.getInactiveBackgroundColor();

	this.setBackground(color);
	
	int w = getWidth();
	int h = getHeight();

	Graphics2D g2 = (Graphics2D)g;
	g2.setColor(color);
	g2.fillRect(0, 0, w, h);

	paintChildren(g2);
}
 
開發者ID:mathieulegoc,項目名稱:SmartTokens,代碼行數:19,代碼來源:ActivePanel.java

示例5: paint

import com.explodingpixels.widgets.WindowUtils; //導入依賴的package包/類
public void paint(Graphics2D g, Component component, int width, int height) {
	MacWidgetsPainter<Component> painterToUse;

	Window activeAncestor = null;

	Window active = KeyboardFocusManager.getCurrentKeyboardFocusManager()
			.getActiveWindow();
	if (active != null) {
		activeAncestor = SwingUtilities.getWindowAncestor(active);
	}
	Window componentAncestor = SwingUtilities.getWindowAncestor(component);
	if (component.hasFocus() || componentAncestor.equals(activeAncestor)) {
		painterToUse = fComponentFocusedPainter;
	} else if (WindowUtils.isParentWindowFocused(component)
			|| componentAncestor.equals(activeAncestor)) {
		painterToUse = fWindowFocusedPainter;
	} else {
		painterToUse = fWindowUnfocusedPainter;
	}

	painterToUse.paint(g, component, width, height);
}
 
開發者ID:mathieulegoc,項目名稱:SmartTokens,代碼行數:23,代碼來源:FocusStatePainter.java

示例6: BottomBar

import com.explodingpixels.widgets.WindowUtils; //導入依賴的package包/類
/**
	 * Creates a {@code BottomBar} of the given size.
	 *
	 * @param size the height of the {@code BottomBar}.
	 */
	public BottomBar(BottomBarSize size) {

		createAndInstallBackgroundPainter();
		createAndInstallBorder();

//		fBottomBar.forceOuterAreasToHaveTheSameWidth();

		// TODO use the actual border insets instead of the hard-coded value 2.
		// calculate the height of the bottom bar. this includes adding two pixels to incorporate
		// the height of the line border.
		int height = size.getHeight() + 2;
		fBottomBar.getComponent().setPreferredSize(new Dimension(-1, height));

		// install a listener that will repaint this component when the parent window's focus state
		// changes.
		WindowUtils.installJComponentRepainterOnWindowFocusChanged(fBottomBar.getComponent());
	}
 
開發者ID:mediathekview,項目名稱:MediathekView,代碼行數:23,代碼來源:BottomBar.java

示例7: FocusStateMatteBorder

import com.explodingpixels.widgets.WindowUtils; //導入依賴的package包/類
public FocusStateMatteBorder(int top, int left, int bottom, int right,
                             Color focusedColor, Color unfocusedColor,
                             JComponent componentToTrackFocusOf) {
    super(top, left, bottom, right, focusedColor);
    fFocusedColor = focusedColor;
    fUnfocusedColor = unfocusedColor;
    fComponentToTrackFocusOf = componentToTrackFocusOf;
    updateColor(true);
    WindowUtils.installWeakWindowFocusListener(fComponentToTrackFocusOf, createWindowFocusListener());
}
 
開發者ID:mathieulegoc,項目名稱:SmartTokens,代碼行數:11,代碼來源:FocusStateMatteBorder.java

示例8: getImageSet

import com.explodingpixels.widgets.WindowUtils; //導入依賴的package包/類
private ImageSet getImageSet(Component objectToPaint) {
    ImageSet retVal;

    if (!objectToPaint.isEnabled()) {
        retVal = fDisabledImageSet;
    } else if (WindowUtils.isParentWindowFocused(objectToPaint)) {
        retVal = fActiveImageSet;
    } else {
        retVal = fInactiveImageSet;
    }

    return retVal;
}
 
開發者ID:mathieulegoc,項目名稱:SmartTokens,代碼行數:14,代碼來源:ScrollThumbImagePainter.java

示例9: installListeners

import com.explodingpixels.widgets.WindowUtils; //導入依賴的package包/類
@Override
protected void installListeners() {
    super.installListeners();
    // give the ScrollBarSkin the decrement and increment MouseListeners so that it may attach
    // them to the appropriate components.
    fSkin.installMouseListenersOnButtons(new CustomArrowButtonListener(-1), new CustomArrowButtonListener(1));
    // repaint the scrollbar when the focus state of the parent window changes.
    WindowUtils.installJComponentRepainterOnWindowFocusChanged(scrollbar);
}
 
開發者ID:mathieulegoc,項目名稱:SmartTokens,代碼行數:10,代碼來源:SkinnableScrollBarUI.java

示例10: init

import com.explodingpixels.widgets.WindowUtils; //導入依賴的package包/類
private void init() {
    // indicate that this frame should not make all the content draggable. by default, when you
    // set the opacity to 0 (like we do below) this property automatically gets set to true.
    // also note that this client property must be set *before* changing the opacity (not sure
    // why).
    fDialog.getRootPane().putClientProperty("apple.awt.draggableWindowBackground", Boolean.FALSE);
    fDialog.setUndecorated(true);
    fDialog.getRootPane().setOpaque(false);
    
    WindowUtils.makeWindowNonOpaque(fDialog);
    // for Java 5 on platforms other than Mac (those that don't support transparency), it looks
    // nicer to use a black background rather than the default (usually white).
    fDialog.getRootPane().setBackground(Color.BLACK);

    fHudPanel.add(fTitlePanel, BorderLayout.NORTH);

    // set the backing frame's content pane.
    fDialog.setContentPane(fHudPanel);
    // set the HUD panel's content pane to a blank JPanel by default.
    JPanel panel = new JPanel();
    panel.setOpaque(false);
    setContentPane(panel);

    // listen to the frame's title property so that we can update the label rendering the title.
    fDialog.addPropertyChangeListener("title", createTitlePropertyChangeListener());

    WindowUtils.createAndInstallRepaintWindowFocusListener(fDialog);
    new WindowDragger(fDialog, fTitlePanel);
}
 
開發者ID:mathieulegoc,項目名稱:SmartTokens,代碼行數:30,代碼來源:HudWindow.java

示例11: PreferencesTabBar

import com.explodingpixels.widgets.WindowUtils; //導入依賴的package包/類
public PreferencesTabBar() {
    Border b = BorderFactory.createEmptyBorder(0, 4, 0, 4);
    fPreferencesTabBar.getComponent().setBorder(b);
    UnifiedToolBar.installUnifiedToolBarBorder(fPreferencesTabBar.getComponent());
    fixUnifiedToolBarOnMacIfNeccessary(fPreferencesTabBar);
    WindowUtils.installJComponentRepainterOnWindowFocusChanged(fPreferencesTabBar.getComponent());
}
 
開發者ID:mathieulegoc,項目名稱:SmartTokens,代碼行數:8,代碼來源:PreferencesTabBar.java

示例12: paintEnabledText

import com.explodingpixels.widgets.WindowUtils; //導入依賴的package包/類
@Override
protected void paintEnabledText(JLabel label, Graphics g, String s,
                                int textX, int textY) {
    MacFontUtils.enableAntialiasing((Graphics2D) g);
    g.setColor(fShadowColor);
    g.setFont(label.getFont());
    BasicGraphicsUtils.drawStringUnderlineCharAt(g, s, -1, textX, textY + 1);
    g.setColor(WindowUtils.isParentWindowFocused(label)
            ? fFocusedTextColor : fUnfocusedTextColor);
    BasicGraphicsUtils.drawStringUnderlineCharAt(g, s, -1, textX, textY);
}
 
開發者ID:mathieulegoc,項目名稱:SmartTokens,代碼行數:12,代碼來源:EmphasizedLabelUI.java

示例13: installListeners

import com.explodingpixels.widgets.WindowUtils; //導入依賴的package包/類
@Override
protected void installListeners() {
    super.installListeners();
    // install a property change listener that repaints the JTree when the parent window's
    // focus state changes.
    WindowUtils.installJComponentRepainterOnWindowFocusChanged(tree);
}
 
開發者ID:mathieulegoc,項目名稱:SmartTokens,代碼行數:8,代碼來源:SourceListTreeUI.java

示例14: installUI

import com.explodingpixels.widgets.WindowUtils; //導入依賴的package包/類
@Override
public void installUI(JComponent c) {
	super.installUI(c);

	table.remove(rendererPane);
	rendererPane = createCustomCellRendererPane();
	table.add(rendererPane);

	// TODO save defaults.

	table.setOpaque(false);
	table.setFont(MacFontUtils.ITUNES_FONT);
	table.setGridColor(TABLE_GRID_COLOR);
	table.setIntercellSpacing(new Dimension(0, 0));
	table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

	table.getTableHeader().setDefaultRenderer(
			new ITunesTableHeaderRenderer(table));

	table.setShowHorizontalLines(false);
	TableHeaderUtils.makeHeaderFillEmptySpace(table);
	TableUtils.makeStriped(table, EVEN_ROW_COLOR);

	table.setDefaultRenderer(Rating.class,
			new ITunesRatingTableCellRenderer());
	table.setDefaultEditor(Object.class, createDefaultTableCellEditor());

	makeTableActive();
	WindowUtils.installWeakWindowFocusListener(table,
			createWindowFocusListener());
}
 
開發者ID:mathieulegoc,項目名稱:SmartTokens,代碼行數:32,代碼來源:ITunesTableUI.java

示例15: setDefaultLookAndFeel

import com.explodingpixels.widgets.WindowUtils; //導入依賴的package包/類
/**
     * This method sets the default look and feel before the components are
     * drawn. This is needed in case the user has changed the default look and
     * feel and we need to set something different than the usual default.
     */
    private void setDefaultLookAndFeel() {
        try {
            // System.setProperty("awt.useSystemAAFontSettings", "on");
            try { // Try to scale default font size according to screen resolution.
                Font fm = (Font) UIManager.getLookAndFeelDefaults().get("defaultFont");
                // check if laf supports default font
                if (fm != null) {
                    UIManager.getLookAndFeelDefaults().put("defaultFont", fm.deriveFont(fm.getSize2D() * Toolkit.getDefaultToolkit().getScreenResolution() / 96));
                }
            } catch (HeadlessException e) {
            }            
            // UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
            String laf = settings.getLookAndFeel();
            if (laf.equals(Constants.seaGlassLookAndFeelClassName)) {
                laf = "com.seaglasslookandfeel.SeaGlassLookAndFeel";
            }
            UIManager.setLookAndFeel(laf);
            // log info
            Constants.zknlogger.log(Level.INFO, "Using following LaF: {0}", settings.getLookAndFeel());
            // when we have mac os with aqua look and feel, set menubar to main-menubar at top of screen
            if (settings.isMacAqua()) {
                System.setProperty("apple.laf.useScreenMenuBar", "true");
                System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Zettelkasten");
                MacUtils.makeWindowLeopardStyle(ZettelkastenView.super.getFrame().getRootPane());
//                WindowUtils.createAndInstallRepaintWindowFocusListener(ZettelkastenView.super.getFrame());
                WindowUtils.installJComponentRepainterOnWindowFocusChanged(ZettelkastenView.super.getFrame().getRootPane());
            }
            if (settings.isSeaGlass()) {
                // ZettelkastenView.super.getFrame().getRootPane().putClientProperty("SeaGlass.UnifiedToolbarLook", Boolean.TRUE);
                ZettelkastenView.super.getFrame().getRootPane().setBackground(ColorUtil.colorSeaGlassGray);
            }
        } catch (UnsupportedLookAndFeelException | ClassNotFoundException | InstantiationException | IllegalAccessException ex) {
            Constants.zknlogger.log(Level.WARNING, ex.getLocalizedMessage());
        }
    }
 
開發者ID:sjPlot,項目名稱:Zettelkasten,代碼行數:41,代碼來源:ZettelkastenView.java


注:本文中的com.explodingpixels.widgets.WindowUtils類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。