您现在的位置是:Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款 >
07 youtube to pdf 買粉絲(AWS認證權威考經(助理級認證篇))
Instagram刷粉絲, Ins買粉絲自助下單平台, Ins買贊網站可微信支付寶付款2024-06-07 19:33:37【】2人已围观
简介有透明工具提示的示例幀注意與工具提示保持視覺(透明性和拖放陰影邊框)上的一致性跨越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 awt AWTUtilities setWindowOpaque(reflection false) } } }) this addWindowListener(new WindowAdapter() { @Override public void windowActivated(WindowEvent e) { // force showing the reflection window reflection setAlwaysOnTop(true) reflection setAlwaysOnTop(false) } }) 重畫管理器相當簡單 它強制主楨的整個根窗格重畫 然后更新反射窗口 這樣可以最優化更新區域反射的同步 對于示例應用程序要達到的目的 這點就足夠了
private class ReflectionRepaintManager extends RepaintManager { @Override public void addDirtyRegion(JComponent c int x int y i
很赞哦!(55669)
相关文章
- download video youtube ios(怎樣從網站上下載免費的視頻?)
- youtube music downloader free mp4電影下載(為什么我用Youtube Downloader HD 最新版的軟件 去下載Youtube 上的視頻 我把地址復制上去后)
- download youtube android apk下載(手機文件哪些可以刪)
- youtube music download windows pcl2啟動器官網下載(pcl2啟動器蘋果電腦能下載嗎)
- youtube music downloader mp3 free downloader_helper.exe(為什么我用Youtube Downloader HD 最新版的軟件 去下載Youtube 上的視頻 我把地址復制上去后)
- download video youtube chrome官網網址(如何把網頁中的視頻下載下來?)
- download youtube music to android x86(youtube music下載的文件在哪里)
- youtube music downloader free mp3 windows10下載器(為什么我用Youtube Downloader HD 最新版的軟件 去下載Youtube 上的視頻 我把地址復制上去后)
- download youtube music machine learning(從python基礎到爬蟲的書有什么值得推薦)
- download youtube music macbook air(如何讓YTmusic在后臺播放)
热门文章
站长推荐
download video youtube ios模擬器網頁版(對于ios8的系統,有哪些插件不兼容)
download youtube edge extension does(微軟正測試為Edge瀏覽器引入YouTube集成和新的發現選項卡)
youtube music downloader pro(為什么我用Youtube Downloader HD 最新版的軟件 去下載Youtube 上的視頻 我把地址復制上去后)
youtube music for pc apple(如何讓YTmusic在后臺播放)
download video youtube chrome瀏覽器官方下載(macbook怎么刪除chrome的youtube)
youtube music free country playlist 2020(如何讓YTmusic在后臺播放)
download youtube music to macbook截圖快捷鍵(如何在youtubemusic中創建快捷指令)
youtube music downloader mp3 mp4播放器軟件排行榜哪款好(為什么我用Youtube Downloader HD 最新版的軟件 去下載Youtube 上的視頻 我把地址復制上去后)