我試圖給我的圖形添加一個標籤,但無法將它從默認中心位置移出。這就是我現在所擁有的,我更新方法(它刷新顯示器):如何將JLabel添加到JUNG圖形中?
Graph<String, String> graph = getGraph();
BasicVisualizationServer<String, String> vv = getViewer(graph);
frame.getContentPane().removeAll();
frame.getContentPane().add(vv);
JLabel label = new JLabel("<html>ndp: blue<br>mdp: dark green</html>", JLabel.LEFT);
vv.add(label);
frame.pack();
它顯示的標籤,但不會把它放在左邊不管我的標籤貼或如何我指定它應該留下......我做錯了什麼?