Questions tagged «swingutilities»


4
Java / Swing:从JPanel内部获取Window / JFrame
如何获得JPanel所在的JFrame? 我当前的解决方案是询问面板的父面板(依此类推),直到找到Window: Container parent = this; // this is a JPanel do { parent = parent.getParent(); } while (!(parent instanceof Window) && parent != null); if (parent != null) { // found a parent Window } 标准库中有没有更优雅的方法?
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.