您现在的位置是:Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款 > 

12 youtube to pdf 買粉絲(芭比動畫片的片尾曲叫什么名字?)

Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款2024-04-29 04:14:45【】9人已围观

简介thispopupWindowsetVisible(true)thispopupWindowpack()//markthewindowasnonopaquesothatthe//shadowborde

this popupWindow setVisible(true) this popupWindow pack() // mark the window as non opaque so that the // shadow border pixels take on the per pixel // translucency sun awt AWTUtilities setWindowOpaque(this popupWindow false) }hide() 方法只是隱藏并處置彈出窗口

@Override public void hide() { this popupWindow setVisible(false) this popupWindow removeAll() this popupWindow dispose() }要安裝該彈出窗口 僅簡單調用

PopupFactory setSharedInstance(new TranslucentPopupFactory()) 圖 顯示了一個具有透明工具提示的示例幀 注意 與工具提示保持視覺(透明性和拖放陰影邊框)上的一致性跨越 Swing 幀綁定并擴展到后臺 Eclipse 窗口

    圖 工具提示

現在我們做相同的動畫 當工具提示顯示時將顏色調淡些 當它被隱藏起來時把它的顏色漸隱如何?一旦您熟悉了 AWTUtilities API 上述操作不難實現 下面給出 show() 方法的代碼

@Override public void show() { if (this toFade) { // mark the popup with % opacity this currOpacity = sun awt AWTUtilities setWindowOpacity(popupWindow f) } this popupWindow setVisible(true) this popupWindow pack() // mark the window as non opaque so that the // shadow border pixels take on the per pixel // translucency sun awt AWTUtilities setWindowOpaque(this popupWindow false) if (this toFade) { // start fading in this fadeInTimer = new Timer( new ActionListener() { public void actionPerformed(ActionEvent e) { currOpacity += if (currOpacity <= ) { sun awt AWTUtilities setWindowOpacity(popupWindow currOpacity / f) // workaround bug should call // popupWindow repaint() but that will not repaint the // panel popupWindow getContentPane() repaint() } else { currOpacity = fadeInTimer stop() } } }) this fadeInTimer setRepeats(true) this fadeInTimer start() } }這時我們用0%的不透明度標記彈出窗口 然后我們啟動重復計時器進行五次迭代 每一次跌代我們增加窗口不透明度 % 并重新繪畫 最后我們停止計時器 最終的視覺結果是工具提示外觀的平滑退色序列 這一序列持續大約 毫秒

hide() 方法非常類似

@Override public void hide() { if (this toFade) { // cancel fade in if it s running if (this fadeInTimer isRunning()) this fadeInTimer stop() // start fading out this fadeOutTimer = new Timer( new ActionListener() { public void actionPerformed(ActionEvent e) { currOpacity = if (currOpacity >= ) { sun awt AWTUtilities setWindowOpacity(popupWindow currOpacity / f) // workaround bug should call // popupWindow repaint() but that will not repaint the // panel popupWindow getContentPane() repaint() } else { fadeOutTimer stop() popupWindow setVisible(false) popupWindow removeAll() popupWindow dispose() currOpacity = } } }) this fadeOutTimer setRepeats(true) this fadeOutTimer start() } else { popupWindow setVisible(false) popupWindow removeAll() popupWindow dispose() } }首先檢查退色序列是否仍在運行 根據需要將它刪除 然后 不立即隱藏窗口 而是將不透明度以 % 的增量從 % 改為 (因此漸隱序列是退色序列的兩倍)然后隱藏并處置彈出窗口 注意兩種方法參閱了 Boolean toFade 變量 —— 它在工具提示上被設置為 true 彈出窗口的其他類型(菜單 組合框下拉列表)沒有退色動畫

視頻反射現在讓我們做些更為激動人心的事情 在 Romain Guy 的博客條目 重畫管理器演示(第 章) 中 它顯示了提供反射功能的 Swing 組件 從他與 Chet Haase 合著的 《骯臟的富客戶機》 書中抽取一段測試應用程序 其中顯示該組件提供了 QuickTime 電影的實時反射 在窗口綁定 之外 進行反射如何?

首先要有實際應用中的反射幀的屏幕截圖 圖 顯示了正在播放 Get a Mac 廣告的形狀規則的 Swing 幀( 使用嵌入式 QuickTime 播放器 ) 伴隨著覆蓋桌面的透明的實時反射

圖 QuickTime 電影的反射

該實現重用了來自 Romain 的幾個構造塊并將它們擴展到 楨外 它還有一個重畫管理器 ( 要了解關于重畫管理器方面的詳細信息 請參見 使用重畫管理器的驗證覆蓋 條目 )以便將主楨內容與反射窗口保持同步 還需要在主楨上注冊組件偵聽器和窗口偵聽器以便確保反射窗口與主窗口的可見性 位置和大小保持同步 除此之外 還要有一個自定義窗格將其內容繪畫到脫屏緩沖區 脫屏緩沖區被用于繪畫主楨和在反射窗口內的反射

讓我們看一下代碼 主類是擴展 JFrame 的 JReflectionFrame 構造器創建了反射窗口并向其中添加非雙重緩沖和透明的面板 還重寫了面板的 paintComponent() 以便繪畫主楨內容的反射 在初始化反射楨的位置和大小后 我們安裝了一個自定義重畫管理器

public JReflectionFrame(String title) { super(title) reflection = new JWindow() reflectionPanel = new JPanel() { @Override protected void paintComponent(Graphics g) { // paint the reflection of the main window paintReflection(g) } } // mark the panel as non double buffered and non opaque // to make it translucent reflectionPanel setDoubleBuffered(false) reflectionPanel setOpaque(false) reflection setLayout(new BorderLayout()) reflection add(reflectionPanel BorderLayout CENTER) // register listeners see below …… // initialize the reflection size and location reflection setSize(getSize()) reflection setLocation(getX() getY() + getHeight()) reflection setVisible(true) // install custom repaint manager to force re painting // the reflection when something in the main window is // repainted RepaintManager setCurrentManager(new ReflectionRepaintManager()) }下面是保持反射窗口與主楨同步的偵聽器

this addComponentListener(new ComponentAdapter() { @Override public void ponentHidden(ComponentEvent e) { reflection setVisible(false) } @Override public void ponentMoved(ComponentEvent e) { // update the reflection location reflection setLocation(getX() getY() + getHeight()) } @Override public void ponentResized(ComponentEvent e) { // update the reflection size and location reflection setSize(getWidth() getHeight()) reflection setLocation(getX() getY() + getHeight()) } @Override public void ponentShown(ComponentEvent e) { reflection setVisible(true) // if the reflection window is opaque mark // it as per pixel translucent if ( sun awt AWTUtilities isWindowOpaque(reflection)) { sun a

很赞哦!(328)

Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款的名片

职业:程序员,设计师

现居:四川泸州古蔺县

工作室:小组

Email:[email protected]