我有一組垂直排列的元素。它們顯示下面的代碼:如何在豎直排列的元素之間放置水平線?
JPanel myPanel = new JPanel();
myPanel.setLayout(new BoxLayout(myPanel, BoxLayout.Y_AXIS));
JButton button = new JButton("My Button");
JLabel label = new JLabel("My label!!!!!!!!!!!");
myPanel.add(button);
myPanel.add(label);
我想提出(在HTML像<hr>
)我的元素之間的水平線。有人知道如何做到這一點嗎?
又一次的回答是在Swing教程中。這傢伙不斷拒絕閱讀教程。看看他在這篇文章中的評論:http://stackoverflow.com/questions/2561305/how-can-i-set-distance-between-elements-ordered-vertically,他說他的時間比我們更重要,這就是爲什麼他不打算閱讀教程。令我驚訝的是,他仍然得到了餵給他的答案。 – camickr 2010-04-02 16:02:10