我有以下輸出。Recursive call for org.jfree.chart.ChartPanel[chartpanelBoaComponent count 0 for org.jfree.chart.ChartPanel[chartpanelBoa我運行以獲得此輸出的代碼是public void enableEverything(Container c){Component [] p = c.getComponents();System.out.println("Component count " + c.getComponentCount() + " for " + c.toString().substring(0,40) );for(Component pp : p){pp.setEnabled(true);if(pp instanceof Container){System.out.println("Recursive call for " + pp.toString().substring(0,40));enableEverything((Container) pp);}else System.out.println("No recursive call");}}ChartPanel 可以在我的 JPanel 中看到,但它不會計算圖表面板。我期待的輸出org.jfree.chart.ChartPanel[chartpanelBoa 的組件計數 1計算組件的幕后因素是什么?
1 回答

慕的地6264312
TA貢獻1817條經驗 獲得超6個贊
如源代碼所示org.jfree.chart.ChartPanel
, aChartPanel
是 a JPanel
,但它不包含 的嵌套實例Component
。導入了一些Swing 組件來處理上下文菜單、工具提示等,但其JFreeChart
本身是純Java2D的。
看起來您想在禁用圖表時更改圖表的視覺表示。您仍然可以調用自身setEnabled()
以ChartPanel
利用JPanel
UI 委托。您還可以根據需要修改圖表的內部;此示例setBackgroundPaint()
使用或使背景變暗setBackgroundImageAlpha()
。
添加回答
舉報
0/150
提交
取消