minor fix when few mote types available
This commit is contained in:
parent
776e43d179
commit
cbdb1c242d
1 changed files with 14 additions and 12 deletions
|
@ -26,13 +26,15 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: MoteTypeInformation.java,v 1.2 2007/01/09 09:49:24 fros4943 Exp $
|
* $Id: MoteTypeInformation.java,v 1.3 2008/02/07 13:14:42 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.plugins;
|
package se.sics.cooja.plugins;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import se.sics.cooja.*;
|
import se.sics.cooja.*;
|
||||||
|
@ -78,13 +80,13 @@ public class MoteTypeInformation extends VisPlugin {
|
||||||
|
|
||||||
mainPane.add(smallPane);
|
mainPane.add(smallPane);
|
||||||
mainPane.add(Box.createRigidArea(new Dimension(0,10)));
|
mainPane.add(Box.createRigidArea(new Dimension(0,10)));
|
||||||
|
|
||||||
for (MoteType moteType: mySimulation.getMoteTypes()) {
|
for (MoteType moteType: mySimulation.getMoteTypes()) {
|
||||||
smallPane = new JPanel();
|
smallPane = new JPanel();
|
||||||
smallPane.setLayout(new BorderLayout());
|
smallPane.setLayout(new BorderLayout());
|
||||||
|
|
||||||
label = new JLabel(GUI.getDescriptionOf(moteType) +": " +
|
label = new JLabel(GUI.getDescriptionOf(moteType) +": " +
|
||||||
"ID=" + moteType.getIdentifier() +
|
"ID=" + moteType.getIdentifier() +
|
||||||
", \"" + moteType.getDescription() + "\"");
|
", \"" + moteType.getDescription() + "\"");
|
||||||
label.setAlignmentX(JLabel.CENTER_ALIGNMENT);
|
label.setAlignmentX(JLabel.CENTER_ALIGNMENT);
|
||||||
smallPane.add(BorderLayout.NORTH, label);
|
smallPane.add(BorderLayout.NORTH, label);
|
||||||
|
@ -93,30 +95,30 @@ public class MoteTypeInformation extends VisPlugin {
|
||||||
if (moteTypeVisualizer != null) {
|
if (moteTypeVisualizer != null) {
|
||||||
moteTypeVisualizer.setBorder(BorderFactory.createEtchedBorder());
|
moteTypeVisualizer.setBorder(BorderFactory.createEtchedBorder());
|
||||||
smallPane.add(BorderLayout.CENTER, moteTypeVisualizer);
|
smallPane.add(BorderLayout.CENTER, moteTypeVisualizer);
|
||||||
} else
|
} else {
|
||||||
smallPane.add(BorderLayout.CENTER, Box.createVerticalStrut(25));
|
smallPane.add(BorderLayout.CENTER, Box.createVerticalStrut(25));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
mainPane.add(smallPane);
|
mainPane.add(smallPane);
|
||||||
mainPane.add(Box.createRigidArea(new Dimension(0,25)));
|
mainPane.add(Box.createRigidArea(new Dimension(0,25)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.getContentPane().add(BorderLayout.NORTH, new JScrollPane(mainPane,
|
||||||
this.setContentPane(new JScrollPane(mainPane,
|
|
||||||
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
|
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
|
||||||
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED));
|
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED));
|
||||||
pack();
|
pack();
|
||||||
setPreferredSize(new Dimension(350,500));
|
setPreferredSize(new Dimension(350,500));
|
||||||
setSize(new Dimension(350,500));
|
setSize(new Dimension(350,500));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setSelected(true);
|
setSelected(true);
|
||||||
} catch (java.beans.PropertyVetoException e) {
|
} catch (java.beans.PropertyVetoException e) {
|
||||||
// Could not select
|
// Could not select
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void closePlugin() {
|
public void closePlugin() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue