OmegaT の背景に画像を表示します。
ボタンパネルの透過・不透過の切り替えに対応
| @@ -37,7 +37,6 @@ | ||
| 37 | 37 | import javax.swing.JPanel; |
| 38 | 38 | import javax.swing.JScrollPane; |
| 39 | 39 | import org.omegat.core.Core; |
| 40 | -import org.omegat.util.Log; | |
| 41 | 40 | import org.omegat.util.gui.UIThreadsUtil; |
| 42 | 41 | |
| 43 | 42 | /** |
| @@ -54,7 +53,7 @@ | ||
| 54 | 53 | private JMenuBar menuBar; |
| 55 | 54 | private DockingDesktop desktop; |
| 56 | 55 | private JPanel statusBar; |
| 57 | - private JPanel buttonPanel; | |
| 56 | + private AutoHideButtonPanel buttonPanel; | |
| 58 | 57 | |
| 59 | 58 | |
| 60 | 59 | private boolean makeTransparentMenubar = true; |
| @@ -304,24 +303,33 @@ | ||
| 304 | 303 | return null; |
| 305 | 304 | } |
| 306 | 305 | |
| 307 | - private JPanel getButtonPanel(DockingDesktop desktop) { | |
| 306 | + private AutoHideButtonPanel getButtonPanel(DockingDesktop desktop) { | |
| 308 | 307 | // desktop |
| 309 | 308 | // + com.vlsolutions.swing.docking.AutoHideExpandPanel // 非表示 |
| 310 | 309 | // + com.vlsolutions.swing.docking.DockingDesktop$1 // ボタンパネルの上の領域、ボタンパネルが非表示の場合は下のパネルと同じサイズ |
| 311 | 310 | // + javax.swing.JPanel // ボタンパネルを含む領域 <= this |
| 312 | 311 | |
| 313 | - JPanel panel = getJPanel(desktop); | |
| 312 | + JPanel panel = null; | |
| 313 | + for (Component c: desktop.getComponents()) { | |
| 314 | + // AutoHideExpandPanel も JPanel 派生のため、instanceof で判定すると | |
| 315 | + // 先にそっちを掴むので注意 | |
| 316 | + if (c.getClass().getName().equals("javax.swing.JPanel")) { | |
| 317 | + panel = (JPanel) c; | |
| 318 | + break; | |
| 319 | + } | |
| 320 | + } | |
| 321 | + | |
| 314 | 322 | // panel |
| 315 | 323 | // + com.vlsolutions.swing.docking.AutoHideButtonPanel // 非表示、未使用 |
| 316 | 324 | // + com.vlsolutions.swing.docking.AutoHideButtonPanel // 非表示、未使用 |
| 317 | - // + com.vlsolutions.swing.docking.AutoHideButtonPanel // ボタンがあれば表示(isShowing()、isVisible() ともに true) | |
| 325 | + // + com.vlsolutions.swing.docking.AutoHideButtonPanel // ボタンがあれば表示(isShowing()、isVisible() ともに true) <= this | |
| 318 | 326 | // + com.vlsolutions.swing.docking.AutoHideButtonPanel // 非表示、未使用 |
| 319 | 327 | // + com.vlsolutions.swing.docking.DockingPanel // ボタンパネルの上の領域 |
| 320 | - | |
| 321 | - // 3番目の AutoHideButtonPanel を取得したい。 | |
| 322 | - // 状態が不明(表示/非表示で識別できるかどうか分からない)なので、 | |
| 323 | - // とりあえずインデックスで決め打ちする。 | |
| 324 | - return (JPanel) panel.getComponent(2); | |
| 328 | + | |
| 329 | + // ここでは 3 番目の AutoHideButtonPanel を取得したい。 | |
| 330 | + // 状態が不明(非表示の場合は、他の AutoHideButtonPanel と識別できない) | |
| 331 | + // なので、とりあえずインデックスで決め打ちする。 | |
| 332 | + return (AutoHideButtonPanel) panel.getComponent(2); | |
| 325 | 333 | } |
| 326 | 334 | |
| 327 | 335 | private JEditorPane getJEditorPaneFromEditor(DockingDesktop desktop) { |