package org.lucci.madhoc.gui.runtime;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
public class JVMComponent extends RuntimeComponentElement
{
private JButton gcButton = new JButton();
private JButton shootButton = new JButton("Shoot!");
public JVMComponent()
{
ActionListener buttonHandler = new ButtonHandler();
setLayout(new GridBagLayout());
{
gcButton.addActionListener(buttonHandler);
gcButton.setToolTipText("<html><b>Forces</b> the garbage collector to proceed..");
shootButton.setIcon(new ImageIcon(getClass().getResource("YellowCircle.gif")));
GridBagConstraints c = new GridBagConstraints();
c.gridx = 0;
c.gridy = 0;
add(gcButton, c);
}
{
shootButton.addActionListener(buttonHandler);
shootButton.setToolTipText("<html><b>Shoots</b> the window in a file.");
GridBagConstraints c = new GridBagConstraints();
c.gridx = 0;
c.gridy = 1;
add(shootButton, c);
}
}
public class ButtonHandler implements ActionListener
{
public void actionPerformed(ActionEvent event)
{
Object source = event.getSource();
if (source == gcButton)
{
System.gc();
}
else if (source == shootButton)
{
}
}
}
public void stateChanged()
{
}
public void iterationPerformed()
{
}
}